chenkainan 7 months ago
parent
commit
dfbdef0bd7
  1. 4
      pages/index/index.vue
  2. 88
      static/js/CommonFunction.js
  3. 2
      subPackages/rim/rimList.vue

4
pages/index/index.vue

@ -29,10 +29,10 @@
<!-- 常熟精选 -->
<image src="https://static.ticket.sz-trip.com/changshu/images/index/title1.png" mode="heightFix" class="title-img"></image>
<view class="winnow-box">
<view v-for="(item,index) in winnowList" :key="index" @click.stop="gotoUrlNew(item.url)">
<view v-for="(item,index) in winnowList" :key="index">
<view class="winnow-title flex-between">
{{item.title}}
<span :style="{color: item.spanColor}">查看更多产品 ></span>
<span :style="{color: item.spanColor}" @click.stop="gotoUrlNew(item.url)">查看更多产品 ></span>
</view>
<view class="winnow-item" v-for="(pItem, pIndex) in item.list" :key="pIndex" @click="gotoDetailByTypeToJdsz(pItem)">
<image :src="showImgs(pItem.headimg)" mode="aspectFill" class="winnow-img"></image>

88
static/js/CommonFunction.js

@ -1,5 +1,6 @@
// 获取路径参数
import Vue from "vue";
import store from '@/store';
// 格式化富文本
Vue.prototype.formateRichText = str => {
@ -235,40 +236,60 @@ Vue.prototype.getHeadImg = type => {
// 判断君到苏州token是否生效
Vue.prototype.checkIsLoginJdsz = () => {
Vue.prototype.Post({
apiType: 'jdsz',
}, '/api/uservice/user/getMyInfo').then(res => {
if(res.code == 1 || res.code == 200) {
return res.data.token
}else if(res.code == 401) {
// 重新登陆
Vue.prototype.Post({}, '/api/user/getAuthCode').then(res => {
if (res.code == 1 || res.code == 200) {
Vue.prototype.Post({
apiType: 'jdsz',
}, '/api/uservice/user/loginBykunshan').then(res => {
if(res.data.code == 401) {
this.$store.commit('changeLoginPath')
return;
return new Promise((resolve, reject) => {
uni.request({
method: 'POST',
url: 'https://api.cloud.sz-trip.com/api/uservice/user/getMyInfo',
header: {
'content-type': 'application/json',
'token': uni.getStorageSync('jdszToken') || ''
},
data: {},
success: res => {
console.log(16516651,res)
if (res.data.code == 1) {
resolve(res.data.data.token)
} else if (res.data.code == 401) {
// 重新登陆
Vue.prototype.Post({}, '/api/user/getAuthCode').then(res => {
if (res.code && res.code == 200 && res.data) {
uni.request({
method: 'POST',
url: 'https://api.cloud.sz-trip.com/api/uservice/user/loginByChangshu',
header: {
'content-type': 'application/json'
},
data: {
code: res.data
},
success: res => {
if(res.data.code == 401) {
store.commit('changeLoginPath');
resolve('')
return;
}
uni.setStorageSync('jdszToken', res.data.data.token)
resolve(res.data.data.token)
}
})
}
}).catch(res => {
if (res.data.code == 201) {
uni.showToast({
title: '未授权手机号',
icon: 'none'
})
// 去登录页面授权
setTimeout(()=>{
uni.navigateTo({
url: '/pages/login/login?needAuth=1'
})
},400)
}
uni.setStorageSync('jdszToken', res.data.data.token)
})
}
}).catch(res => {
if (res.data.code == 201) {
uni.showToast({
title: '未授权手机号',
icon: 'none'
})
// 去登录页面授权
setTimeout(()=>{
uni.navigateTo({
url: '/pages/login/login?needAuth=1'
})
},400)
}
})
}
}
})
})
}
@ -345,11 +366,6 @@ Vue.prototype.gotoDetailByTypeToJdsz = item => {
break;
}
uni.navigateTo({
url: '/subPackages/webPage/webPage?url=' + encodeURIComponent(url)
});
return;
Vue.prototype.checkIsLoginJdsz().then(res => {
if(res) {
uni.navigateTo({

2
subPackages/rim/rimList.vue

@ -9,7 +9,7 @@
</view>
<view class="box flex-between">
<view v-for="(item,index) in list" :key="index" class="item">
<view v-for="(item,index) in list" :key="index" class="item" @click="gotoDetailByTypeToJdsz(item)">
<image :src="showImgs(item.headimg)" mode="aspectFill"></image>
<view class="content flex-column">
<view class="title text-overflowRows">{{item.title}}</view>

Loading…
Cancel
Save