diff --git a/src/views/Jyh/AI/Home/components/ViewHistoryAside/ViewHistoryAside.vue b/src/views/Jyh/AI/Home/components/ViewHistoryAside/ViewHistoryAside.vue index 022f1a7..10a8b6a 100644 --- a/src/views/Jyh/AI/Home/components/ViewHistoryAside/ViewHistoryAside.vue +++ b/src/views/Jyh/AI/Home/components/ViewHistoryAside/ViewHistoryAside.vue @@ -263,7 +263,6 @@ const { formatTime } = useTimeFormat(); // 监听historyLimit变化,更新page.size并重置页码 const handleHistoryLimitChange = (val) => { - debugger page.value.size = Number(val) || Infinity; // 0转换为Infinity表示不限 page.value.pageNum = 1; // 重置为第一页 loadData(); // 重新加载数据 @@ -343,11 +342,18 @@ const toggleCollect = async (item) => { }); if (res.data.code === 20000) { - // 更新历史对话状态 - item.is_collected = res.data.isCollected; + // // 确保is_collected是响应式的 + // const isCollected = res.data.isCollected; + // // 找到对应的项并更新(使用索引确保响应式更新) + // const list = selectTab.value === 'dhls' ? dhlsList.value : collectionList.value; + // const index = list.findIndex(i => i.conversationId === item.conversationId); - // 刷新收藏列表 - await getQuestionCollection(); + // if (index !== -1) { + // // 使用Vue的响应式更新方式 + // list[index].is_collected = isCollected; + // } + + await loadData() Message.success(res.data.message); } else { diff --git a/src/views/Jyh/AI/Home/index.vue b/src/views/Jyh/AI/Home/index.vue index 08a3d93..f19cb91 100644 --- a/src/views/Jyh/AI/Home/index.vue +++ b/src/views/Jyh/AI/Home/index.vue @@ -394,6 +394,7 @@ const createConversation = async () => { const createRes = response.data; if (createRes&&createRes.conversationId) { + debugger CONV_ID.value = createRes.conversationId; console.log('创建会话成功,会话ID:', CONV_ID.value); nextTick(() => { @@ -423,7 +424,6 @@ const fetchFollowupQuestions = async (question,df_id,sql_id='') => { `${VITE_AI_API_HOST}/api/v0/provide_followup_questions`, params ); - debugger const createRes = response.data; if (createRes&&createRes.questions) { followupQuestions.value = createRes.questions @@ -440,6 +440,12 @@ const fetchFollowupQuestions = async (question,df_id,sql_id='') => { behavior: 'smooth', }); }); + nextTick(() => { + // 刷新会话列表 + if (viewHistoryRef.value) { + viewHistoryRef.value.getQuestionHistory(); // 调用子组件方法 + } + }) }; // 刷新猜你想问