From 744c16a15432461394e1e2dbdfaea34a766fcc6b Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 01 八月 2024 08:53:29 +0800
Subject: [PATCH] ‘’
---
wechat_jiaxuan/utils/request.js | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/wechat_jiaxuan/utils/request.js b/wechat_jiaxuan/utils/request.js
index 7d34329..ff29781 100644
--- a/wechat_jiaxuan/utils/request.js
+++ b/wechat_jiaxuan/utils/request.js
@@ -1,9 +1,10 @@
import { baseUrl } from "./config"
-
+let number = 0
export function request(options){
let loading = options.loading || '1' // 榛樿鍊�1鏄剧ず锛屽惁鍒欎笉鏄剧ず
if(loading == '1'){
- wx.showLoading()
+ wx.showLoading({mask: true})
+ number ++
}
return new Promise(resolve => {
wx.request({
@@ -19,9 +20,9 @@
if (res.data.code === 200) {
resolve(res.data || true)
} else {
- if(res.data.code && res.data.code == 5112){
- wx.navigateTo({
- url: '/pages/auth/auth',
+ if(res.data.code == 5111 || res.data.code == 5112){
+ wx.switchTab({
+ url: '/pages/index/index',
})
}
res.data.message && wx.showToast({
@@ -39,7 +40,10 @@
},
complete() {
if(loading == '1'){
- wx.hideLoading()
+ number --
+ if(number == 0){
+ wx.hideLoading()
+ }
}
}
})
--
Gitblit v1.9.3