Commit 08764e75 authored by 潘永坪's avatar 潘永坪

组合票首页应急预案处理

parent 2963e95a
...@@ -20,14 +20,44 @@ const request = (url = '', data = {},showLoad) => { ...@@ -20,14 +20,44 @@ const request = (url = '', data = {},showLoad) => {
url: baseUrl + url+'?token='+uni.getStorageSync('token'), url: baseUrl + url+'?token='+uni.getStorageSync('token'),
data:data, data:data,
dataType: 'json', dataType: 'json',
}).then((response) => { success(res) {
uni.hideLoading() uni.hideLoading()
let [error,res] = response if(res.statusCode=='200'){
resolve(res.data) //请求成功,状态成功
}).catch(error => { resolve(res.data)
uni.hideLoading() }else{
let [err, res] = error //请求成功,状态不对
reject(err) reject(res)
uni.showToast({
title: res.message,
icon: 'none',
duration:4000
})
}
},
fail(err) {
//请求超时,没有网络等
uni.hideLoading()
uni.getNetworkType({//首次判断网络状态
success: (res) => {
let networkType = res.networkType
if (networkType === 'none') {//none是没有网络
uni.showToast({
title:'网络断开',
icon: 'none',
duration:4000
})
}else{
uni.showToast({
title:'请求超时',
icon: 'none',
duration:4000
})
reject(err)
}
}
})
}
}) })
}) })
} }
......
...@@ -175,6 +175,12 @@ ...@@ -175,6 +175,12 @@
</u-modal> </u-modal>
</scroll-view> </scroll-view>
<image class="suodaoImg" v-if="showSuodaoImg" src="https://lx.pangdly.com/img/cjsdFirst.50a2e63.jpg"></image> <image class="suodaoImg" v-if="showSuodaoImg" src="https://lx.pangdly.com/img/cjsdFirst.50a2e63.jpg"></image>
<!-- 系统无法访问时弹窗 -->
<u-popup :show="showTip" :round="20">
<view style="padding: 300rpx 0;text-align: center;font-size: 32rpx;font-weight: bold;">
当前访问人数过多,请稍后重试
</view>
</u-popup>
</view> </view>
</template> </template>
...@@ -194,6 +200,7 @@ export default { ...@@ -194,6 +200,7 @@ export default {
}, },
data() { data() {
return { return {
showTip:false,//系统调不通或者崩了跳出弹窗
detailData:'',//详情数据 detailData:'',//详情数据
showSuodaoImg:false,//索道耳麦图片是否显示隐藏 showSuodaoImg:false,//索道耳麦图片是否显示隐藏
companyId:'',//公司Id companyId:'',//公司Id
...@@ -332,6 +339,7 @@ export default { ...@@ -332,6 +339,7 @@ export default {
//解决支付宝小程序报错问题 //解决支付宝小程序报错问题
this.$refs.detail.showPop = false this.$refs.detail.showPop = false
} }
let newTimestamp=uni.getStorageSync('newTimestamp')||''
let token = uni.getStorageSync('token') let token = uni.getStorageSync('token')
if (token) { if (token) {
uni.getLocation({ uni.getLocation({
...@@ -340,12 +348,30 @@ export default { ...@@ -340,12 +348,30 @@ export default {
let latitude = res.latitude //纬度 let latitude = res.latitude //纬度
let longitude = res.longitude //经度 let longitude = res.longitude //经度
this.showDistance = true this.showDistance = true
this.initList(latitude, longitude) //判断时间戳,之前请求失败,必须大于缓存时间戳才进行请求
if(newTimestamp){
if(Date.now()>newTimestamp){
this.initList(latitude, longitude)
}else{
this.showTip=true
}
}else{
this.initList(latitude, longitude)
}
}, },
fail: res => { fail: res => {
let latitude = '' let latitude = ''
let longitude = '' let longitude = ''
this.initList(latitude, longitude) //判断时间戳,之前请求失败,必须大于缓存时间戳才进行请求
if(newTimestamp){
if(Date.now()>newTimestamp){
this.initList(latitude, longitude)
}else{
this.showTip=true
}
}else{
this.initList(latitude, longitude)
}
} }
}) })
} }
...@@ -364,6 +390,7 @@ export default { ...@@ -364,6 +390,7 @@ export default {
} }
this.scenicList=[] this.scenicList=[]
this.$request('/scenic/groupGood/findGroupGoodProductList', data).then(res => { this.$request('/scenic/groupGood/findGroupGoodProductList', data).then(res => {
uni.removeStorageSync('newTimestamp')
if (res.code == '00') { if (res.code == '00') {
let merchantList=res.data.merchantList||[] let merchantList=res.data.merchantList||[]
merchantList.forEach(item=>{ merchantList.forEach(item=>{
...@@ -413,7 +440,16 @@ export default { ...@@ -413,7 +440,16 @@ export default {
icon: 'none' icon: 'none'
}) })
} }
}) }).catch(error => {
this.showTip=true
// 获取当前时间戳
let currentTime = Date.now()
// 设置需要添加的分钟数
let minutesToAdd = 5 // 这里假设要添加5分钟
// 计算新的时间戳
let newTimestamp = currentTime + (minutesToAdd * 60 * 1000)
uni.setStorageSync('newTimestamp', newTimestamp)
})
}, },
//---初始化详情 //---初始化详情
initDetail(merchantId){ initDetail(merchantId){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment