Browse Source

1、修改功能包的应用

zhoux 1 year ago
parent
commit
df771fd580
3 changed files with 34 additions and 44 deletions
  1. 7 8
      pages/home-page/home-page.js
  2. 12 36
      pages/index/index.js
  3. 15 0
      pages/welcome/welcome.js

+ 7 - 8
pages/home-page/home-page.js

@@ -252,7 +252,6 @@ Page({
    * @date : 2024/1/23 9:16
    */
   toAppStd(e) {
-    console.log(e,"toAppStd");
     let flg = e.currentTarget.dataset.flg
     let url = e.currentTarget.dataset.url
     // 如果点击全部应用跳转到应用页面
@@ -307,13 +306,13 @@ Page({
       util.showToast('没有该功能权限');
       return;
     }
-    let companyVip = app.globalData.company.vip
-    if (e.currentTarget.dataset.item.isVip) {
-      if (!companyVip) {
-        util.showToast('此功能为Vip功能!')
-        return;
-      }
-    }
+    // let companyVip = app.globalData.company.vip
+    // if (e.currentTarget.dataset.item.isVip) {
+    //   if (!companyVip) {
+    //     util.showToast('此功能为Vip功能!')
+    //     return;
+    //   }
+    // }
     // 打开页面
     if (item.objectPath || item.url) {
       wx.navigateTo({

+ 12 - 36
pages/index/index.js

@@ -412,45 +412,21 @@ Page({
     }
     let guideUrl = null;
     let menuList = app.globalData.menus
-    let companyVip = app.globalData.company.vip
     
-    if(e.currentTarget.dataset.item.isVip){      
-      if(companyVip){
-        if (menuList && menuList.length > 0) {
-          let filters = menuList.filter(it => it.id == code);
-          if (filters && filters.length > 0) {
-            guideUrl = filters[0].guideUrl
-          }
-        }
-        
-        // 调转页面
-        wx.navigateTo({
-          url: url,
-          success: function (res) {
-            res.eventChannel.emit('params', { formMode: 'index', menuUuid: code, guideUrl: guideUrl,objectCode:e.currentTarget.dataset.item.objectCode})
-          }
-        })
-      }else{
-        util.showToast('此功能为Vip功能!')
-      }
-    }else{
-      if (menuList && menuList.length > 0) {
-        let filters = menuList.filter(it => it.id == code);
-        if (filters && filters.length > 0) {
-          guideUrl = filters[0].guideUrl
-          this.setData({
-            guideUrl:guideUrl
-          })
-        }
+    if (menuList && menuList.length > 0) {
+      let filters = menuList.filter(it => it.id == code);
+      if (filters && filters.length > 0) {
+        guideUrl = filters[0].guideUrl
       }
-      // 调转页面
-      wx.navigateTo({
-        url: url,
-        success: function (res) {
-          res.eventChannel.emit('params', { formMode: 'index', menuUuid: code, guideUrl: guideUrl,objectCode:e.currentTarget.dataset.item.objectCode })
-        }
-      })
     }
+    
+    // 调转页面
+    wx.navigateTo({
+      url: url,
+      success: function (res) {
+        res.eventChannel.emit('params', { formMode: 'index', menuUuid: code, guideUrl: guideUrl,objectCode:e.currentTarget.dataset.item.objectCode})
+      }
+    })
   },
   /**
    * @desc : 删除常用应用

+ 15 - 0
pages/welcome/welcome.js

@@ -345,6 +345,21 @@ Page({
                                 }
                             })
                         }
+                        // 处理功能包
+                        let funPackage = app.globalData.company.funPackage;
+                        // 没有功能包就把vip功能都去掉
+                        if(!funPackage || funPackage.length == 0){
+                            menuList = menuList.filter(it=>!it.isVip);
+                        }else{
+                            // 如果有功能包,就过滤掉功能包之外的vip功能
+                            let funUuids = []
+                            funPackage.forEach(it=>{
+                                if(it.funUuids && it.funUuids.length > 0){
+                                    funUuids = funUuids.union(it.funUuids)
+                                }
+                            })
+                            menuList = menuList.filter(it=>!it.isVip || funUuids.includes(it.funUuid));
+                        }
                         app.globalData.menus = menuList
                     }
                     // 常用菜单