From d5f17f079d4af2a173015dc86a4d6d472731fac6 Mon Sep 17 00:00:00 2001
From: gerson <1405270578@qq.com>
Date: 星期日, 07 七月 2024 16:59:53 +0800
Subject: [PATCH] echart 图表问题;raw_mode

---
 src/layout/component/sidebar/components/ChatRecord.vue |   34 +++++++++++++++++++++-------------
 1 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/src/layout/component/sidebar/components/ChatRecord.vue b/src/layout/component/sidebar/components/ChatRecord.vue
index 84bba9d..39555c6 100644
--- a/src/layout/component/sidebar/components/ChatRecord.vue
+++ b/src/layout/component/sidebar/components/ChatRecord.vue
@@ -74,6 +74,7 @@
 import { debounce, getRecentDateRange } from '/@/utils/util';
 import moment from 'moment';
 import { useSearch } from '/@/hooks/useSearch';
+import { gotoRoute } from '/@/utils/route';
 
 const chatRoomRef = ref<HTMLDivElement>(null);
 const queryParams = ref({
@@ -82,20 +83,22 @@
 
 const gotoAnswerPage = (room: ChatRoomItem) => {
 	if (room.isInitial) {
-		router.push({
+		gotoRoute({
 			name: 'Home',
+			query: {
+				id: room.id,
+			},
 		});
 	} else {
-		router.push({
+		gotoRoute({
 			name: 'AskAnswer',
 			query: {
 				id: room.id,
 			},
 		});
 	}
-	setTimeout(() => {
-		activeRoomId.value = room.id;
-	}, 0);
+
+	activeRoomId.value = room.id;
 };
 
 const newChatRoomClick = async () => {
@@ -184,14 +187,19 @@
 	const res = await GetHistoryGroups();
 
 	const resData = (res?.groups || []) as any[];
-	chatRoomList.value = resData?.map((item) => {
-		return {
-			id: item.group_id,
-			title: item.group_title,
-			createTime: item.create_time,
-			isInitial: Number(item.chat_count) === 0,
-		};
-	});
+	// 鎸夋渶鏅氭椂闂村埌鏈�鏃╂椂闂�
+	chatRoomList.value = resData
+		?.toSorted((a, b) => {
+			return b.create_time.localeCompare(a.create_time);
+		})
+		.map((item) => {
+			return {
+				id: item.group_id,
+				title: item.group_title,
+				createTime: item.create_time,
+				isInitial: Number(item.chat_count) === 0,
+			};
+		});
 	if (!chatRoomList.value || chatRoomList.value.length === 0 || !chatRoomList.value?.[0].isInitial) {
 		newChatRoomClick();
 	} else {

--
Gitblit v1.9.3