From 9569b71af760325bea5d0fb3b2b3f6ba510586ac Mon Sep 17 00:00:00 2001
From: gerson <1405270578@qq.com>
Date: 星期三, 02 四月 2025 22:53:04 +0800
Subject: [PATCH] 隐藏工作台、GIS系统

---
 src/layout/component/header/Header.vue |  178 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 144 insertions(+), 34 deletions(-)

diff --git a/src/layout/component/header/Header.vue b/src/layout/component/header/Header.vue
index 6160542..d662aa5 100644
--- a/src/layout/component/header/Header.vue
+++ b/src/layout/component/header/Header.vue
@@ -1,14 +1,21 @@
 <template>
-	<div class="top_text flex justify-between px-6 items-center">
-		<div v-if="routerMeta.showTitle" class="font-bold flex items-center cursor-pointer" @click="goBack">
-			<span class="flex-center">
-				<SvgIcon name="ele-ArrowLeft" />
-			</span>
-			<span class="text-sm">
-				{{ routerMeta.title }}
-			</span>
+	<div class="top_text flex justify-between px-6 items-center" :class="sidebarIsShow ? 'px-6' : '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
 			v-model="state.isAnnouncementDialog"
 			width="500"
@@ -26,36 +33,28 @@
 				</p>
 			</template>
 		</el-dialog>
-	</div>
-	<div class="notice" v-if="!isSharePage">
-		<el-badge :value="`${state.announcementList.length}`">
-			<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">
-			<div class="notice_box_header">
-				<span>鏈�鏂板叕鍛�</span>
-			</div>
-			<div class="notice_box_body">
-				<div class="notice_item" v-for="item in state.announcementList" :key="item.notify_id" @click="announcementContentClick(item)">
-					<div class="flex items-center">
-						<p class="set-circle"></p>
-						<p>{{ item.notify_message }}</p>
-					</div>
 
-					<p class="text-right mr-[19px]">
-						<span>{{ item.notify_time }}</span>
-					</p>
-				</div>
-			</div>
-		</div>
+		<el-tooltip content="鏈�灏忓寲" placement="bottom">
+			<span class="cursor-pointer ywifont ywicon-tuichuquanping" size="15px" @click="smallScreenClick" />
+		</el-tooltip>
 	</div>
 </template>
 
 <script setup lang="ts">
-import { computed, onMounted, reactive } from 'vue';
+import { onClickOutside } from '@vueuse/core';
+import { storeToRefs } from 'pinia';
+import { computed, onMounted, onUnmounted, reactive, ref } from 'vue';
 import { systemNotifyList } from '/@/api/ai/chat';
 import router from '/@/router';
-import { isSharePage } from '/@/stores/chatRoom';
+import pinia from '/@/stores';
+import { activeChatRoom, newChatRoomClick, sidebarIsShow } from '/@/stores/chatRoom';
+import { ParentRegister } from '/@/stores/global';
+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,
 	isAnnouncementDialog: false,
@@ -64,6 +63,53 @@
 	announcementTime: '',
 });
 
+const smallScreenClick = () => {
+	const pathname = window.location.pathname;
+	const basePath = pathname.replace(/\/web\/index\.html$/, '');
+	window.location.href = basePath || '/';
+	ParentRegister.notify?.({
+		type: 'fullScreen',
+		value: false,
+	});
+};
+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();
 	res.messages?.forEach((element) => {
@@ -72,8 +118,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) => {
+	document.title = `${title} - ${globalTitle.value}`;
+};
+
 const handleAnnouncementClick = () => {
 	state.isShowAnnouncement = !state.isShowAnnouncement;
+	if (!announcementIsRead.value && state.isShowAnnouncement) {
+		setRead(true);
+	}
 };
 
 const goBack = () => {
@@ -92,8 +149,26 @@
 const handleCloseAnnouncement = () => {
 	state.isAnnouncementDialog = false;
 };
+// 鍖哄煙鍏抽棴鏈�鏂板叕鍛�
+onClickOutside(
+	noticeRef,
+	() => {
+		state.isShowAnnouncement = false;
+	},
+	{
+		ignore: ['.el-overlay-dialog'],
+	}
+);
+const newChatClick = () => {
+	newChatRoomClick();
+};
 onMounted(() => {
 	getSystemNotify();
+	emitter.on('updateHeaderTitle', setHeaderTitle);
+});
+
+onUnmounted(() => {
+	emitter.off('updateHeaderTitle', setHeaderTitle);
 });
 </script>
 <style scoped lang="scss">
@@ -102,12 +177,12 @@
 	height: 42px;
 	background-color: #fff;
 	top: 0;
-	z-index: 0;
+	z-index: 1;
 }
 
 .notice {
 	position: fixed;
-	top: 18px;
+	top: 12px;
 	right: 30px;
 	z-index: 1;
 	.set-notice {
@@ -199,4 +274,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