Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -32,30 +32,30 @@ instance.interceptors.request.use(config => {
|
||||
|
||||
instance.interceptors.response.use(res => {
|
||||
if (res.data) {
|
||||
if (res.data.code) {
|
||||
if (res.data.code == 0) {
|
||||
return res.data
|
||||
} else if (res.data.code === 1) {
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
duration: 2000,
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
return res.data
|
||||
} else if (res.data.code == 401) {
|
||||
store.commit("logout");
|
||||
uni.navigateTo({url: "/pages/login"})
|
||||
} else {
|
||||
console.error(res.data.msg || "请求失败!")
|
||||
return Promise.reject(res.data.msg)
|
||||
}
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
if (res.data.access_token) {
|
||||
return res.data
|
||||
}
|
||||
if (res.data.code == 0) {
|
||||
return res.data
|
||||
} else if (res.data.code === 1) {
|
||||
uni.showToast({
|
||||
title: res.data.msg,
|
||||
duration: 2000,
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
return res.data
|
||||
} else if (res.data.code == 401) {
|
||||
store.commit("logout");
|
||||
uni.navigateTo({url: "/pages/login"})
|
||||
} else {
|
||||
console.error(res.data.msg || "请求失败!")
|
||||
return Promise.reject(res.data.msg)
|
||||
}
|
||||
} else {
|
||||
console.error("服务器异常,请联系管理员!")
|
||||
return Promise.reject(res.data)
|
||||
return res.data
|
||||
}
|
||||
}, err => {
|
||||
uni.hideLoading()
|
||||
|
||||
Reference in New Issue
Block a user