From 92a4759e242421f578d463e457fcea33893c6c2a Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期六, 14 九月 2024 18:33:12 +0800 Subject: [PATCH] 完成合并并解决冲突 --- plugins/http.js | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/plugins/http.js b/plugins/http.js index bfc3dd2..1f2b554 100644 --- a/plugins/http.js +++ b/plugins/http.js @@ -1,7 +1,7 @@ import environments from '@/environments' import message from './message' import storage from './storage' -// import store from '../store' +import store from '../store' import utils from './util.js' // import Vue from 'vue' // import { @@ -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() @@ -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