zhaoxiaohai 2 years ago
parent
commit
a9e5c7ef19
1 changed files with 20 additions and 13 deletions
  1. 20 13
      pages/tabbar/mine/index.js

+ 20 - 13
pages/tabbar/mine/index.js

@@ -1,4 +1,5 @@
 const _Http = getApp().globalData.http;
+let downCount = null;
 Page({
 
     /**
@@ -17,7 +18,7 @@ Page({
     onLoad(options) {
         this.queryUserMsg();
         let authlist = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['通用'], ['个人中心']);
-        if (authlist.length) {
+        if (authlist) {
             let pathList = this.data.pathList;
             authlist[0].apps.forEach(v => {
                 switch (v.name) {
@@ -60,19 +61,25 @@ Page({
     },
     /* 退出登录 */
     outLogin() {
-        _Http.logout().then(res => {
-            wx.showToast({
-                title: '退出成功'
-            });
-            let loginMsg = wx.getStorageSync("loginMsg");
-            wx.clearStorageSync();
-            wx.setStorageSync('loginMsg', loginMsg)
-            setTimeout(() => {
-                wx.reLaunch({
-                    url: '/pages/login/phone',
-                })
-            }, 300)
+        clearTimeout(downCount);
+        wx.showLoading({
+          title: '正在退出...',
         })
+        downCount = setTimeout(() => {
+            _Http.logout().then(res => {
+                wx.showToast({
+                    title: '退出成功'
+                });
+                let loginMsg = wx.getStorageSync("loginMsg");
+                wx.clearStorageSync();
+                wx.setStorageSync('loginMsg', loginMsg)
+                setTimeout(() => {
+                    wx.reLaunch({
+                        url: '/pages/login/phone',
+                    })
+                }, 300)
+            })
+        }, 300);
     },
     /* 去修改用户信息 */
     changeUserMsg() {