Commit 083daa657d64141d545e0c8c12e5160a369d06d3

Authored by sfmind
1 parent 83bc6fac

用户登录token过期处理

yudao-ui-app/util/request/responseInterceptors.js
... ... @@ -9,9 +9,12 @@ module.exports = vm => {
9 9 //可以根据业务情况做相应的处理
10 10 if (res.data.code === 0) {
11 11 return res.data
  12 + } else if(res.data.code === 401) {
  13 + //用户未登录或登录token已过期
  14 + vm.$store.commit('clearLoginInfo')
12 15 } else {
13 16 console.log(res)
14   - //错误信息统一处理
  17 + //其他错误信息统一处理
15 18 uni.$u.toast(res.data.msg)
16 19 return Promise.reject(res)
17 20 }
... ...