| | |
| | | // 引用token |
| | | const TOKEN = uni.getStorageSync(ACCESSTOKEN); |
| | | if (TOKEN) { |
| | | x.header[ACCESSTOKEN] = TOKEN; |
| | | } else { |
| | | delete x.header[ACCESSTOKEN] |
| | | x.header[ACCESSTOKEN] = 'Bearer ' + TOKEN; |
| | | } |
| | | x.header['CLIENT-TYPE'] = appType() |
| | | return x; |
| | |
| | | let res = x.data |
| | | if (res.code == 10000) { |
| | | return res.data; |
| | | } else if (res.code == 20002) { |
| | | } else if (res.code == 401) { |
| | | const cid = uni.getStorageSync('CID') |
| | | uni.removeStorageSync(ACCESSTOKEN) |
| | | vm.$u.toast("授权过期,请重新登录"); |
| | | setTimeout(() => { |
| | | uni.reLaunch({ |
| | | url: "/pages/pay/scanpay?cid=" + cid |
| | | url: "/pay/login?cid=" + cid |
| | | }) |
| | | }, 800); |
| | | return Promise.reject(res) |
| | | } else if (res.code == 10002) { |
| | | return Promise.reject(res) |
| | | } else { |
| | | vm.$u.toast(res.description || "请求异常!"); //错误提示信息 |
| | | vm.$u.toast(res.description || res.msg ||res.info ||"请求异常!"); //错误提示信息 |
| | | return Promise.reject(res) |
| | | } |
| | | }, (response) => { |