Просмотр исходного кода

首页常用应用添加Vip标识

liuyao 1 год назад
Родитель
Сommit
465bfefe63
3 измененных файлов с 33 добавлено и 0 удалено
  1. 16 0
      pages/home-page/home-page.js
  2. 3 0
      pages/home-page/home-page.wxml
  3. 14 0
      pages/home-page/home-page.wxss

+ 16 - 0
pages/home-page/home-page.js

@@ -269,7 +269,16 @@ Page({
     let service = app.globalData['comMenuService']
     api.request(service.prefix + service.selectMenu, 'POST', params).then(res => {
       if (res.data.code == Constants.SUCESS_CODE) {
+        /**
+         * 过滤Vip标识
+         */
         let comMenuList = res.data.data
+        const menus = app.globalData.menus
+        console.log('menus', menus);
+        comMenuList.forEach(res => {
+          const comMenus = menus.filter(menu => menu.menuUuid === res.menuUuid)
+          res.isVip = comMenus[comMenus.length - 1].isVip
+        })
         // 如果标准版把销售出库 修改为订单开单
         // if (app.globalData.company.gradeCode == Constants.gradeCode.STD) {
         //   let filters = comMenuList.filter(it => it.objectCode == 'order-out');
@@ -329,6 +338,13 @@ Page({
       util.showToast('没有该功能权限');
       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({

+ 3 - 0
pages/home-page/home-page.wxml

@@ -54,6 +54,9 @@
   <view class="com-menu-class">
     <view style="display: flex;flex-wrap: wrap;padding: 10rpx 0 20rpx 0;">
       <view class="app-item" style="width:20%;text-align: center;margin-top: 15rpx;margin-bottom: 15rpx;" wx:for="{{comMenuList}}" wx:for-item="item" data-code="{{item.menuUuid}}" data-url="{{item.objectPath}}" data-item="{{item}}" bindtap="toApp" wx:key="i">
+        <view wx:if="{{item.isVip}}" class="vip-icon-view">
+          <image src="{{imageUrl + 'diamond.png'}} " class="icon-title_vip" />
+        </view>
         <image src="{{item.objectIcon?(imageUrl + item.objectIcon ):''}}" style="height: 80rpx;width:80rpx;"></image>
         <view class="index-grid-item-text-class">{{item.menuName}}</view>
       </view>

+ 14 - 0
pages/home-page/home-page.wxss

@@ -371,4 +371,18 @@ image {
   display: flex;
   justify-content: center;
   align-items: center;
+}
+
+.vip-icon-view{
+  width: 100%;
+  position: relative;
+  z-index: 1000;
+}
+
+.icon-title_vip {
+  width: 40rpx;
+  height: 40rpx;
+  position: absolute;
+  left: 15rpx;
+  top: 1rpx;
 }