From a88eab39f6b2f5c33913d51fac4e885c052ed4a1 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 21 八月 2025 14:39:00 +0800
Subject: [PATCH] 整体样式修改

---
 src/layout/components/Navbar.vue |  292 +++++++++++++++++++++++++++++++--------------------------
 1 files changed, 158 insertions(+), 134 deletions(-)

diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index cab43c5..412dfce 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -2,34 +2,17 @@
   <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 v-if="sidebar.hide">-->
+<!--      <top-nav id="topmenu-container" class="topmenu-container" />-->
+<!--    </div>-->
+<!--    <div class="logo" v-if="!sidebar.hide">-->
+<!--      <img src="@/assets/logo/logo.png" alt=""/>-->
+<!--    </div>-->
     <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" />
-          </div>
-        </el-tooltip>
-
-        <el-tooltip content="甯冨眬澶у皬" effect="dark" placement="bottom">
-          <size-select id="size-select" class="right-menu-item hover-effect" />
-        </el-tooltip>
       </template>
-
       <el-dropdown @command="handleCommand" class="avatar-container right-menu-item hover-effect" trigger="hover">
         <div class="avatar-wrapper">
           <img :src="userStore.avatar" class="user-avatar" />
@@ -40,20 +23,24 @@
             <router-link to="/user/profile">
               <el-dropdown-item>涓汉涓績</el-dropdown-item>
             </router-link>
+            <el-dropdown-item command="setLayout" v-if="settingsStore.showSettings">
+              <span>甯冨眬璁剧疆</span>
+            </el-dropdown-item>
             <el-dropdown-item divided command="logout">
               <span>閫�鍑虹櫥褰�</span>
             </el-dropdown-item>
           </el-dropdown-menu>
         </template>
       </el-dropdown>
-      <div class="right-menu-item hover-effect setting" @click="setLayout" v-if="settingsStore.showSettings">
-        <svg-icon icon-class="more-up" />
-      </div>
+<!--      <div class="right-menu-item hover-effect setting" @click="setLayout" v-if="settingsStore.showSettings">-->
+<!--        <svg-icon icon-class="more-up" />-->
+<!--      </div>-->
     </div>
   </div>
 </template>
 
 <script setup>
+import {useWindowSize} from '@vueuse/core'
 import { ElMessageBox } from 'element-plus'
 import Breadcrumb from '@/components/Breadcrumb'
 import TopNav from '@/components/TopNav'
@@ -66,11 +53,47 @@
 import useAppStore from '@/store/modules/app'
 import useUserStore from '@/store/modules/user'
 import useSettingsStore from '@/store/modules/settings'
+const sidebar = computed(() => useAppStore().sidebar)
+const device = computed(() => useAppStore().device)
+import Sidebar from "@/layout/components/Sidebar/index.vue";
 
 const appStore = useAppStore()
 const userStore = useUserStore()
 const settingsStore = useSettingsStore()
+const isShowTop = ref(false)
 
+const { width, height } = useWindowSize()
+const WIDTH = 992 // refer to Bootstrap's responsive design
+
+watch(() => device.value, () => {
+  if (device.value === 'mobile' && sidebar.value.opened) {
+    useAppStore().closeSideBar({ withoutAnimation: false })
+  }
+})
+
+watchEffect(() => {
+  if (width.value - 1 < WIDTH) {
+    useAppStore().toggleDevice('mobile')
+    appStore.toggleSideBarHide(true)
+    useAppStore().closeSideBar({ withoutAnimation: true })
+  } else {
+    useAppStore().toggleDevice('desktop')
+    appStore.toggleSideBarHide(false)
+  }
+})
+// 鏍规嵁绐楀彛瀹藉害璁剧疆 isShowTop
+// const handleResize = () => {
+//   settingsStore.topNav = !(window.innerWidth < 992)
+// }
+//
+// onMounted(() => {
+//   handleResize() // 鍒濆鍒ゆ柇涓�娆�
+//   window.addEventListener('resize', handleResize)
+// })
+//
+// onUnmounted(() => {
+//   window.removeEventListener('resize', handleResize)
+// })
 function toggleSideBar() {
   appStore.toggleSideBar()
 }
