From ed50246d6151ad9e86d69d8698e9dc588856dcf8 Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期五, 27 九月 2024 17:26:10 +0800
Subject: [PATCH] 1
---
plugins/http.js | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/plugins/http.js b/plugins/http.js
index f393090..59919fb 100644
--- a/plugins/http.js
+++ b/plugins/http.js
@@ -52,6 +52,7 @@
dataType: options.dataType ? options.dataType : 'json',
data: options.data || null,
header,
+ timeout: 30000,
success: async (res) => {
if (!options.ignore) {
message.hideLoading()
@@ -71,7 +72,7 @@
code: 0,
msg: ''
})
- } else if (res.data.code === '3000' || res.data && res.data.code &&
+ } else if (res.data.code === '3000' || res.data.code === '30000' || res.data && res.data.code &&
res.data.code.startsWith('3000')) {
let validmsg = ''
if (Array.isArray(res.data.data)) {
@@ -108,8 +109,10 @@
res.data.code.startsWith('401')) {
console.log('resp', res)
// storage.removeItem('token')
- await store.dispatch('logout')
- message.showToast('登录信息失效')
+ // await store.dispatch('logout')
+ store.commit('updateLogin', false)
+
+ await message.showToast('登录信息失效')
// #ifdef PUB_CUSTOMER
uni.reLaunch({
@@ -150,9 +153,10 @@
// commit('updat')
// store.commit('updateLogin', false)
console.log('401', res)
- storage.removeItem('token')
- await store.dispatch('logout')
- message.showToast('登录信息失效')
+ // storage.removeItem('token')
+ // await store.dispatch('logout')
+ store.commit('updateLogin', false)
+ await message.showToast('登录信息失效')
// #ifdef PUB_CUSTOMER
@@ -219,6 +223,7 @@
if (!options.ignore) {
message.hideLoading()
}
+ message.showToast('网络异常')
reject({
data: null,
code: 9999,
--
Gitblit v1.9.3