请求头添加apptype

This commit is contained in:
@fawn-nine
2024-05-29 17:02:21 +08:00
parent 92df12db8e
commit 97b70afa01
7 changed files with 126 additions and 31 deletions

View File

@@ -2,14 +2,31 @@
<view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar title="消息详情"></z-nav-bar>
<view class="box">
<view class="title">
{{news.title}}
</view>
<view class="content" v-html="news.content"></view>
<z-nav-bar :title="pageTitle"></z-nav-bar>
<view class="learnBox box" v-if="courseList.length > 0">
<view class="learn flexbox shiting">
<view class="item" v-for="(item, index) in courseList" :key="index">
<view class="imgcontainer">
<image :src="item.image" mode="aspectFit"></image>
</view>
<view class="buyItems flexbox">
<view class="txt555">
{{item.title}}
</view>
<!-- <view class="buybtn" @click="onPageJump()">
<span>购买</span>
</view> -->
</view>
</view>
</view>
<u-divider text="已加载全部"></u-divider>
<u-divider text="暂无数据"></u-divider>
<u-divider text="加载中..."></u-divider>
</view>
<public-module></public-module>
<z-navigation></z-navigation>
<music-play :playData="playData"></music-play>
</view>
</template>
@@ -20,24 +37,23 @@
var clear;
import {
mapState
} from 'vuex';
} from 'vuex';
export default {
data() {
return {
playData: {},
newsId: null,
news: {
content: '',
title: ''
}
tagId: null,
pageTitle: '',
courseList: []
};
},
//第一次加载
onLoad(e) {
// 隐藏原生的tabbar
uni.hideTabBar();
this.newsId = e.newsid
console.log(e, '------')
this.tagId = e.id
this.pageTitle = e.title
console.log(e, '传入分类id')
},
computed: {
...mapState(['userInfo'])
@@ -55,15 +71,27 @@
//方法
methods: {
getData() {
this.$http
.post('common/message/getMessageById?id=' + this.newsId)
$http.request({
url: "medical/home/getMarketCourseList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"id": this.tagId,
"limit": 12,
"page": 1
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.code == 0) {
this.news.content = res.result.content
this.news.title = res.result.title
if (res.courseList.records.length > 0) {
this.courseList = res.courseList.records
} else {
this.courseList = []
}
}
}).catch(e => {
console.log(e, '获取新闻详情报错')
});
}
},
@@ -71,12 +99,46 @@
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.flexbox{display: flex; }
.imgcontainer {
background-color: $imgBg;
}
.box {
background-color: #fff;
@include pleft_right(10px);
min-height: calc(100vh - 70rpx);
min-height: calc(100vh - 270rpx);
}
.learnBox {
background-color: #fff;
margin-top: 10px;
@include ptop_bottm(10px);
@include pleft_right(10px);
.learn { flex-wrap: wrap;
justify-content: space-between;
margin-top: 20rpx;
.item {
width: 48%;margin-bottom: 16px;
overflow: hidden;
image {
width: 100%;
height: 200rpx;
}
.txt555 { display: block; text-align: center;
height: 40rpx; width: 100%;
line-height: 40rpx;
@include bov(1);
margin-top: 10rpx;
font-size: 24rpx;
}
}
}
}
.title{font-size: 32rpx; font-weight: bold; display: block; text-align: center;}
.content { font-size: 26rpx; line-height: 48rpx; margin-top: 10rpx;}
</style>