浏览代码

通告权限

zhaoxiaohai 2 年之前
父节点
当前提交
d8460be7ee
共有 2 个文件被更改,包括 10 次插入12 次删除
  1. 4 4
      pages/annunciate/details.js
  2. 6 8
      pages/annunciate/index.js

+ 4 - 4
pages/annunciate/details.js

@@ -15,17 +15,17 @@ Page({
         loading: false,
         isEvaluate: false
     },
-    onLoad(options) {
-        let auth = options.auth.split(","),
+    async onLoad(options) {
+        let auth = [],
             dataAuth = '';
+        (options.auth) ? auth = options.auth.split(","): await 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('团队内部数据分析') ? '内部' : '经销商'
         };
-        let viewData = options.auth.includes('团队内部数据分析') || options.auth.includes('经销商数据分析');
         this.setData({
-            viewData,
+            viewData: auth.includes('团队内部数据分析') || auth.includes('经销商数据分析'),
             dataAuth,
             auth,
             sat_noticeid: options.id

+ 6 - 8
pages/annunciate/index.js

@@ -25,14 +25,12 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
-        if (options.auth) {
-            let authList = [];
-            JSON.parse(options.auth)[0].meta.auth.forEach(v => authList.push(v.optionname));
-            this.setData({
-                authList
-            })
-        }
-
+        const auth = options.auth ? JSON.parse(options.auth) : getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['营销工具'], ['通告'])[0].apps;
+        let authList = [];
+        auth[0].meta.auth.forEach(v => authList.push(v.optionname));
+        this.setData({
+            authList
+        })
         this.getList();
     },