请求头添加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

@@ -128,6 +128,8 @@ $http.requestStart = function(options) {
}
if (storeUserInfo.token) {
options.header['token'] = storeUserInfo.token;
options.header['appType'] = 'medical';
};
return options;
}

View File

@@ -270,7 +270,7 @@
"text": "购物车"
},
{
"pagePath": "pages/library/library",
"pagePath": "pages/news/news",
"iconPath": "static/tab/tab_nor_03.png",
"selectedIconPath": "static/tab/tab_cur_03.png",
"text": "太湖公益"

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}}
<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>
<view class="content" v-html="news.content"></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>
@@ -25,19 +42,18 @@
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>

View File

@@ -75,7 +75,7 @@
.box {
background-color: #fff;
@include pleft_right(10px);
min-height: calc(100vh - 70rpx);
min-height: calc(100vh - 270rpx);
}
.title{font-size: 32rpx; font-weight: bold; display: block; text-align: center;}
.content { font-size: 26rpx; line-height: 48rpx; margin-top: 10rpx;}

View File

@@ -188,7 +188,7 @@
</view>
</view>
<view class="moreBox shiting">
<text @click="onPageJump()">更多试听</text>
<text @click="onPageJump('/pages/course/index',26,'精彩试听')">更多试听</text>
</view>
</view>
@@ -519,9 +519,9 @@
},
// 跳转
onPageJump(url,thatId) {
onPageJump(url,thatId,title) {
uni.navigateTo({
url: `${url}?id=${thatId}`
url: `${url}?id=${thatId}&title=${title}`
});
},
@@ -1326,6 +1326,6 @@
}
.imgcontainer {
background-color: #d0e9ff;
background-color: $imgBg;
}
</style>

28
project.config.json Normal file
View File

@@ -0,0 +1,28 @@
{
"appid": "touristappid",
"compileType": "miniprogram",
"libVersion": "2.25.3",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
}

View File

@@ -3,6 +3,8 @@
$themeColor: #258feb;
// 页面背景色
$containerColor: #f4f7ff;
// 图片背景颜色
$imgBg: #edf3ff;
@mixin theme($type,$path:''){
@if $type == "btn_bg" {
@@ -17,6 +19,7 @@ $containerColor: #f4f7ff;
background-image: linear-gradient(180deg, #e4edff 0%, #fff 100%);
}
}
// 左右paddingpx
@mixin pleft_right($p) {
padding-left:$p ;