From a5bac22f6e10b1b662e5ae41055714f234b63d37 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期四, 03 四月 2025 17:27:04 +0800
Subject: [PATCH] GIS系统隐藏

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

diff --git a/src/layout/component/header/Header.vue b/src/layout/component/header/Header.vue
index b20ccff..fa42f6f 100644
--- a/src/layout/component/header/Header.vue
+++ b/src/layout/component/header/Header.vue
@@ -1,17 +1,19 @@
 <template>
-	<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="flex-items-center space-x-3 mr-4 pr-4 border border-solid border-r-1 border-l-0 border-y-0 border-gray-300"
-				v-if="!sidebarIsShow"
-			></div>
-			<div v-if="routerMeta.showTitle" class="font-bold flex items-center">
-				<span class="flex-center cursor-pointer" v-if="routerMeta.showBack" @click="goBack">
-					<SvgIcon name="ele-ArrowLeft" />
-				</span>
-				<span class="text-sm">
-					{{ routerMeta.title }}
-				</span>
+	<div class="top_text flex justify-between px-6 items-center pl-[unset] pr-6">
+		<div class="flex-items-center h-full">
+			<div class="nav-menu">
+				<router-link :to="firstToPath" class="nav-item" active-class="active">
+					<i class="icon-park-outline-robot"></i>
+					鏅鸿兘鍔╂墜
+				</router-link>
+				<router-link to="/workspace/situation" class="nav-item" active-class="active">
+					<i class="icon-park-outline-workbench"></i>
+					涓汉宸ヤ綔鍙�
+				</router-link>
+				<!-- <router-link to="/gis/situation" class="nav-item" active-class="active">
+					<i class="icon-park-outline-system"></i>
+					GIS绯荤粺
+				</router-link> -->
 			</div>
 		</div>
 		<el-dialog
@@ -32,8 +34,8 @@
 			</template>
 		</el-dialog>
 	</div>
-	<div class="notice" v-if="!isSharePage">
-		<el-badge :value="`${state.announcementList.length}`">
+	<div class="notice " v-if="!isSharePage">
+		<el-badge :value="`${state.announcementList.length}`" :hidden="announcementIsRead || state.announcementList?.length === 0">
 			<el-button link size="small" icon="ele-Message" class="set-notice" @click="handleAnnouncementClick">绯荤粺鍏憡</el-button>
 		</el-badge>
 		<div class="notice_box notice_box_show" v-show="state.isShowAnnouncement" ref="noticeRef">
@@ -58,11 +60,17 @@
 
 <script setup lang="ts">
 import { onClickOutside } from '@vueuse/core';
-import { computed, onMounted, onUnmounted, reactive, ref, triggerRef } from 'vue';
+import { storeToRefs } from 'pinia';
+import { computed, onMounted, onUnmounted, reactive, ref } from 'vue';
 import { systemNotifyList } from '/@/api/ai/chat';
 import router from '/@/router';
-import { isSharePage, newChatRoomClick } from '/@/stores/chatRoom';
+import pinia from '/@/stores';
+import { activeChatRoom, activeRoomId, isSharePage, newChatRoomClick } from '/@/stores/chatRoom';
+import { useThemeConfig } from '/@/stores/themeConfig';
 import emitter from '/@/utils/mitt';
+import { userInfoKey } from '/@/utils/request';
+import { Local } from '/@/utils/storage';
+
 const props = defineProps(['sidebarIsShow']);
 let state = reactive({
 	isShowAnnouncement: false,
@@ -71,6 +79,43 @@
 	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));
+const readKey = `announcementIsRead_${userInfo.value?.id}`;
+const getIsRead = () => {
+	if (!userInfo.value?.id) return false;
+	const isRead = Local.get(readKey) ?? false;
+	return isRead;
+};
+
+const setRead = (isRead: boolean) => {
+	if (!userInfo.value?.id) return;
+	announcementIsRead.value = isRead;
+	Local.set(readKey, isRead);
+};
+const announcementIsRead = ref(getIsRead());
+
+//#endregion
 const noticeRef = ref(null);
 const getSystemNotify = async () => {
 	const res = await systemNotifyList();
@@ -80,14 +125,19 @@
 	state.announcementList = res.messages?.sort(sortData).slice(0, 5) ?? [];
 };
 const routerMeta = computed(() => router.currentRoute.value.meta);
+const stores = useThemeConfig(pinia);
+const { themeConfig } = storeToRefs(stores);
+const globalTitle = computed(() => themeConfig.value.globalTitle);
 
 const setHeaderTitle = (title: string) => {
-	routerMeta.value.title = title;
-	triggerRef(routerMeta);
+	document.title = `${title} - ${globalTitle.value}`;
 };
 
 const handleAnnouncementClick = () => {
 	state.isShowAnnouncement = !state.isShowAnnouncement;
+	if (!announcementIsRead.value && state.isShowAnnouncement) {
+		setRead(true);
+	}
 };
 
 const goBack = () => {
@@ -139,7 +189,7 @@
 
 .notice {
 	position: fixed;
-	top: 18px;
+	top: 12px;
 	right: 30px;
 	z-index: 1;
 	.set-notice {
@@ -231,4 +281,39 @@
 	padding: 10px 20px 20px;
 	box-sizing: border-box;
 }
+
+.nav-menu {
+	display: flex;
+	align-items: center;
+	height: 100%;
+	gap: 8px;
+
+	.nav-item {
+		display: flex;
+		align-items: center;
+		padding: 0 16px;
+		height: 100%;
+		color: var(--el-text-color-regular);
+		text-decoration: none;
+		font-size: 14px;
+		transition: all 0.3s ease;
+		border-bottom: 2px solid transparent;
+		gap: 4px;
+
+		i {
+			font-size: 16px;
+		}
+
+		&:hover {
+			color: var(--el-color-primary);
+			background-color: rgba(var(--el-color-primary-rgb), 0.1);
+		}
+
+		&.active {
+			color: var(--el-color-primary);
+			border-bottom-color: var(--el-color-primary);
+			background-color: rgba(var(--el-color-primary-rgb), 0.1);
+		}
+	}
+}
 </style>

--
Gitblit v1.9.3