|
|
@@ -17,12 +17,29 @@ function service(options = {}) {
|
|
|
if (res.data.code !== 200) {
|
|
|
// 非成功状态码弹窗
|
|
|
console.log('错误信息:+++',res.data.msg)
|
|
|
- uni.showToast({
|
|
|
- icon: 'none',
|
|
|
- duration: 3000,
|
|
|
- title: '错误信息:'+`${res.data.msg}`
|
|
|
- });
|
|
|
+
|
|
|
// 这里可以做一些状态码判断以及操作
|
|
|
+ if(res.data.code === 401){
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ duration: 3000,
|
|
|
+ title: '登录过期,即将跳转登录页'
|
|
|
+ });
|
|
|
+
|
|
|
+ setTimeout(()=>{
|
|
|
+ uni.navigateTo({
|
|
|
+ url:'/pages/login/login'
|
|
|
+ })
|
|
|
+ },3000)
|
|
|
+
|
|
|
+ }else{
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ duration: 3000,
|
|
|
+ title:'系统繁忙,请重试!'
|
|
|
+ // title: '错误信息:'+`${res.data.msg}`
|
|
|
+ });
|
|
|
+ }
|
|
|
// 返回错误信息
|
|
|
rejected(res)
|
|
|
} else {
|
|
|
@@ -36,7 +53,7 @@ function service(options = {}) {
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|
|
|
duration: 3000,
|
|
|
- title: err.errMsg
|
|
|
+ title: '服务器连接失败,请检查网络'
|
|
|
});
|
|
|
rejected(err);
|
|
|
};
|