请求头添加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) { if (storeUserInfo.token) {
options.header['token'] = storeUserInfo.token; options.header['token'] = storeUserInfo.token;
options.header['appType'] = 'medical';
}; };
return options; return options;
} }

View File

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

View File

@@ -2,14 +2,31 @@
<view> <view>
<!-- 公共组件-每个页面必须引入 --> <!-- 公共组件-每个页面必须引入 -->
<public-module></public-module> <public-module></public-module>
<z-nav-bar title="消息详情"></z-nav-bar> <z-nav-bar :title="pageTitle"></z-nav-bar>
<view class="box"> <view class="learnBox box" v-if="courseList.length > 0">
<view class="title"> <view class="learn flexbox shiting">
{{news.title}} <view class="item" v-for="(item, index) in courseList" :key="index">
</view> <view class="imgcontainer">
<view class="content" v-html="news.content"></view> <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> </view>
<public-module></public-module>
<z-navigation></z-navigation>
<music-play :playData="playData"></music-play> <music-play :playData="playData"></music-play>
</view> </view>
</template> </template>
@@ -20,24 +37,23 @@
var clear; var clear;
import { import {
mapState mapState
} from 'vuex'; } from 'vuex';
export default { export default {
data() { data() {
return { return {
playData: {}, playData: {},
newsId: null, tagId: null,
news: { pageTitle: '',
content: '', courseList: []
title: ''
}
}; };
}, },
//第一次加载 //第一次加载
onLoad(e) { onLoad(e) {
// 隐藏原生的tabbar // 隐藏原生的tabbar
uni.hideTabBar(); uni.hideTabBar();
this.newsId = e.newsid this.tagId = e.id
console.log(e, '------') this.pageTitle = e.title
console.log(e, '传入分类id')
}, },
computed: { computed: {
...mapState(['userInfo']) ...mapState(['userInfo'])
@@ -55,15 +71,27 @@
//方法 //方法
methods: { methods: {
getData() { getData() {
this.$http $http.request({
.post('common/message/getMessageById?id=' + this.newsId) 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 => { .then(res => {
if (res.code == 0) { if (res.code == 0) {
this.news.content = res.result.content if (res.courseList.records.length > 0) {
this.news.title = res.result.title this.courseList = res.courseList.records
} else {
this.courseList = []
}
} }
}).catch(e => {
console.log(e, '获取新闻详情报错')
}); });
} }
}, },
@@ -71,12 +99,46 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/style/mixin.scss'; @import '@/style/mixin.scss';
.flexbox{display: flex; }
.imgcontainer {
background-color: $imgBg;
}
.box { .box {
background-color: #fff; background-color: #fff;
@include pleft_right(10px); @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> </style>

View File

@@ -75,7 +75,7 @@
.box { .box {
background-color: #fff; background-color: #fff;
@include pleft_right(10px); @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;} .title{font-size: 32rpx; font-weight: bold; display: block; text-align: center;}
.content { font-size: 26rpx; line-height: 48rpx; margin-top: 10rpx;} .content { font-size: 26rpx; line-height: 48rpx; margin-top: 10rpx;}

View File

@@ -188,7 +188,7 @@
</view> </view>
</view> </view>
<view class="moreBox shiting"> <view class="moreBox shiting">
<text @click="onPageJump()">更多试听</text> <text @click="onPageJump('/pages/course/index',26,'精彩试听')">更多试听</text>
</view> </view>
</view> </view>
@@ -519,9 +519,9 @@
}, },
// 跳转 // 跳转
onPageJump(url,thatId) { onPageJump(url,thatId,title) {
uni.navigateTo({ uni.navigateTo({
url: `${url}?id=${thatId}` url: `${url}?id=${thatId}&title=${title}`
}); });
}, },
@@ -1326,6 +1326,6 @@
} }
.imgcontainer { .imgcontainer {
background-color: #d0e9ff; background-color: $imgBg;
} }
</style> </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; $themeColor: #258feb;
// 页面背景色 // 页面背景色
$containerColor: #f4f7ff; $containerColor: #f4f7ff;
// 图片背景颜色
$imgBg: #edf3ff;
@mixin theme($type,$path:''){ @mixin theme($type,$path:''){
@if $type == "btn_bg" { @if $type == "btn_bg" {
@@ -17,6 +19,7 @@ $containerColor: #f4f7ff;
background-image: linear-gradient(180deg, #e4edff 0%, #fff 100%); background-image: linear-gradient(180deg, #e4edff 0%, #fff 100%);
} }
} }
// 左右paddingpx // 左右paddingpx
@mixin pleft_right($p) { @mixin pleft_right($p) {
padding-left:$p ; padding-left:$p ;