From 6ca24301fd3edf76359240ae5272e75b7a4db77f Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期三, 02 四月 2025 09:44:24 +0800
Subject: [PATCH] 修改文案,小bug

---
 src/layout/component/header/Header.vue |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/layout/component/header/Header.vue b/src/layout/component/header/Header.vue
index f0f7c8f..80775a9 100644
--- a/src/layout/component/header/Header.vue
+++ b/src/layout/component/header/Header.vue
@@ -2,7 +2,7 @@
 	<div class="top_text flex justify-between px-6 items-center" :class="sidebarIsShow ? 'px-6' : 'pl-[unset] pr-6'">
 		<div class="flex-items-center">
 			<div class="nav-menu">
-				<router-link :to="{ path: '/ask_answer', query: { id: activeRoomId } }" class="nav-item" active-class="active">
+				<router-link :to="firstToPath" class="nav-item" active-class="active">
 					<i class="icon-park-outline-robot"></i>
 					鏅鸿兘鍔╂墜
 				</router-link>
@@ -65,7 +65,7 @@
 import { systemNotifyList } from '/@/api/ai/chat';
 import router from '/@/router';
 import pinia from '/@/stores';
-import { activeRoomId, isSharePage, newChatRoomClick } from '/@/stores/chatRoom';
+import { activeChatRoom, activeRoomId, isSharePage, newChatRoomClick } from '/@/stores/chatRoom';
 import { useThemeConfig } from '/@/stores/themeConfig';
 import emitter from '/@/utils/mitt';
 import { userInfoKey } from '/@/utils/request';
@@ -79,8 +79,25 @@
 	announcementContent: '',
 	announcementTime: '',
 });
+const firstToPath = computed(() => {
+	if (!activeChatRoom.value)
+		return {
+			path: '/home',
+		};
+	const result = activeChatRoom.value.isInitial
+		? {
+				path: '/home',
+				query: {
+					id: activeChatRoom.value.id,
+				},
+		  }
+		: {
+				path: '/ask_answer',
+				query: { id: activeChatRoom.value.id },
+		  };
 
-
+	return result;
+});
 
 //#region ====================== 鍏憡鏄惁鐪嬭繃 ======================
 const userInfo = ref(Local.get(userInfoKey));

--
Gitblit v1.9.3