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

组合票首页应急预案处理

parent 2963e95a
......@@ -20,14 +20,44 @@ const request = (url = '', data = {},showLoad) => {
url: baseUrl + url+'?token='+uni.getStorageSync('token'),
data:data,
dataType: 'json',
}).then((response) => {
uni.hideLoading()
let [error,res] = response
resolve(res.data)
}).catch(error => {
uni.hideLoading()
let [err, res] = error
reject(err)
success(res) {
uni.hideLoading()
if(res.statusCode=='200'){
//请求成功,状态成功
resolve(res.data)
}else{
//请求成功,状态不对
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 @@
</u-modal>
</scroll-view>
<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>
</template>
......@@ -194,6 +200,7 @@ export default {
},
data() {
return {
showTip:false,//系统调不通或者崩了跳出弹窗
detailData:'',//详情数据
showSuodaoImg:false,//索道耳麦图片是否显示隐藏
companyId:'',//公司Id
......@@ -332,6 +339,7 @@ export default {
//解决支付宝小程序报错问题
this.$refs.detail.showPop = false
}
let newTimestamp=uni.getStorageSync('newTimestamp')||''
let token = uni.getStorageSync('token')
if (token) {
uni.getLocation({
......@@ -340,12 +348,30 @@ export default {
let latitude = res.latitude //纬度
let longitude = res.longitude //经度
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 => {
let latitude = ''
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 {
}
this.scenicList=[]
this.$request('/scenic/groupGood/findGroupGoodProductList', data).then(res => {
uni.removeStorageSync('newTimestamp')
if (res.code == '00') {
let merchantList=res.data.merchantList||[]
merchantList.forEach(item=>{
......@@ -413,7 +440,16 @@ export default {
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){
......
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