zhaoxiaohai 2 лет назад
Родитель
Сommit
1e78477d25
2 измененных файлов с 9 добавлено и 25 удалено
  1. 9 24
      custom-tab-bar/index.js
  2. 0 1
      custom-tab-bar/index.wxml

+ 9 - 24
custom-tab-bar/index.js

@@ -1,31 +1,16 @@
 const _Http = getApp().globalData.http;
 Component({
-    /**
-     * 组件的属性列表
-     */
-    properties: {},
     lifetimes: {
         ready: function () {
             if (this.data.count == 1) return;
             if (wx.getStorageSync('userauth') != 0) {
                 //判断页面 以免一直触发
-                let pages = getCurrentPages();
-                let prevPage = pages[pages.length - 1];
+                const pages = getCurrentPages(),
+                    prevPage = pages[pages.length - 1];
                 if (prevPage.route == 'pages/login/selectSite' || prevPage.route.includes('pages/tabbar/')) {
-                    let auth = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['通用'], ['个人中心']);
-                    let auth2 = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['营销工具'], ['营销物料']);
-                    let list = ['首页', '信息'];
-                    auth.forEach(v => {
-                        switch (v.systemmodulename) {
-                            case "个人中心":
-                                list.push('我的')
-                                break;
-                        }
-                    })
-                    if (auth2.length == 1) list.push('营销物料');
-                    this.setData({
-                        Permission: list,
-                        auth
+                    const auth = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['营销工具'], ['营销物料']);
+                    if (auth.length == 1) this.setData({
+                        Permission: ['首页', '信息', '营销物料', '我的']
                     })
                 }
             }
@@ -33,8 +18,7 @@ Component({
     },
     data: {
         active: 'home',
-        Permission: ['首页'],
-        auth: [], //个人信息和消息信息的权限
+        Permission: ['首页', '信息', '我的'], //可看模块
         tabbarList: [{
                 icon: 'icon-a-biaoqianlanshouyexuanzhong',
                 acicon: 'icon-a-biaoqianlanshouyexuanzhong',
@@ -66,7 +50,6 @@ Component({
         ],
     },
     methods: {
-        /* tabbar */
         onChange(event) {
             let active = event.detail,
                 obj = this.data.tabbarList.find(v => v.name == active);
@@ -96,7 +79,9 @@ Component({
             _Http.basic({
                 "classname": "system.message.Message",
                 "method": "unReadMessageCount",
-                "content": {nochace: true}
+                "content": {
+                    nochace: true
+                }
             }, false).then(res => {
                 if (res.msg != '成功' || res.data.fcount == 0) return;
                 getApp().globalData.socket.that.setData({

+ 0 - 1
custom-tab-bar/index.wxml

@@ -5,5 +5,4 @@
         {{item.text}}
     </van-tabbar-item>
 </van-tabbar>
-
 <wxs src='../utils/wxmlQueryPer.wxs' module="per" />