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> <image src="https://static.ticket.sz-trip.com/changshu/images/index/title1.png" mode="heightFix" class="title-img"></image>
<view class="winnow-box"> <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"> <view class="winnow-title flex-between">
{{item.title}} {{item.title}}
<span :style="{color: item.spanColor}">查看更多产品 ></span> <span :style="{color: item.spanColor}" @click.stop="gotoUrlNew(item.url)">查看更多产品 ></span>
</view> </view>
<view class="winnow-item" v-for="(pItem, pIndex) in item.list" :key="pIndex" @click="gotoDetailByTypeToJdsz(pItem)"> <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> <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 Vue from "vue";
import store from '@/store';
// 格式化富文本 // 格式化富文本
Vue.prototype.formateRichText = str => { Vue.prototype.formateRichText = str => {
@ -235,40 +236,60 @@ Vue.prototype.getHeadImg = type => {
// 判断君到苏州token是否生效 // 判断君到苏州token是否生效
Vue.prototype.checkIsLoginJdsz = () => { Vue.prototype.checkIsLoginJdsz = () => {
Vue.prototype.Post({ return new Promise((resolve, reject) => {
apiType: 'jdsz', uni.request({
}, '/api/uservice/user/getMyInfo').then(res => { method: 'POST',
if(res.code == 1 || res.code == 200) { url: 'https://api.cloud.sz-trip.com/api/uservice/user/getMyInfo',
return res.data.token header: {
}else if(res.code == 401) { 'content-type': 'application/json',
// 重新登陆 'token': uni.getStorageSync('jdszToken') || ''
Vue.prototype.Post({}, '/api/user/getAuthCode').then(res => { },
if (res.code == 1 || res.code == 200) { data: {},
Vue.prototype.Post({ success: res => {
apiType: 'jdsz', console.log(16516651,res)
}, '/api/uservice/user/loginBykunshan').then(res => { if (res.data.code == 1) {
if(res.data.code == 401) { resolve(res.data.data.token)
this.$store.commit('changeLoginPath') } else if (res.data.code == 401) {
return; // 重新登陆
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; break;
} }
uni.navigateTo({
url: '/subPackages/webPage/webPage?url=' + encodeURIComponent(url)
});
return;
Vue.prototype.checkIsLoginJdsz().then(res => { Vue.prototype.checkIsLoginJdsz().then(res => {
if(res) { if(res) {
uni.navigateTo({ uni.navigateTo({

2
subPackages/rim/rimList.vue

@ -9,7 +9,7 @@
</view> </view>
<view class="box flex-between"> <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> <image :src="showImgs(item.headimg)" mode="aspectFill"></image>
<view class="content flex-column"> <view class="content flex-column">
<view class="title text-overflowRows">{{item.title}}</view> <view class="title text-overflowRows">{{item.title}}</view>

Loading…
Cancel
Save