From 083daa657d64141d545e0c8c12e5160a369d06d3 Mon Sep 17 00:00:00 2001 From: sfmind Date: Sun, 1 May 2022 22:38:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95token?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-app/util/request/responseInterceptors.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yudao-ui-app/util/request/responseInterceptors.js b/yudao-ui-app/util/request/responseInterceptors.js index 66c81123c..dabac9928 100644 --- a/yudao-ui-app/util/request/responseInterceptors.js +++ b/yudao-ui-app/util/request/responseInterceptors.js @@ -9,9 +9,12 @@ module.exports = vm => { //可以根据业务情况做相应的处理 if (res.data.code === 0) { return res.data + } else if(res.data.code === 401) { + //用户未登录或登录token已过期 + vm.$store.commit('clearLoginInfo') } else { console.log(res) - //错误信息统一处理 + //其他错误信息统一处理 uni.$u.toast(res.data.msg) return Promise.reject(res) }