@@ -112,113 +135,114 @@
 
 <style lang='scss' scoped>
 .navbar {
-  height: 50px;
-  overflow: hidden;
-  position: relative;
-  background: var(--navbar-bg);
-  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
-
-  .hamburger-container {
-    line-height: 46px;
-    height: 100%;
-    float: left;
-    cursor: pointer;
-    transition: background 0.3s;
-    -webkit-tap-highlight-color: transparent;
-
-    &:hover {
-      background: rgba(0, 0, 0, 0.025);
-    }
-  }
-
-  .breadcrumb-container {
-    float: left;
-  }
-
-  .topmenu-container {
-    position: absolute;
-    left: 50px;
-  }
-
-  .errLog-container {
-    display: inline-block;
-    vertical-align: top;
-  }
-
-  .right-menu {
-    float: right;
-    height: 100%;
-    line-height: 50px;
-    display: flex;
-
-    &:focus {
-      outline: none;
-    }
-
-    .right-menu-item {
-      display: inline-block;
-      padding: 0 8px;
-      height: 100%;
-      font-size: 18px;
-      color: #5a5e66;
-      vertical-align: text-bottom;
-
-      &.hover-effect {
-        cursor: pointer;
-        transition: background 0.3s;
-
-        &:hover {
-          background: rgba(0, 0, 0, 0.025);
-        }
-      }
-
-      &.theme-switch-wrapper {
-        display: flex;
-        align-items: center;
-
-        svg {
-          transition: transform 0.3s;
-          
-          &:hover {
-            transform: scale(1.15);
-          }
-        }
-      }
-    }
-
-    .avatar-container {
-      margin-right: 0px;
-      padding-right: 0px;
-
-      .avatar-wrapper {
-        margin-top: 10px;
-        right: 5px;
-        position: relative;
-
-        .user-avatar {
-          cursor: pointer;
-          width: 30px;
-          height: 30px;
-          border-radius: 50%;
-        }
-
-        .user-nickname{
-          position: relative;
-          left: 5px;
-          bottom: 10px;
-          font-size: 14px;
-          font-weight: bold;
-        }
-
-        i {
-          cursor: pointer;
-          position: absolute;
-          right: -20px;
-          top: 25px;
-          font-size: 12px;
-        }
-      }
-    }
-  }
+	height: 50px;
+	overflow: hidden;
+	position: relative;
+	background: var(--navbar-bg);
+	box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
+	
+	.hamburger-container {
+		line-height: 46px;
+		height: 100%;
+		float: left;
+		cursor: pointer;
+		transition: background 0.3s;
+		-webkit-tap-highlight-color: transparent;
+		
+		&:hover {
+			background: rgba(0, 0, 0, 0.025);
+		}
+	}
+	
+	.breadcrumb-container {
+		float: left;
+	}
+	
+	.topmenu-container {
+		position: absolute;
+		left: 50px;
+	}
+	
+	.errLog-container {
+		display: inline-block;
+		vertical-align: top;
+	}
+	
+	.right-menu {
+		float: right;
+		height: 100%;
+		line-height: 50px;
+		display: flex;
+		margin-right: 30px;
+		
+		&:focus {
+			outline: none;
+		}
+		
+		.right-menu-item {
+			display: inline-block;
+			padding: 0 8px;
+			height: 100%;
+			font-size: 18px;
+			color: #5a5e66;
+			vertical-align: text-bottom;
+			
+			&.hover-effect {
+				cursor: pointer;
+				transition: background 0.3s;
+				
+				&:hover {
+					background: rgba(0, 0, 0, 0.025);
+				}
+			}
+			
+			&.theme-switch-wrapper {
+				display: flex;
+				align-items: center;
+				
+				svg {
+					transition: transform 0.3s;
+					
+					&:hover {
+						transform: scale(1.15);
+					}
+				}
+			}
+		}
+		
+		.avatar-container {
+			margin-right: 0px;
+			padding-right: 0px;
+			
+			.avatar-wrapper {
+				margin-top: 10px;
+				right: 5px;
+				position: relative;
+				
+				.user-avatar {
+					cursor: pointer;
+					width: 30px;
+					height: 30px;
+					border-radius: 50%;
+				}
+				
+				.user-nickname{
+					position: relative;
+					left: 5px;
+					bottom: 10px;
+					font-size: 14px;
+					font-weight: bold;
+				}
+				
+				i {
+					cursor: pointer;
+					position: absolute;
+					right: -20px;
+					top: 25px;
+					font-size: 12px;
+				}
+			}
+		}
+	}
 }
 </style>

--
Gitblit v1.9.3