From f1d0187fa0524b7e11399a80f3a68a2b1c59c5c9 Mon Sep 17 00:00:00 2001 From: zhangxiao <898441624@qq.com> Date: 星期五, 16 八月 2024 20:55:12 +0800 Subject: [PATCH] fix: 修改bug --- src/views/sessionManager/components/historySession.vue | 78 +++++++++++++++++++++++++++++++------- 1 files changed, 63 insertions(+), 15 deletions(-) diff --git a/src/views/sessionManager/components/historySession.vue b/src/views/sessionManager/components/historySession.vue index c355dce..23b3479 100644 --- a/src/views/sessionManager/components/historySession.vue +++ b/src/views/sessionManager/components/historySession.vue @@ -8,7 +8,7 @@ top: 10px; left: -40px; font-size: 30px; - z-index: 9999; + z-index: 99; cursor: pointer" @click="emit('changeAgentType','1')" > @@ -47,6 +47,8 @@ class="item historyCenter-box" v-for="session in sessionList" @click="querySessionDetail(session)" + @mouseenter="handleMouseEnter(session)" + @mouseleave="handleMouseLeave(session)" > <div class="text" > <img @@ -57,12 +59,18 @@ {{ session.name }} </div> <div class="time" - >{{ - moment(new Date(session.create_time)).format( - 'YYYY-MM-DD HH:mm:ss' - ) - }} + > + <span v-show="session.showtype == 1" style="font-size: 14px"> + {{ + moment(new Date(session.create_time)).format( + 'YYYY-MM-DD HH:mm:ss' + ) + }} + </span> </div> + <a-button type="text" @click.stop="deleteSession(session)" style="color: red;position: absolute;right: 10px;top: 10px;" v-show="session.showtype == 2"> + <icon-delete style="font-size: 14px" /> + </a-button> </div> </div> </a-scrollbar> @@ -77,7 +85,7 @@ import { useAppStore, useUserStore } from "@/store"; import { computed, nextTick, onMounted, watch, reactive, ref, onBeforeMount, onBeforeUnmount } from "vue"; -import { Message } from "@arco-design/web-vue"; +import { Message, Modal } from "@arco-design/web-vue"; import EventBus from '@/utils/EventBus'; import moment from "moment"; import { @@ -85,11 +93,14 @@ chatApi, getDialogListApi, getSessionDetailsApi, + deleteSessionApi, sessionListApi } from "@/api/session"; + import { queryCanvasList } from "@/api/Agent"; const emit = defineEmits(["querySessionDetail","changeAgentType"]); import logo from "@/assets/images/model.png"; +import { deleteKnow } from "@/api/kbList"; const sessionList = ref([]); //浼氳瘽鍒楄〃 const activeSessionId = ref(""); const fieldNames = { value: "id", label: "name" }; @@ -152,7 +163,12 @@ const querySessionList = async (id) => { const { code, data } = await sessionListApi(id); if (code === 200) { - sessionList.value = data; + sessionList.value = data.map((item) => { + return { + ...item, + showtype: 1 + } + }); @@ -161,20 +177,50 @@ } }; +//鏍规嵁浼氳瘽id鍒犻櫎浼氳瘽 +const deleteSession = async (session) => { + Modal.confirm({ + title: '鎻愮ず淇℃伅', + content: '纭鍒犻櫎鍚�', + okText: '纭畾', + cancelText: '鍙栨秷', + hideTitle: true, + onOk: async () => { + const { code } = await deleteSessionApi([session.id]); + if (code === 200) { + Message.success('鍒犻櫎鎴愬姛'); + querySessionList(''); + } + }, + onCancel: () => {}, + }); +}; const querySessionDetail = async (session) => { console.log(session, 'session'); emit('changeAgentType','1'); emit('querySessionDetail',session); } + + +const handleMouseEnter = (session) => { + session.showtype = 2; +}; + +const handleMouseLeave = (session) => { + session.showtype = 1; +}; + onBeforeMount(()=>{ - DialogList() + // DialogList() + querySessionList(''); }) onMounted(() => { EventBus.on("history", () => { emit('changeAgentType','3'); - DialogList() + // DialogList() + querySessionList(''); }); }) @@ -218,22 +264,24 @@ width: 100%; margin-top: 30px; .historyCenter-box{ + position: relative; display: flex; width: 70%; margin-left: 15%; - //border: 1px solid var(--color-text-4); + //border: 1px solid var(--color-neutral-3); padding: 16px; border-radius: 12px; - background: var(--color-bg-2); + background: var(--color-bg-1); margin-top: 10px; cursor: pointer; justify-content: space-between; align-items: center; + color: var(--color-text-2); } .historyCenter-box:hover{ - color: #2a2a2b; - border: 1px solid var(--color-neutral-3); - //background: #e8e8ea; + color: var(--color-text-2); + //border: 1px solid var(--color-neutral-3); + background: var(--color-bg-3); box-shadow: 0 1px 2px -2px rgba(0, 0, 0, 0.16), 0 3px 6px 0 rgba(0, 0, 0, 0.12), 0 5px 12px 4px rgba(0, 0, 0, 0.09); } } -- Gitblit v1.8.0