Browse Source

登录权限查询

zhaoxiaohai 3 năm trước cách đây
mục cha
commit
0271b3bfcc
2 tập tin đã thay đổi với 23 bổ sung4 xóa
  1. 20 1
      pages/login/modules/login.js
  2. 3 3
      pages/login/selectSite.js

+ 20 - 1
pages/login/modules/login.js

@@ -1,3 +1,5 @@
+const _Http = getApp().globalData.http;
+
 function loginMsg(res) {
     wx.setStorageSync('account_list', res.account_list)
     if (res.account_list.length == 1) {
@@ -5,12 +7,29 @@ function loginMsg(res) {
         wx.switchTab({
             url: '/pages/tabbar/home/index'
         })
+        query_userauth();
     } else {
         wx.redirectTo({
             url: './selectSite',
         })
     }
 }
+/* 获取用户权限 */
+function query_userauth(i = 0) {
+    if (i == 5) return wx.showToast({
+        title: '权限查询失败,请稍后再试',
+        icon: "none"
+    })
+    _Http.basic({
+        "classname": "sysmanage.develop.userauth.userauth",
+        "method": "query_userauth",
+        content: {}
+    }).then(res => {
+        if (res.msg != '成功') return query_userauth(i + 1);
+        wx.setStorageSync('userauth', res.data);
+    })
+}
 module.exports = {
-    loginMsg
+    loginMsg,
+    query_userauth
 }

+ 3 - 3
pages/login/selectSite.js

@@ -1,4 +1,4 @@
-// pages/login/selectSite.js
+const login = require('./modules/login');
 Page({
 
     /**
@@ -23,10 +23,10 @@ Page({
         const {
             item
         } = e.currentTarget.dataset;
-        wx.setStorageSync('userMsg', item)
+        wx.setStorageSync('userMsg', item);
+        login.query_userauth();
         let pages = getCurrentPages();
         let prevPage = pages[pages.length - 2];
-        console.log(prevPage)
         if (prevPage && prevPage.__route__ == 'pages/tabbar/home/index') prevPage.refreshData(item);
         wx.switchTab({
             url: '/pages/tabbar/home/index'