From a1b3be6f6ad4c5597fe70ee9c3d7473197fc8212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E6=B0=91=E5=BA=B7?= Date: Fri, 30 May 2025 10:22:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E4=BF=A1=E4=BB=A3=E7=A0=81=E5=BA=93-A?= =?UTF-8?q?I=E5=A4=A7=E6=A8=A1=E5=9E=8B=E7=BC=96=E8=BE=91=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E5=8A=9F=E8=83=BD=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/css/jyh.scss | 1 + .../ViewHistoryAside/ViewHistoryAside.vue | 94 +++++++++++++++---- 2 files changed, 77 insertions(+), 18 deletions(-) diff --git a/src/assets/css/jyh.scss b/src/assets/css/jyh.scss index cccab12..a80b67a 100644 --- a/src/assets/css/jyh.scss +++ b/src/assets/css/jyh.scss @@ -415,6 +415,7 @@ .card-actions { display: flex; gap: 4px; + align-items: center; margin-left: auto; } diff --git a/src/views/Jyh/AI/Home/components/ViewHistoryAside/ViewHistoryAside.vue b/src/views/Jyh/AI/Home/components/ViewHistoryAside/ViewHistoryAside.vue index 94df2a4..7c7b384 100644 --- a/src/views/Jyh/AI/Home/components/ViewHistoryAside/ViewHistoryAside.vue +++ b/src/views/Jyh/AI/Home/components/ViewHistoryAside/ViewHistoryAside.vue @@ -25,19 +25,41 @@ >
-

{{ item.title }}

- - - - - - - - - - - - + + +
@@ -263,11 +285,6 @@ const openBatchManageModal = () => { } }; -const handleEdit = (item) => { - console.log('编辑:', item); - // 这里添加编辑逻辑 -}; - const handleShare = (item) => { console.log('分享:', item); // 这里添加分享逻辑 @@ -277,6 +294,47 @@ const handleMore = (item) => { // 这里添加分享逻辑 }; +// 开始编辑 +const startEdit = (item) => { + item.isEditing = true; + item.tempTitle = item.title; // 保存临时标题 +}; + +// 确认编辑 +const confirmEdit = async (item) => { + debugger + if (!item.tempTitle.trim()) { + Message.error('标题不能为空'); + return; + } + + try { + const res = await axios.post(`${VITE_AI_API_HOST}/api/changeConversationTitle`, { + conversationId: item.conversationId, + newTitle: item.tempTitle + }); + + if (res.data.code === 20000) { + item.title = item.tempTitle; // 更新标题 + item.isEditing = false; // 退出编辑状态 + Message.success('标题修改成功'); + } else { + Message.error(res.data.message || '修改失败'); + } + } catch (error) { + console.error('编辑失败:', error); + Message.error('网络请求失败,请重试'); + item.tempTitle = item.title; // 回滚临时标题 + } +}; + +// 取消编辑 +const cancelEdit = (item) => { + debugger + item.isEditing = false; + item.tempTitle = item.title; // 恢复原始标题 +}; + // 模拟数据 const cardList = ref([ {