diff --git a/subPackages/chat/components/MessageBubble.vue b/subPackages/chat/components/MessageBubble.vue index 74e9aaf..ffb2c70 100644 --- a/subPackages/chat/components/MessageBubble.vue +++ b/subPackages/chat/components/MessageBubble.vue @@ -313,8 +313,16 @@ export default { title: '同意转诊成功', icon: 'success' }) - // 触发消息更新事件 - uni.$emit('chat-message-update') + // 跳转到咨询页面 + setTimeout(() => { + uni.redirectTo({ + url: `/subPackages/transfer/transfer-consultation?transfer_id=${messageData.transfer_id}`, + fail: (err) => { + console.error('跳转失败:', err) + uni.showToast({ title: '跳转失败,请重试', icon: 'none' }) + } + }) + }, 1000) } else { uni.showToast({ title: result.data.message || '操作失败', diff --git a/subPackages/my/myappiont.vue b/subPackages/my/myappiont.vue index 57f1ffc..265113b 100644 --- a/subPackages/my/myappiont.vue +++ b/subPackages/my/myappiont.vue @@ -142,10 +142,16 @@ title: '同意转诊成功', icon: 'success' }) - // 刷新列表 - this.page = 1 - this.infoList = [] - this.getInfos() + // 跳转到咨询页面 + setTimeout(() => { + uni.redirectTo({ + url: `/subPackages/transfer/transfer-consultation?transfer_id=${transferData.id}`, + fail: (err) => { + console.error('跳转失败:', err) + uni.showToast({ title: '跳转失败,请重试', icon: 'none' }) + } + }) + }, 1000) } else { uni.showToast({ title: result.data.message || '操作失败', diff --git a/subPackages/transfer/transfer-consultation.vue b/subPackages/transfer/transfer-consultation.vue index d658438..6444749 100644 --- a/subPackages/transfer/transfer-consultation.vue +++ b/subPackages/transfer/transfer-consultation.vue @@ -66,6 +66,21 @@ + + + + + {{ assistantName }} + + + + + + + + + + @@ -111,7 +126,9 @@ export default { assistantAvatar: '/static/images/assistant-avatar.png', // 医生助理头像(默认值,会从后端获取) assistantName: '医生助理', // 医生助理名字(默认值,会从后端获取) userAvatar: '/static/images/user-avatar.png', // 用户头像(需要替换为实际路径) - prescriptionInfo: '炒黄芪等共2味' // 处方信息(可以从转诊详情中获取) + prescriptionInfo: '炒黄芪等共2味', // 处方信息(可以从转诊详情中获取) + replyDelay: 1.00, // 回复延迟时间(秒),从配置中获取 + isTyping: false // 是否显示"正在回复"提示 } }, computed: { @@ -276,6 +293,7 @@ export default { const config = res.data.result || {} this.assistantName = config.name || '医生助理' this.assistantAvatar = config.avatar || '/static/images/assistant-avatar.png' + this.replyDelay = parseFloat(config.reply_delay) || 1.00 // 获取延迟时间,支持小数 } } catch (error) { console.error('加载助理配置失败:', error) @@ -304,6 +322,17 @@ export default { setTimeout(() => { uni.navigateBack() }, 1500) + } else { + // 延迟显示第一个问题(模拟真人回复) + this.isTyping = true + setTimeout(() => { + this.isTyping = false + // 显示第一个问题 + this.currentQuestionIndex = 0 + this.$nextTick(() => { + this.scrollIntoView = 'bottom-anchor' + }) + }, this.replyDelay * 1000) // 延迟时间(毫秒) } } else { throw new Error(res.data.message || '获取问题失败') @@ -328,13 +357,24 @@ export default { // 保存答案 this.userAnswers.push(answer) - // 如果还有下一个问题,显示下一个问题 + // 如果还有下一个问题,延迟显示下一个问题(模拟真人回复) if (this.currentQuestionIndex < this.questions.length - 1) { - this.currentQuestionIndex++ - // 滚动到底部,显示新问题 + // 显示"正在回复"提示 + this.isTyping = true + // 滚动到底部 this.$nextTick(() => { this.scrollIntoView = 'bottom-anchor' }) + + // 延迟后显示下一个问题 + setTimeout(() => { + this.isTyping = false + this.currentQuestionIndex++ + // 滚动到底部,显示新问题 + this.$nextTick(() => { + this.scrollIntoView = 'bottom-anchor' + }) + }, this.replyDelay * 1000) // 延迟时间(毫秒) } else { // 所有问题已回答,提交答案 // 先滚动到底部 @@ -576,6 +616,50 @@ export default { } } } + + &.typing-indicator { + .typing-bubble { + padding: 18rpx 24rpx; + min-width: 80rpx; + } + + .typing-dots { + display: flex; + align-items: center; + gap: 8rpx; + + .dot { + width: 12rpx; + height: 12rpx; + border-radius: 50%; + background: #999; + animation: typing 1.4s infinite ease-in-out; + } + + .dot:nth-child(1) { + animation-delay: 0s; + } + + .dot:nth-child(2) { + animation-delay: 0.2s; + } + + .dot:nth-child(3) { + animation-delay: 0.4s; + } + } + } +} + +@keyframes typing { + 0%, 60%, 100% { + transform: translateY(0); + opacity: 0.7; + } + 30% { + transform: translateY(-10rpx); + opacity: 1; + } } .action-footer {