xiaohaizhao 3 лет назад
Родитель
Сommit
70906d36fe
1 измененных файлов с 7 добавлено и 12 удалено
  1. 7 12
      utils/Http.js

+ 7 - 12
utils/Http.js

@@ -29,17 +29,11 @@ class HTTP {
             method: method,
             header: header,
             timeout: 60000,
-            success: (res) => {
-                resolve(res.data);
-                // if (loading) wx.hideLoading();
-            },
-            fial: (err) => {
-                reject(err);
-                // if (loading) wx.hideLoading()
-            },
+            success: res => resolve(res.data),
+            fial: err => reject(err),
             complete: (res) => {
+                // if (loading) wx.hideLoading()
                 if (res.errMsg != 'request:ok') {
-                    wx.hideLoading()
                     wx.showToast({
                         title: '网络异常,请重新进入',
                         icon: "none"
@@ -48,13 +42,14 @@ class HTTP {
                     clearTimeout(count);
                     wx.showToast({
                         title: '登陆状态已过期,请重新登陆!',
-                        icon: "none"
+                        icon: "none",
+                        mask: true
                     })
                     count = setTimeout(() => {
-                        wx.redirectTo({
+                        wx.reLaunch({
                             url: '/pages/login/phone',
                         });
-                    }, 500)
+                    }, 1000)
                 }
             }
         })