From b052158cee91abc78e5994b8fd7334eca9a7d9ee Mon Sep 17 00:00:00 2001 From: zhuoqinglian <1035449612@qq.com> Date: Fri, 26 Jun 2026 17:10:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E7=BB=84=E4=BB=B6=E6=A0=B7=E5=BC=8F=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/manager-web/src/components/HeaderBar.vue | 298 ++---------------- 1 file changed, 28 insertions(+), 270 deletions(-) diff --git a/main/manager-web/src/components/HeaderBar.vue b/main/manager-web/src/components/HeaderBar.vue index 476358db..552beb56 100644 --- a/main/manager-web/src/components/HeaderBar.vue +++ b/main/manager-web/src/components/HeaderBar.vue @@ -101,7 +101,8 @@ $route.path === '/agent-template-management' || $route.path === '/ota-management' || $route.path === '/user-management' || - $route.path === '/feature-management', + $route.path === '/feature-management' || + $route.path === '/replacement-word-management' }" @visible-change="handleParamDropdownVisibleChange"> @@ -154,32 +156,6 @@
-
-
- - - - -
-
- {{ $t("header.searchHistory") }} - - {{ $t("header.clearHistory") }} - -
-
-
- {{ item }} - -
-
-
-
-
- {{ userInfo.username || "加载中..." }} @@ -220,12 +196,6 @@ export default { voiceCloneDropdownVisible: false, userMenuVisible: false, // 添加用户菜单可见状态 menuVisibleTimer: null, // 菜单显示定时器,防止够快触发 - isSmallScreen: false, - // 搜索历史相关 - searchHistory: [], - showHistory: false, - SEARCH_HISTORY_KEY: "xiaozhi_search_history", - MAX_HISTORY_COUNT: 3, // Cascader 配置 cascaderProps: { expandTrigger: "click", @@ -351,17 +321,9 @@ export default { }, }, async mounted() { - this.checkScreenSize(); - window.addEventListener("resize", this.checkScreenSize); - // 从localStorage加载搜索历史 - this.loadSearchHistory(); // 等待featureManager初始化完成后再加载功能状态 await this.loadFeatureStatus(); }, - //移除事件监听器 - beforeDestroy() { - window.removeEventListener("resize", this.checkScreenSize); - }, methods: { handleRouter(type) { this.$router.push(this.routerPaths[type]); @@ -371,104 +333,6 @@ export default { // 等待featureManager初始化完成 await featureManager.waitForInitialization(); }, - checkScreenSize() { - this.isSmallScreen = window.innerWidth <= 1386; - }, - // 处理搜索 - handleSearch() { - const searchValue = this.search.trim(); - - // 如果搜索内容为空,触发重置事件 - if (!searchValue) { - this.$emit("search-reset"); - return; - } - - // 保存搜索历史 - this.saveSearchHistory(searchValue); - - // 触发搜索事件,将搜索关键词传递给父组件 - this.$emit("search", searchValue); - - // 搜索完成后让输入框失去焦点,从而触发blur事件隐藏搜索历史 - if (this.$refs.searchInput) { - this.$refs.searchInput.blur(); - } - }, - - // 显示搜索历史 - showSearchHistory() { - this.showHistory = true; - }, - - // 隐藏搜索历史 - hideSearchHistory() { - // 延迟隐藏,以便点击事件能够执行 - setTimeout(() => { - this.showHistory = false; - }, 200); - }, - - // 加载搜索历史 - loadSearchHistory() { - try { - const history = localStorage.getItem(this.SEARCH_HISTORY_KEY); - if (history) { - this.searchHistory = JSON.parse(history); - } - } catch (error) { - console.error("加载搜索历史失败:", error); - this.searchHistory = []; - } - }, - - // 保存搜索历史 - saveSearchHistory(keyword) { - if (!keyword || this.searchHistory.includes(keyword)) { - return; - } - - // 添加到历史记录开头 - this.searchHistory.unshift(keyword); - - // 限制历史记录数量 - if (this.searchHistory.length > this.MAX_HISTORY_COUNT) { - this.searchHistory = this.searchHistory.slice(0, this.MAX_HISTORY_COUNT); - } - - // 保存到localStorage - try { - localStorage.setItem(this.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistory)); - } catch (error) { - console.error("保存搜索历史失败:", error); - } - }, - - // 选择搜索历史项 - selectSearchHistory(keyword) { - this.search = keyword; - this.handleSearch(); - }, - - // 移除单个搜索历史项 - removeSearchHistory(index) { - this.searchHistory.splice(index, 1); - try { - localStorage.setItem(this.SEARCH_HISTORY_KEY, JSON.stringify(this.searchHistory)); - } catch (error) { - console.error("更新搜索历史失败:", error); - } - }, - - // 清空所有搜索历史 - clearSearchHistory() { - this.searchHistory = []; - try { - localStorage.removeItem(this.SEARCH_HISTORY_KEY); - } catch (error) { - console.error("清空搜索历史失败:", error); - } - }, // 显示修改密码弹窗 showChangePasswordDialog() { this.isChangePasswordDialogVisible = true; @@ -631,11 +495,9 @@ export default {