From 872f96d9d4ba249da4948ea52b99a6e13ff85d58 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Thu, 14 Nov 2024 15:38:57 +0800 Subject: [PATCH] fix --- apis/request.js | 43 ++++++++++++------------------- config/request.js | 2 +- order/orderDetail/orderDetail.vue | 2 +- order/orders/orders.vue | 2 +- pages/index/index.vue | 2 +- 5 files changed, 20 insertions(+), 31 deletions(-) diff --git a/apis/request.js b/apis/request.js index a75d827..35a7498 100644 --- a/apis/request.js +++ b/apis/request.js @@ -1,16 +1,7 @@ import config from '@/config/request' -let HTTP_COUNT = 0 // loading次数 +let logouted = 0 const request = options => { - HTTP_COUNT++ - if (config.showLoading) { - // 请求数据时的loading - // uni.showToast({ - // title: '加载中', - // duration: 200, - // icon: 'loading' - // }) - } const header = Object.assign({}, config.headers, { token: uni.getStorageSync('token') }) @@ -29,18 +20,22 @@ const request = options => { if (status === 200) { resolve(data) } else if (status == 401) { - // 登录过期 - uni.clearStorageSync() - uni.showToast({ - title: message, - icon: 'none' - }) - setTimeout(() => { - uni.navigateTo({ - url: '../login/login' + if (!logouted) { + // 登录过期 + uni.clearStorageSync() + uni.showToast({ + title: message, + icon: 'none' }) - }, 1500) - reject(data) + setTimeout(() => { + logouted = 0 + uni.reLaunch({ + url: '/pages/index/index' + }) + }, 1500) + reject(data) + logouted = 1 + } } else if (!status) { resolve(data) } else { @@ -58,12 +53,6 @@ const request = options => { }) reject(err) }, - complete: () => { - if (config.showLoading) { - // HTTP_COUNT-- - // HTTP_COUNT || uni.hideLoading() - } - } }) }) } diff --git a/config/request.js b/config/request.js index 8ee4043..70b625e 100644 --- a/config/request.js +++ b/config/request.js @@ -6,7 +6,7 @@ export default { baseURL: 'https://www.occupationlab.com/', - // baseURL: 'http://192.168.31.151:9000/', + // baseURL: 'http://192.168.31.51:9000/', // baseURL: 'http://121.37.12.51/', headers: { 'Content-Type': 'application/json;charset=UTF-8' diff --git a/order/orderDetail/orderDetail.vue b/order/orderDetail/orderDetail.vue index ba33dcc..774f85c 100644 --- a/order/orderDetail/orderDetail.vue +++ b/order/orderDetail/orderDetail.vue @@ -194,7 +194,7 @@ 修改 - + 续费 diff --git a/order/orders/orders.vue b/order/orders/orders.vue index dac4b6c..a95141b 100644 --- a/order/orders/orders.vue +++ b/order/orders/orders.vue @@ -215,7 +215,7 @@ }, // 跳转详情 toDetail(item) { - if(!this.auth('订单管理:查看')) return + // if(!this.auth('订单管理:查看')) return this.$util.to(`../orderDetail/orderDetail?orderId=${item.orderId}&show=1`) }, // 删除 diff --git a/pages/index/index.vue b/pages/index/index.vue index cdcc2a9..ddae866 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -19,7 +19,7 @@ 方案 -
  • +
  • 订单