From 740f89d71cb52f2a30e91dcf6f164f10f44619a5 Mon Sep 17 00:00:00 2001 From: yangyin <1850366751@qq.com> Date: 星期二, 02 七月 2024 10:00:35 +0800 Subject: [PATCH] fix: 修改左侧历史立即的样式问题 --- src/layout/component/sidebar/waterLeftAside/asideNew.vue | 30 +++++++++++++++++++----------- 1 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/layout/component/sidebar/waterLeftAside/asideNew.vue b/src/layout/component/sidebar/waterLeftAside/asideNew.vue index b48ef4e..d44a3e8 100644 --- a/src/layout/component/sidebar/waterLeftAside/asideNew.vue +++ b/src/layout/component/sidebar/waterLeftAside/asideNew.vue @@ -26,7 +26,7 @@ </div> </div> - <div class="flex-auto text-[#ccc] flex flex-col items-center mt-6 overflow-y-auto" ref="chatRoomRef"> + <div class="flex-auto text-[#ccc] flex flex-col items-center mt-6 overflow-y-auto set-scroll" ref="chatRoomRef"> <div :class="{ 'bg-[#41424a]': item.id === activeRoomId }" class="group flex items-center w-full h-10 rounded-md cursor-pointer px-2 py-2 flex-0" @@ -39,7 +39,7 @@ <div class="text-gray-100 flex items-center space-x-2 ml-1"> <div class="ywicon invisible icon-bianji visible group-hover:visible !text-sm"></div> - <el-popconfirm title="纭畾鍒犻櫎杩欎釜鑱婂ぉ瀹わ紵" @confirm.stop="confirmDeleteChatRoom(item)"> + <el-popconfirm title="纭畾鍒犻櫎鑱婂ぉ璁板綍?" @confirm.stop="confirmDeleteChatRoom(item)" width="180"> <template #reference> <div class="ywicon invisible icon-shanchu3 visible group-hover:visible"></div> </template> @@ -53,11 +53,11 @@ <script setup lang="ts"> import { Search } from '@element-plus/icons-vue'; -import { nextTick, onMounted, reactive, ref } from 'vue'; +import { onMounted, reactive, ref } from 'vue'; import type { ChatRoomItem } from './types'; +import { CreateHistoryGroup, DeleteHistoryGroups, GetHistoryGroups } from '/@/api/ai/chat'; import router from '/@/router'; -import { CreateHistoryGroup, GetHistoryGroups } from '/@/api/ai/chat'; -import { chatRoomList, activeRoomId } from '/@/stores/chatRoom'; +import { activeRoomId, chatRoomList } from '/@/stores/chatRoom'; let state = reactive({ searchInput: '', selectDateOption: [ @@ -100,6 +100,9 @@ }, }); } + setTimeout(() => { + activeRoomId.value = room.id; + }, 0); }; const newChatRoomClick = async () => { @@ -117,18 +120,18 @@ } else { chatRoomList.value.unshift(newRoom); } - activeRoomId.value = newRoom.id; - nextTick(() => { - gotoAnswerPage(newRoom); - }); + gotoAnswerPage(newRoom); }; const roomClick = (room: ChatRoomItem) => { - activeRoomId.value = room.id; gotoAnswerPage(room); }; -const confirmDeleteChatRoom = (room: ChatRoomItem) => { +const confirmDeleteChatRoom = async (room: ChatRoomItem) => { + const res = await DeleteHistoryGroups({ + history_group_id: room.id, + }); + const foundIndex = chatRoomList.value.findIndex((item) => item === room); chatRoomList.value.splice(foundIndex, 1); if (chatRoomList.value.length === 0) { @@ -179,4 +182,9 @@ box-shadow: unset; } } +::-webkit-scrollbar { + height: 0; + width: 0; + color: transparent; +} </style> -- Gitblit v1.9.3