Explorar o código

商学院权限

zhaoxiaohai %!s(int64=2) %!d(string=hai) anos
pai
achega
45251a6e89
Modificáronse 2 ficheiros con 18 adicións e 121 borrados
  1. 11 63
      pages/college/detail.js
  2. 7 58
      pages/college/index.js

+ 11 - 63
pages/college/detail.js

@@ -1,9 +1,6 @@
-const _Http = getApp().globalData.http;
-const MFT = require("../../utils/matchingFeilType");
+const _Http = getApp().globalData.http,
+    MFT = require("../../utils/matchingFeilType");
 Page({
-    /**
-     * 页面的初始数据
-     */
     data: {
         active: 0,
         detailData: {},
@@ -17,19 +14,20 @@ Page({
             active: detail.index
         })
     },
-    /**
-     * 生命周期函数--监听页面加载
-     */
     onLoad(options) {
-        let dataAuth = '';
-        if (options.auth.includes('团队内部数据分析') && options.auth.includes('经销商数据分析')) {
+        let auth = [],
+            dataAuth = '';
+            
+        options.auth ? auth = options.auth : getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['营销工具'], ['商学院'])[0].apps[0].meta.auth.forEach(v => auth.push(v.optionname));
+
+        if (auth.includes('团队内部数据分析') && auth.includes('经销商数据分析')) {
             dataAuth = 'all';
         } else {
-            dataAuth = options.auth.includes('团队内部数据分析') ? '内部' : '经销商'
+            dataAuth = auth.includes('团队内部数据分析') ? '内部' : '经销商'
         }
         this.setData({
-            viewData: options.auth.includes('团队内部数据分析') || options.auth.includes('经销商数据分析'),
-            dataAuth
+            dataAuth,
+            viewData: auth.includes('团队内部数据分析') || auth.includes('经销商数据分析')
         });
 
         _Http.basic({
@@ -51,7 +49,6 @@ Page({
             })
         });
     },
-
     callBack({
         detail
     }) {
@@ -59,53 +56,4 @@ Page({
             currentVideo: detail
         })
     },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
-    }
 })

+ 7 - 58
pages/college/index.js

@@ -1,5 +1,5 @@
-const getHeight = require("../../utils/getRheRemainingHeight");
-const _Http = getApp().globalData.http;
+const getHeight = require("../../utils/getRheRemainingHeight"),
+    _Http = getApp().globalData.http;
 let dowmCount = null;
 Page({
 
@@ -31,12 +31,10 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
-        if (options.auth) {
-            let auth = JSON.parse(options.auth)[0].meta.auth;
-            this.setData({
-                optionList: auth.map(v => v.optionname)
-            })
-        }
+        let auth = options.auth ? JSON.parse(options.auth) : getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['营销工具'], ['商学院'])[0].apps;
+        this.setData({
+            optionList: auth[0].meta.auth.map(v => v.optionname)
+        })
         this.selectMenu(0);
         this.selectList();
     },
@@ -95,7 +93,6 @@ Page({
             })
         })
     },
-
     /* 开始搜索 */
     startSearch({
         detail
@@ -111,7 +108,6 @@ Page({
         }, 1000);
 
     },
-
     /* 关闭搜索 */
     closeSearch() {
         this.setData({
@@ -119,7 +115,6 @@ Page({
         })
         this.selectList(true);
     },
-
     switchChange({
         detail
     }) {
@@ -128,7 +123,6 @@ Page({
         })
         this.selectList(true);
     },
-
     onClickNav({
         detail = {}
     }) {
@@ -136,7 +130,6 @@ Page({
             mainActiveIndex: detail.index || 0,
         });
     },
-
     onClickItem({
         detail = {}
     }) {
@@ -149,9 +142,7 @@ Page({
         this.selectComponent('#item').toggle();
         this.selectList(true);
     },
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
+    /*生命周期函数--监听页面初次渲染完成*/
     onReady() {
         //滚动区域高度
         getHeight.getHeight('.menu', this).then(res => {
@@ -160,46 +151,4 @@ Page({
             })
         })
     },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
-    }
 })