From 0cf1b417c68013df89504088c471fd113676391a Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期四, 14 八月 2025 17:11:03 +0800
Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/flexJobMiniApp

---
 apps/cMiniApp/src/custom-tab-bar/index.tsx |   53 +++++++++++++++++++++++------------------------------
 1 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/apps/cMiniApp/src/custom-tab-bar/index.tsx b/apps/cMiniApp/src/custom-tab-bar/index.tsx
index fd1eeda..fec3385 100644
--- a/apps/cMiniApp/src/custom-tab-bar/index.tsx
+++ b/apps/cMiniApp/src/custom-tab-bar/index.tsx
@@ -15,6 +15,7 @@
   icon: string;
   activeIcon: string;
   pagePath: string;
+  currentPath: string;
   active: boolean;
   className: string;
   onClick?: (url: string, index: number) => any;
@@ -28,14 +29,15 @@
 
 const TarBarItem = function (props: TarBarItemProps, context: SetupContext<TarBarItemEvents>) {
   const _badge = props.badge > 99 ? '99+' : props.badge;
+  const isActive = props.currentPath.toLowerCase().includes(props.pagePath.toLowerCase());
   return (
     <div
-      class={['bottom-tab-item', { active: props.active }, props.className]}
+      class={['bottom-tab-item', { active: isActive }, props.className]}
       onClick={() => context.emit('click', props.pagePath, props.index)}
     >
       <div class="bottom-tab-item-icon-wrapper">
         {props.badge > 0 && <div class="bottom-tab-item-badge">{_badge}</div>}
-        <img class="bottom-tab-item-icon" src={props.active ? props.activeIcon : props.icon} />
+        <img class="bottom-tab-item-icon" src={isActive ? props.activeIcon : props.icon} />
       </div>
       <div class="bottom-tab-item-text">{props.text}</div>
     </div>
@@ -82,8 +84,9 @@
         }
         return;
       }
-      system.setTabIndex(index);
-      Taro.switchTab({ url });
+      Taro.switchTab({ url }).then(() => {
+        system.setTabIndex(index);
+      });
     };
 
     function goPublish() {
@@ -109,6 +112,7 @@
     }
 
     return () => {
+      const _router = Taro.useRouter();
       return (
         <View
           class="bottom-tab"
@@ -117,49 +121,38 @@
           }}
         >
           <TarBarItem
-            text={'homeTitle'}
+            text={'鎵惧伐浣�'}
             icon="../assets/tabbar/icon-home.png"
             activeIcon="../assets/tabbar/icon-home-active.png"
             pagePath={TabBarPageRouter.Home}
+            currentPath={_router.path}
             index={0}
             active={system.activeTab === 0}
             className="home"
             onClick={switchTab}
           ></TarBarItem>
-          {/* <TarBarItem
-            text="琛屼笟鍦�"
-            icon="../assets/tabbar/icon-friend.png"
-            activeIcon="../assets/tabbar/icon-friend-active.png"
-            pagePath={TabBarPageRouter.CircleFriend}
-            index={1}
-            active={system.activeTab === 1}
-            className="circleFriend"
-            onClick={switchTab}
-          ></TarBarItem>
-          <div class="bottom-tab-item publish-wrapper" onClick={goPublish}>
-            <img class="bottom-tab-item-img-publish" src={IconPublish} />
-            <div class="bottom-tab-item-text">鍙戝竷</div>
-          </div>
+
           <TarBarItem
-            text="娑堟伅"
-            icon="../assets/tabbar/icon-message.png"
-            activeIcon="../assets/tabbar/icon-message-active.png"
-            pagePath={TabBarPageRouter.Message}
-            active={system.activeTab === 2}
-            className="message"
+            text="浠诲姟"
+            icon="../assets/tabbar/icon-task.png"
+            activeIcon="../assets/tabbar/icon-task-active.png"
+            pagePath={TabBarPageRouter.Task}
+            currentPath={_router.path}
+            active={system.activeTab === 1}
+            className="task"
             onClick={switchTab}
-            index={2}
-            badge={(isLogin.value && myMessageCount.value?.unReadCount) ?? 0}
-          ></TarBarItem> */}
+            index={1}
+          ></TarBarItem>
           <TarBarItem
             text="鎴戠殑"
             icon="../assets/tabbar/icon-mine.png"
             activeIcon="../assets/tabbar/icon-mine-active.png"
             pagePath={TabBarPageRouter.Mine}
-            active={system.activeTab === 3}
+            currentPath={_router.path}
+            active={system.activeTab === 2}
             className="mine"
             onClick={switchTab}
-            index={3}
+            index={2}
           ></TarBarItem>
         </View>
       );

--
Gitblit v1.9.1