From 45be153eaef9e1c1a3fe21515e9cbd785fba8e1f Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 22 四月 2025 17:38:35 +0800
Subject: [PATCH] 线索任务

---
 custom-tab-bar/index.js |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js
index 4384ee3..a6ff3b7 100644
--- a/custom-tab-bar/index.js
+++ b/custom-tab-bar/index.js
@@ -1,10 +1,24 @@
 import TabMenu from './data';
+const app = getApp();
+
 Component({
   data: {
     active: 0,
     list: TabMenu,
   },
-
+  attached() {
+    const menu = []
+    TabMenu.forEach(v => {
+      if (app.globalData.userInfo.usertypeid <= v.level) {
+        menu.push(v)
+      }
+    });
+    // TabMenu.map(v => {
+    //   v.visible = app.globalData.userInfo.usertypeid <= v.level;
+    //   return v;
+    // });
+    this.setData({ list: menu });
+  },
   methods: {
     onChange(event) {
       let index = event.detail.value;
@@ -29,9 +43,7 @@
       const page = getCurrentPages().pop();
       const route = page ? page.route.split('?')[0] : '';
       const active = this.data.list.findIndex(
-        item =>
-          (item.url.startsWith('/') ? item.url.substr(1) : item.url) ===
-          `${route}`,
+        item => (item.url.startsWith('/') ? item.url.substr(1) : item.url) === `${route}`,
       );
       this.setData({ active });
     },

--
Gitblit v1.9.3