From 684ef70c5834b3bdee5997dbdc8bf193eacb7851 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 01 八月 2024 11:34:01 +0800
Subject: [PATCH] lll
---
wechat_jiaxuan/utils/request.js | 40 ++++++++++++++++++++++++++--------------
1 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/wechat_jiaxuan/utils/request.js b/wechat_jiaxuan/utils/request.js
index ff29781..865d53a 100644
--- a/wechat_jiaxuan/utils/request.js
+++ b/wechat_jiaxuan/utils/request.js
@@ -1,10 +1,14 @@
-import { baseUrl } from "./config"
+import {
+ baseUrl
+} from "./config"
let number = 0
-export function request(options){
+export function request(options) {
let loading = options.loading || '1' // 榛樿鍊�1鏄剧ず锛屽惁鍒欎笉鏄剧ず
- if(loading == '1'){
- wx.showLoading({mask: true})
- number ++
+ if (loading == '1') {
+ wx.showLoading({
+ mask: true
+ })
+ number++
}
return new Promise(resolve => {
wx.request({
@@ -20,10 +24,19 @@
if (res.data.code === 200) {
resolve(res.data || true)
} else {
- if(res.data.code == 5111 || res.data.code == 5112){
- wx.switchTab({
- url: '/pages/index/index',
+ if (options.data && options.data.isAuth && (res.data.code == 5111 || res.data.code == 5112 || res.data.code == 5110)) {
+ // wx.switchTab({
+ // url: '/pages/index/index',
+ // })
+ resolve(res.data)
+ res.data.message && wx.showToast({
+ title: res.data.message || '鍙戠敓閿欒',
+ icon: 'none'
})
+ return
+ }
+ if(res.data.code == 5111 || res.data.code == 5112 || res.data.code == 5110){
+ return
}
res.data.message && wx.showToast({
title: res.data.message || '鍙戠敓閿欒',
@@ -39,14 +52,13 @@
})
},
complete() {
- if(loading == '1'){
- number --
- if(number == 0){
+ if (loading == '1') {
+ number--
+ if (number == 0) {
wx.hideLoading()
}
}
}
})
- } )
-}
-
+ })
+}
\ No newline at end of file
--
Gitblit v1.9.3