zhoux 2 лет назад
Родитель
Сommit
8c0bbaa670

+ 3 - 1
api/pages/mst/comMenu.js

@@ -13,7 +13,9 @@ module.exports = {
     // 前缀
     prefix: 'mdm-server/mst/comMenu/',
     // 保存常用功能
-    save:'save'
+    save:'save',
+    // 查询常用菜单以及功能频率高的菜单
+    selectMenu:'select_menu'
   },
 
   routeUrl: {

+ 40 - 1
pages/home-page/home-page.js

@@ -23,6 +23,7 @@ Page({
   data: {
     // 分页flg
     pageFlag: false,
+    comMenuList:[],// 常用功能
     companyName: '沈阳东科软件有限公司',
     transactionAmount: '¥11,850.00',
     collectionAmount: '¥10,850.00',
@@ -200,6 +201,37 @@ Page({
     ],
   },
   /**
+  * @desc : 查询常用功能以及频率高的功能
+  * @author : 周兴
+  * @date : 2024/3/30
+  */
+ getComMenu() {
+  let staffId = app.globalData.user.staffId;
+  if(!staffId){
+    return;
+  }
+  let params = {
+    staffId: app.globalData.user.staffId,
+    appCode: Constants.APP_CODE,
+  }
+  let service = app.globalData['comMenuService']
+  api.request(service.prefix + service.selectMenu, 'POST', params).then(res => {
+    if (res.data.code == Constants.SUCESS_CODE) {
+      let comMenuList = res.data.data
+      // 增加全部列表
+      let allMenu = {
+        menuUuid:'-1',
+        menuName:'全部应用',
+        objectIcon:'customer.png'
+      }
+      comMenuList.push(allMenu);
+      this.setData({
+        comMenuList: comMenuList,
+      })
+    }
+  });
+},
+  /**
    * @desc : 跳转到功能页面
    * @author : 于继渤
    * @date : 2024/1/23 9:16
@@ -239,6 +271,14 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
+  onShow: function name(params) {
+    console.log('ffff',app.globalData.comMenuList);
+    // 获取常用菜单
+    this.getComMenu();
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
   onLoad: function (options) {
 
     let _this = this;
@@ -278,7 +318,6 @@ Page({
     // 1 客户跟进通知-进入客户跟进详情  2 客户任务通知  3 客户流失提醒  4 审批任务通知  5 工具栏跳转客户跟进
     // 6 工具栏跳转订单开单  7 工具栏跳客户详细 8 客户跟进通知-进入接待详情 9 销售退货通知跳转 10上样检查跳转
 
-
   },
 
 })

+ 4 - 4
pages/home-page/home-page.wxml

@@ -29,10 +29,10 @@
   <!-- 应用 -->
   <view>
     <view style="background: #fff;border-radius: 15rpx;">
-      <view style="display: flex;flex-wrap: wrap;padding: 43rpx 0;align-items: center;">
-        <view class="app-item" style="width:20%;text-align: center;" icon-class="index-grid-item-icon-class" text-class="index-grid-item-text-class" content-class="index-grid-item-class" wx:for="{{functionItems}}" wx:for-item="item2" data-code="{{item2.FunctionCode}}" data-url="{{item2.FormName}}" bindtap="toApp" wx:key="i" info="{{m1.getInfoNum(infocodes,infos,item2.FunctionCode)}}">
-          <image src="{{item2.ImageUri}}" style="height: 80rpx;width:80rpx;margin-bottom: 11rpx;"></image>
-          <view class="index-grid-item-text-class">{{item2.FunctionName}}</view>
+      <view style="display: flex;flex-wrap: wrap;padding: 20rpx 0;align-items: center;">
+        <view class="app-item" style="width:20%;text-align: center;margin-top: 25rpx;"  wx:for="{{comMenuList}}" wx:for-item="item" data-code="{{item.menuUuid}}" data-url="{{item.objectPath}}" bindtap="toApp" wx:key="i" >
+          <image src="{{item.objectIcon?('/static/img/' + item.objectIcon ):''}}" style="height: 80rpx;width:80rpx;margin-bottom: 11rpx;"></image>
+          <view class="index-grid-item-text-class">{{item.menuName}}</view>
         </view>
       </view>
     </view>

+ 26 - 14
pages/welcome/welcome.js

@@ -145,16 +145,6 @@ Page({
                 } else {
                     // // 接口登录后获取数据
                     _this.getInfoAfterLogin();
-                    // 调转主页--注意有场景值的情况 
-                    if (this.data.scene) {
-                        wx.reLaunch({
-                            url: '../../pages/home-page/home-page?scene=' + this.data.scene,
-                        })
-                    } else {
-                        wx.reLaunch({
-                            url: '../../pages/home-page/home-page',
-                        })
-                    }
                 }
             }
             else if (res.data.code === 1015) {
@@ -179,25 +169,47 @@ Page({
                 'userId': app.globalData.user.userId
             }).then(res => {
                 if (res.data.code === Constants.SUCESS_CODE) {
-                    console.log('red',res);
+                    console.log('red', res);
                     // 员工
                     let staff = res.data.data.staff
-                    if(staff){
+                    if (staff && staff.staffId) {
                         app.globalData.user.staffId = staff.staffId
                         app.globalData.user.staffCode = staff.staffCode
                         app.globalData.user.staffName = staff.staffName
                         app.globalData.user.roleIds = staff.roleIds
                         app.globalData.user.orgId = staff.orgId
                         app.globalData.user.orgName = staff.orgName
+
+                        // 调转主页--注意有场景值的情况 
+                        if (this.data.scene) {
+                            wx.reLaunch({
+                                url: '../../pages/home-page/home-page?scene=' + this.data.scene,
+                            })
+                        } else {
+                            wx.reLaunch({
+                                url: '../../pages/home-page/home-page',
+                            })
+                        }
                     }
                     // 菜单
                     let menuList = res.data.data.menuList
-                    if(menuList){
+                    if (menuList) {
                         app.globalData.menus = menuList
                     }
+                    // 常用菜单
+                    let comMenuList = res.data.data.comMenuList
+                    if (comMenuList) {
+                        app.globalData.comMenuList = comMenuList
+                    }
+                    // 系统参数
+                    let setting = res.data.data.settingValue
+                    if(setting){
+                        app.globalData.setting = JSON.parse(setting.setting.value)
+                        // console.log('setting', app.globalData.setting[Constants.settingCode.IVT001]);
+                    }
                 }
             })
-            console.log('app.globalData',app.globalData);
+        console.log('app.globalData', app.globalData);
     },
 
     /**

+ 10 - 0
utils/Constants.js

@@ -292,6 +292,16 @@ module.exports = {
   },
 
   /**
+   * @desc   : 系统参数
+   * @author : 周兴
+   * @date   : 2024/4/1 10:18
+   */
+  settingCode:{
+    // 自动办理标识
+    IVT001:'IVT_001'
+  },
+
+  /**
    * @desc   : 上传文件大小
    * @author : 周兴
    * @date   : 2024/3/27 10:07