From bd3051488bdbab156c2bc5ca0ad108989978fbb8 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 15 一月 2026 14:34:54 +0800
Subject: [PATCH] Merge branch 'dev_New' of http://114.132.189.42:9002/r/product-inventory-management into dev_New

---
 src/layout/components/Navbar.vue |  139 ++++++++++++++++++++++++++++++++++++----------
 1 files changed, 108 insertions(+), 31 deletions(-)

diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index a7b467a..d4e938d 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -1,34 +1,35 @@
 <template>
   <div class="navbar">
-    <hamburger id="hamburger-container" :is-active="appStore.sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
-    <breadcrumb v-if="!settingsStore.topNav" id="breadcrumb-container" class="breadcrumb-container" />
-    <top-nav v-if="settingsStore.topNav" id="topmenu-container" class="topmenu-container" />
-
+    <div>
+      <hamburger id="hamburger-container" :is-active="appStore.sidebar.opened" class="hamburger-container"
+        @toggleClick="toggleSideBar" />
+      <breadcrumb v-if="!settingsStore.topNav" id="breadcrumb-container" class="breadcrumb-container" />
+    </div>
+    <!--    <top-nav v-if="settingsStore.topNav" id="topmenu-container" class="topmenu-container" />-->
     <div class="right-menu">
-      <template v-if="appStore.device !== 'mobile'">
-        <header-search id="header-search" class="right-menu-item" />
-
-        <el-tooltip content="婧愮爜鍦板潃" effect="dark" placement="bottom">
-          <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
-        </el-tooltip>
-
-        <el-tooltip content="鏂囨。鍦板潃" effect="dark" placement="bottom">
-          <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
-        </el-tooltip>
-
-        <screenfull id="screenfull" class="right-menu-item hover-effect" />
-
-        <el-tooltip content="涓婚妯″紡" effect="dark" placement="bottom">
-          <div class="right-menu-item hover-effect theme-switch-wrapper" @click="toggleTheme">
-            <svg-icon v-if="settingsStore.isDark" icon-class="sunny" />
-            <svg-icon v-if="!settingsStore.isDark" icon-class="moon" />
+      <!-- 娑堟伅閫氱煡 -->
+      <el-popover
+        v-model:visible="notificationVisible"
+        :width="500"
+        placement="bottom-end"
+        trigger="click"
+        :popper-options="{ modifiers: [{ name: 'offset', options: { offset: [0, 10] } }] }"
+        popper-class="notification-popover"
+      >
+        <template #reference>
+          <div class="notification-container right-menu-item hover-effect">
+            <el-badge :value="unreadCount" :hidden="unreadCount === 0" class="notification-badge">
+              <el-icon :size="20" style="cursor: pointer;">
+                <Bell />
+              </el-icon>
+            </el-badge>
           </div>
-        </el-tooltip>
-
-        <el-tooltip content="甯冨眬澶у皬" effect="dark" placement="bottom">
-          <size-select id="size-select" class="right-menu-item hover-effect" />
-        </el-tooltip>
-      </template>
+        </template>
+        <NotificationCenter
+          @unreadCountChange="handleUnreadCountChange"
+          ref="notificationCenterRef"
+        />
+      </el-popover>
       <div class="avatar-container">
         <el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click">
           <div class="avatar-wrapper">
@@ -56,6 +57,7 @@
 
 <script setup>
 import { ElMessageBox } from 'element-plus'
+import { Bell } from '@element-plus/icons-vue'
 import Breadcrumb from '@/components/Breadcrumb'
 import TopNav from '@/components/TopNav'
 import Hamburger from '@/components/Hamburger'
@@ -64,6 +66,7 @@
 import HeaderSearch from '@/components/HeaderSearch'
 import RuoYiGit from '@/components/RuoYi/Git'
 import RuoYiDoc from '@/components/RuoYi/Doc'
+import NotificationCenter from './NotificationCenter/index.vue'
 import useAppStore from '@/store/modules/app'
 import useUserStore from '@/store/modules/user'
 import useSettingsStore from '@/store/modules/settings'
@@ -71,10 +74,16 @@
 const appStore = useAppStore()
 const userStore = useUserStore()
 const settingsStore = useSettingsStore()
-
+const notificationVisible = ref(false)
+const notificationCenterRef = ref(null)
+const unreadCount = ref(0)
 function toggleSideBar() {
   appStore.toggleSideBar()
 }
+// const redirect = ref(undefined)
+// watch(route, (newRoute) => {
+//   redirect.value = newRoute.query && newRoute.query.redirect
+// }, { immediate: true })
 
 function handleCommand(command) {
   switch (command) {
@@ -109,6 +118,43 @@
 function toggleTheme() {
   settingsStore.toggleTheme()
 }
+
+// 娑堟伅閫氱煡鐩稿叧
+function handleUnreadCountChange(count) {
+  unreadCount.value = count
+}
+
+// 缁勪欢鎸傝浇鏃跺姞杞芥湭璇绘暟閲忓拰瀹氭椂鍒锋柊
+let unreadCountTimer = null
+onMounted(() => {
+  // 寤惰繜鍔犺浇锛岀‘淇濈粍浠跺凡娓叉煋
+  nextTick(() => {
+    if (notificationCenterRef.value) {
+      notificationCenterRef.value.loadUnreadCount()
+    }
+  })
+  // 瀹氭椂鍒锋柊鏈鏁伴噺锛堟瘡30绉掞級
+  unreadCountTimer = setInterval(() => {
+    if (notificationCenterRef.value) {
+      notificationCenterRef.value.loadUnreadCount()
+    }
+  }, 30000)
+})
+
+// 鐩戝惉 popover 鏄剧ず鐘舵�侊紝鎵撳紑鏃跺姞杞芥秷鎭垪琛�
+watch(notificationVisible, (val) => {
+  if (val && notificationCenterRef.value) {
+    nextTick(() => {
+      notificationCenterRef.value.loadMessages()
+    })
+  }
+})
+
+onUnmounted(() => {
+  if (unreadCountTimer) {
+    clearInterval(unreadCountTimer)
+  }
+})
 </script>
 
 <style lang='scss' scoped>
@@ -179,10 +225,23 @@
 
         svg {
           transition: transform 0.3s;
-          
+
           &:hover {
             transform: scale(1.15);
           }
+        }
+      }
+    }
+
+    .notification-container {
+      margin-right: 20px;
+      display: flex;
+      align-items: center;
+      cursor: pointer;
+
+      .notification-badge {
+        :deep(.el-badge__content) {
+          border: none;
         }
       }
     }
@@ -198,18 +257,36 @@
           cursor: pointer;
           width: 40px;
           height: 40px;
-          border-radius: 10px;
+          border-radius: 50px;
         }
 
         i {
           cursor: pointer;
           position: absolute;
           right: -20px;
-          top: 25px;
+          top: 14px;
           font-size: 12px;
         }
       }
     }
   }
 }
+
+</style>
+
+<style lang="scss">
+.notification-popover {
+  padding: 0 !important;
+  
+  .el-popover__title {
+    display: none;
+  }
+  
+  .el-popover__body {
+    padding: 0 !important;
+  }
+}
+.el-badge__content.is-fixed{
+  top: 12px;
+}
 </style>

--
Gitblit v1.9.3