diff --git a/components/AssistantConsultationShell.vue b/components/AssistantConsultationShell.vue index a48f2fc..ded188f 100644 --- a/components/AssistantConsultationShell.vue +++ b/components/AssistantConsultationShell.vue @@ -115,21 +115,30 @@ v-else-if="showQuestionButtons && currentQuestion && !isSubmitting && !showWaiting && answerMode === 'multi'" class="action-footer multi-footer safe-area-inset-bottom" > - + + + @@ -259,17 +269,25 @@ export default { }, data() { return { - /** 多选模式下已选中的选项下标映射,避免模板里写 indexOf */ - multiSelectedMap: {}, + /** 多选已选下标列表(整表替换,微信小程序下比 object+$set 更稳) */ + multiSelectedIndexes: [], + /** 选「其他」时的自定义症状文案 */ + multiOtherText: '', + /** 防双击:emit 后立刻锁,题目切换解锁 */ + answeringLock: false, }; }, watch: { // 题目切换时清空多选,避免上一题选中态残留 currentQuestion() { - this.multiSelectedMap = {}; + this.multiSelectedIndexes = []; + this.multiOtherText = ''; + this.answeringLock = false; }, answerMode() { - this.multiSelectedMap = {}; + this.multiSelectedIndexes = []; + this.multiOtherText = ''; + this.answeringLock = false; }, }, computed: { @@ -281,8 +299,37 @@ export default { this.$emit('update:showAgreement', val) }, }, + /** 供模板判断选中,避免 :class 里写 indexOf */ + multiSelectedFlag() { + const map = {}; + const list = this.multiSelectedIndexes || []; + for (let i = 0; i < list.length; i++) { + map[list[i]] = true; + } + return map; + }, multiSelectedCount() { - return Object.keys(this.multiSelectedMap).filter((k) => this.multiSelectedMap[k]).length; + return (this.multiSelectedIndexes || []).length; + }, + /** 是否选中了「其他」选项 */ + multiHasOtherSelected() { + const answers = this.currentQuestionAnswers || []; + const list = this.multiSelectedIndexes || []; + for (let i = 0; i < list.length; i++) { + const idx = list[i]; + if (answers[idx] === '其他') { + return true; + } + } + return false; + }, + /** 多选确认是否可提交:至少选一项;选了其他则自定义文案非空 */ + multiConfirmEnabled() { + if (this.multiSelectedCount === 0) return false; + if (this.multiHasOtherSelected) { + return !!(this.multiOtherText && String(this.multiOtherText).trim()); + } + return true; }, }, methods: { @@ -306,27 +353,54 @@ export default { if (index === 0) return 'yes-btn' return 'no-btn' }, + /** 单选:点一下即提交,防双击重复 emit */ + emitSingleAnswer(answer) { + if (this.answeringLock || this.isSubmitting) return; + this.answeringLock = true; + this.$emit('answer', answer); + }, /** 多选:切换某个适用症的选中状态 */ toggleMultiAnswer(index) { - if (this.multiSelectedMap[index]) { - this.$delete(this.multiSelectedMap, index); + if (this.answeringLock || this.isSubmitting) return; + const list = this.multiSelectedIndexes || []; + const pos = list.indexOf(index); + if (pos === -1) { + this.multiSelectedIndexes = list.concat([index]); } else { - this.$set(this.multiSelectedMap, index, true); + this.multiSelectedIndexes = list.filter((i) => i !== index); + if (this.currentQuestionAnswers[index] === '其他') { + this.multiOtherText = ''; + } } }, - /** 多选确认:把选中标签用顿号拼接后交给父组件 */ + /** + * 多选确认:选中标签用顿号拼接;「其他」替换为自定义填写内容 + */ confirmMultiAnswer() { - const indexes = Object.keys(this.multiSelectedMap) - .filter((k) => this.multiSelectedMap[k]) - .map((k) => Number(k)) - .sort((a, b) => a - b); + if (this.answeringLock || this.isSubmitting) return; + if (!this.multiConfirmEnabled) { + if (this.multiSelectedCount === 0) { + uni.showToast({ title: '请至少选择一项', icon: 'none' }); + } else if (this.multiHasOtherSelected) { + uni.showToast({ title: '请填写具体症状', icon: 'none' }); + } + return; + } + const indexes = (this.multiSelectedIndexes || []).slice().sort((a, b) => a - b); if (!indexes.length) return; + const otherText = (this.multiOtherText || '').trim(); const labels = indexes - .map((i) => this.currentQuestionAnswers[i]) + .map((i) => { + const label = this.currentQuestionAnswers[i]; + if (label === '其他') return otherText; + return label; + }) .filter(Boolean); if (!labels.length) return; + this.answeringLock = true; this.$emit('answer', labels.join('、')); - this.multiSelectedMap = {}; + this.multiSelectedIndexes = []; + this.multiOtherText = ''; }, }, } @@ -531,19 +605,22 @@ export default { font-weight: 500; border: none; white-space: normal; + /* 覆盖微信 button 默认白底/按下灰底,避免按钮组背景错乱 */ + background-color: #0a84ff !important; + color: #fff !important; &::after { border: none; } &.yes-btn { - background: #0a84ff; - color: #fff; + background-color: #0a84ff !important; + color: #fff !important; } &.no-btn { - background: #fff; - color: #333; + background-color: #fff !important; + color: #333 !important; border: 2rpx solid #ddd; } @@ -563,6 +640,18 @@ export default { gap: 16rpx; } + .multi-other-input { + width: 100%; + box-sizing: border-box; + padding: 16rpx 24rpx; + min-height: 72rpx; + border-radius: 12rpx; + background: #f8fafc; + font-size: 28rpx; + color: #333; + border: 1rpx solid #e2e8f0; + } + .multi-option-btn { min-width: 140rpx; padding: 0 28rpx; @@ -570,8 +659,8 @@ export default { line-height: 64rpx; border-radius: 32rpx; font-size: 26rpx; - background: rgba(10, 132, 255, 0.08); - color: #475569; + background-color: rgba(10, 132, 255, 0.08) !important; + color: #475569 !important; border: 2rpx solid transparent; &::after { @@ -579,14 +668,16 @@ export default { } &.selected { - background: #0a84ff; - color: #fff; + background-color: #0a84ff !important; + color: #fff !important; } } .confirm-btn { width: 100%; flex: none; + background-color: #0a84ff !important; + color: #fff !important; } } } diff --git a/subPackages/chat/components/MessageBubble.vue b/subPackages/chat/components/MessageBubble.vue index 70ffa0f..e400925 100644 --- a/subPackages/chat/components/MessageBubble.vue +++ b/subPackages/chat/components/MessageBubble.vue @@ -146,6 +146,18 @@ 主诉 {{ parsedContent.chief_complaint }} + + 适用症/症状 + {{ parsedContent.illnessInfo }} + + + 是否就诊过 + {{ parsedContent.has_visited === 1 || parsedContent.has_visited === '1' ? '是' : '否' }} + + + 是否使用过药品 + {{ parsedContent.has_used_drug === 1 || parsedContent.has_used_drug === '1' ? '是' : '否' }} + 所选药品 @@ -184,6 +196,13 @@ 您的选择 {{ followUpAnsweredLabel }} + + 是否就诊过 + {{ parsedContent.has_visited === 1 || parsedContent.has_visited === '1' ? '是' : '否' }} + 适用症/症状 {{ parsedContent.illness_info }} @@ -250,7 +269,7 @@ 问诊结束 - {{ parsedContent.reason || '本次服务已完成' }} + {{ parsedContent.end_reason || parsedContent.reason || parsedContent.message || '本次服务已完成' }} diff --git a/subPackages/follow-up/medication-info.vue b/subPackages/follow-up/medication-info.vue index 3054ee6..b505126 100644 --- a/subPackages/follow-up/medication-info.vue +++ b/subPackages/follow-up/medication-info.vue @@ -1,7 +1,8 @@