diff --git a/pages/case/components/archive-detail/follow-up-manage-tab.vue b/pages/case/components/archive-detail/follow-up-manage-tab.vue index 792688a..be97c5c 100644 --- a/pages/case/components/archive-detail/follow-up-manage-tab.vue +++ b/pages/case/components/archive-detail/follow-up-manage-tab.vue @@ -526,6 +526,7 @@ async function sendFollowUp(todo) { content: todo.sendContent, }); } + console.log("==============>fileList", todo.fileList); // 2. 处理文件列表(图片、宣教文章、问卷) if (Array.isArray(todo.fileList)) { @@ -537,20 +538,21 @@ async function sendFollowUp(todo) { content: file.URL, name: file.file?.name || file.name || "图片", }); - } else if (file.type === "article" && file.file?.url) { - // 发送宣教文章 + } else if (file.file.type === "article" && file.file?.url) { + // 发送宣教文章 - 从 URL 中解析 id + const articleId = extractIdFromUrl(file.file.url); messages.push({ type: "article", content: { - _id: file.file?._id || file._id, - title: file.file?.name || file.name || "宣教文章", + _id: articleId, + title: file.file?.name || "宣教文章", url: file.file?.url || file.URL, subtitle: file.file?.subtitle || "", cover: file.file?.cover || "", - articleId: file.file?._id || file._id, + articleId: articleId, }, }); - } else if (file.type === "questionnaire" && file.file?.surveryId) { + } else if (file.file.type === "questionnaire" && file.file?.surveryId) { // 发送问卷 messages.push({ type: "questionnaire", @@ -580,6 +582,30 @@ async function sendFollowUp(todo) { } } +/** + * 从 URL 中提取 id 参数 + * @param {string} url - 完整的 URL + * @returns {string} 提取出的 id 值 + */ +function extractIdFromUrl(url) { + if (!url) return ""; + try { + // 处理格式: https://www.youcan365.com/patientDeploy/#/pages/article/index?id=267epkhd3xbklcnbf0f45gzp1769567841991&corpId=... + const urlObj = new URL(url); + const id = urlObj.searchParams.get("id"); + if (id) return id; + + // 备用方案:使用正则表达式提取 + const match = url.match(/[?&]id=([^&]+)/); + return match ? decodeURIComponent(match[1]) : ""; + } catch (error) { + console.error("解析 URL 失败:", error); + // 备用方案:使用正则表达式提取 + const match = url.match(/[?&]id=([^&]+)/); + return match ? decodeURIComponent(match[1]) : ""; + } +} + // ---- filter popup ---- const filterPopupRef = ref(null); const state = ref(null); diff --git a/pages/message/chat.scss b/pages/message/chat.scss index 8a15f48..1c7f0eb 100644 --- a/pages/message/chat.scss +++ b/pages/message/chat.scss @@ -418,6 +418,25 @@ $primary-color: #0877F1; background: #2456c7; } +.disabled-btn { + background: #ccc; + color: #fff; + font-size: 28rpx; + font-weight: 600; + border: none; + border-radius: 40rpx; + height: 56rpx; + min-width: 112rpx; + padding: 0 32rpx; + box-shadow: 0 2rpx 8rpx rgba(200, 200, 200, 0.08); + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; + white-space: nowrap; + cursor: not-allowed; +} + .input-area { flex: 1; margin: 0 8rpx; diff --git a/pages/message/components/ai-assistant-buttons.vue b/pages/message/components/ai-assistant-buttons.vue index 9c8f2a1..aa8900b 100644 --- a/pages/message/components/ai-assistant-buttons.vue +++ b/pages/message/components/ai-assistant-buttons.vue @@ -57,10 +57,12 @@ const props = defineProps({ default: "", }, }); -const emit = defineEmits(["streamText", "clearInput"]); +const emit = defineEmits(["streamText", "clearInput", "generatingStateChange"]); const typeSelectorRef = ref(null); const progressRef = ref(null); +const isGenerating = ref(false); + const buttons = ref([ { id: "followUp", @@ -183,6 +185,8 @@ const streamTextToInput = (text) => { // 先清空输入框 emit("clearInput"); + isGenerating.value = true; + emit("generatingStateChange", true); let currentIndex = 0; const speed = 50; // 每个字符的延迟时间(毫秒) @@ -196,6 +200,8 @@ const streamTextToInput = (text) => { currentIndex++; } else { clearInterval(streamInterval); + isGenerating.value = false; + emit("generatingStateChange", false); } }, speed); }, 100); @@ -363,6 +369,11 @@ const handleRegenerateMedicalCase = (data) => { const type = { id: data.caseType }; handleCaseTypeSelect(type); }; + +// 暴露生成状态给父组件 +defineExpose({ + isGenerating, +});