- 页首:itemorder / guide / contact / attendants 删除与导航栏重复的大标题,统一为「短横 + 一句导语」 - 字号:页面主标题 44、区块标题 34、卡内标题 32;卡片圆角 28;容器内距 32(DESIGN.md 新增 §九) - 状态色:utils/order.js 只产出语气档,两页胶囊改 .chip-tone-* 读 --status-* 令牌,删除内联 style 与 JS 色值 - 下单:字段标签去浅橙药丸改裸字,医院选择组件同步;搜索/手填输入框去掉旧绿底 - 文案:清除英文大写小标、粘字箭头与中点串,统一细竖线/留白分隔 - 修复:预约记录空值整行剔除、陪诊师卡片与重试态补按下反馈、三处无限动画补减动效回退 - aichat:消息时间改为距上条满 5 分钟才显示
241 lines
9.7 KiB
Plaintext
241 lines
9.7 KiB
Plaintext
<view class="chat-container">
|
|
<!-- 未登录提示条:提前说明「能不能聊」,把登录入口放在这里,
|
|
用户不必等打完字被拦下来才知道要先登录 -->
|
|
<view class="login-notice" wx:if="{{authChecked && !isLoggedIn}}">
|
|
<text class="login-notice-text">尚未登录,暂时无法与陪诊助手对话</text>
|
|
<text class="login-notice-link" bindtap="goLogin" aria-role="link">去登录</text>
|
|
</view>
|
|
|
|
<!-- 消息列表区域 -->
|
|
<scroll-view
|
|
class="message-list"
|
|
scroll-y
|
|
scroll-into-view="{{scrollToMessage}}"
|
|
enhanced
|
|
show-scrollbar
|
|
>
|
|
<!-- 欢迎区:空会话时的落点 -->
|
|
<view class="welcome-area" wx:if="{{messages.length === 0}}">
|
|
<view class="welcome-icon">
|
|
<image class="welcome-icon-img" src="/images/ai-ink.png" mode="aspectFit" />
|
|
</view>
|
|
<text class="welcome-title">陪诊助手</text>
|
|
<text class="welcome-desc">我是您的智能陪诊助手,可以为您解答陪诊相关问题</text>
|
|
<view class="question-list">
|
|
<view
|
|
class="quick-item"
|
|
wx:for="{{quickQuestions}}"
|
|
wx:key="id"
|
|
bindtap="onQuickQuestionTap"
|
|
data-question="{{item.text}}"
|
|
>
|
|
<text>{{item.text}}</text>
|
|
<t-icon name="chevron-right" size="26rpx" color="#9B4508" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 消息:头像在上、气泡在下,时间紧跟头像右侧;用户消息整条靠右 -->
|
|
<view
|
|
class="message-item {{item.type}}"
|
|
wx:for="{{messages}}"
|
|
wx:key="id"
|
|
id="msg-{{item.id}}"
|
|
>
|
|
<!-- 连接或服务错误是系统状态,不使用用户/AI 头像,也不带 AI 内容声明。
|
|
未登录提示额外带一个登录入口,避免只给一句「请先登录」的死胡同 -->
|
|
<view wx:if="{{item.type === 'system'}}" class="system-message">
|
|
<text>{{item.content}}</text>
|
|
<text
|
|
wx:if="{{item.contentType === 'login'}}"
|
|
class="system-login-link"
|
|
bindtap="goLogin"
|
|
aria-role="link"
|
|
>去登录</text>
|
|
</view>
|
|
<block wx:else>
|
|
<view class="message-head">
|
|
<!-- AI:品牌标记(暖墨线稿);底色与用户侧同构,身份只由图形区分 -->
|
|
<view wx:if="{{item.type === 'ai'}}" class="avatar">
|
|
<image class="avatar-img" src="/images/home-ink.png" mode="aspectFit" />
|
|
</view>
|
|
<!-- 用户:人像图标(暖陶土) -->
|
|
<view wx:else class="avatar">
|
|
<t-icon name="user-1" size="36rpx" color="#9B4508" />
|
|
</view>
|
|
<!-- 时间只在与上一条相隔 ≥5 分钟时出现(首条必出现),
|
|
每条都挂时间会把对话读成日志;显隐由 stampMessageTimes 统一计算 -->
|
|
<text class="message-time" wx:if="{{item.showTime}}">{{item.time}}</text>
|
|
</view>
|
|
|
|
<view class="message-content">
|
|
<view class="message-bubble" wx:if="{{item.contentType !== 'questions'}}">
|
|
<t-chat-markdown
|
|
wx:if="{{item.type === 'ai' && item.contentType === 'text'}}"
|
|
class="message-markdown"
|
|
content="{{item.content}}"
|
|
/>
|
|
<text wx:elif="{{item.contentType === 'text'}}" class="message-text">{{item.content}}</text>
|
|
<image
|
|
wx:if="{{item.contentType === 'image' && item.content}}"
|
|
class="message-image"
|
|
src="{{item.content}}"
|
|
mode="widthFix"
|
|
bindtap="previewImage"
|
|
data-src="{{item.content}}"
|
|
/>
|
|
<!-- 历史里的图片不存临时路径(重启即失效),退化成一行占位 -->
|
|
<text wx:elif="{{item.contentType === 'image'}}" class="message-image-placeholder">[图片]</text>
|
|
</view>
|
|
<!-- 常见问题:由「常见问题」按钮触发,把问题清单直接铺进会话流里。
|
|
复用欢迎区的白卡 + chevron 语言,点一下即发送该问题 -->
|
|
<view wx:else class="question-list">
|
|
<view
|
|
class="quick-item"
|
|
wx:for="{{item.content}}"
|
|
wx:for-item="question"
|
|
wx:key="id"
|
|
bindtap="onQuickQuestionTap"
|
|
data-question="{{question.text}}"
|
|
>
|
|
<text>{{question.text}}</text>
|
|
<t-icon name="chevron-right" size="26rpx" color="#9B4508" />
|
|
</view>
|
|
</view>
|
|
<!-- AI 声明:本地问题清单和系统错误均不展示。 -->
|
|
<text
|
|
wx:if="{{item.type === 'ai' && item.contentType !== 'questions'}}"
|
|
class="message-note"
|
|
>内容由AI生成,仅供参考</text>
|
|
<text
|
|
wx:if="{{item.type === 'user' && item.status === 'failed'}}"
|
|
class="message-retry"
|
|
bindtap="onRetryMessage"
|
|
data-id="{{item.id}}"
|
|
>发送失败,点击重试</text>
|
|
</view>
|
|
</block>
|
|
</view>
|
|
|
|
<!-- AI 正在输入:图片/语音识别期间也用它作为 AI 回复区的默认等待态 -->
|
|
<view class="message-item ai" wx:if="{{isTyping}}" id="msg-typing">
|
|
<view class="message-head">
|
|
<view class="avatar">
|
|
<image class="avatar-img" src="/images/home-ink.png" mode="aspectFit" />
|
|
</view>
|
|
</view>
|
|
<view class="message-content">
|
|
<view class="message-bubble typing-bubble">
|
|
<view class="typing-indicator">
|
|
<view class="dot"></view>
|
|
<view class="dot"></view>
|
|
<view class="dot"></view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 底部留白,确保最新消息可见 -->
|
|
<view style="height: 40rpx;"></view>
|
|
</scroll-view>
|
|
|
|
<!-- 语音状态:只在录音阶段显示,紧贴输入区上方。
|
|
左侧展示计时与发送提示,右侧可随时取消;取消不会发送或识别本次录音。
|
|
识别/定稿阶段统一由 AI 回复区的等待气泡承载,与图片识别保持同一种反馈 -->
|
|
<view class="voice-status" wx:if="{{recording}}">
|
|
<view class="voice-dot recording"></view>
|
|
<view class="voice-status-main">
|
|
<text class="voice-status-text">正在录音 {{recordTime}}</text>
|
|
<text class="voice-status-sub">{{voiceRealtimeOff ? '结束后整段转写' : '点麦克风或发送键发出'}}</text>
|
|
</view>
|
|
<view
|
|
class="voice-cancel"
|
|
bindtap="onCancelVoiceTap"
|
|
aria-role="button"
|
|
aria-label="取消语音输入"
|
|
>
|
|
<t-icon name="close" size="24rpx" color="#9B4508" />
|
|
<text>取消</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 输入区:文字输入 + 语音 + 发送。
|
|
语音与发送在输入框右侧组成一条竖排控制,同宽同高、共用外框、同色图标
|
|
(未触发时都是暖灰 --muted,只有录音/可发时才翻成实心橙 + 白图标);
|
|
两个输入动作收成一列;语音识别结果实时回填到这里,结束时直接发送,
|
|
手动输入仍走发送键 -->
|
|
<view class="input-area">
|
|
<textarea
|
|
class="message-input {{recording || isRecognizing ? 'is-readonly' : ''}}"
|
|
value="{{inputValue}}"
|
|
placeholder="请输入您的问题..."
|
|
placeholder-class="input-placeholder"
|
|
auto-height
|
|
maxlength="-1"
|
|
cursor-spacing="24"
|
|
confirm-type="send"
|
|
disabled="{{recording || isRecognizing}}"
|
|
bindinput="onInputChange"
|
|
bindconfirm="sendMessage"
|
|
focus="{{inputFocus}}"
|
|
/>
|
|
<view class="action-group {{recording ? 'is-recording' : ''}}">
|
|
<view
|
|
class="action-btn send-btn {{inputValue && !isRecognizing ? 'active' : ''}}"
|
|
bindtap="sendMessage"
|
|
aria-role="button"
|
|
aria-label="发送消息"
|
|
aria-disabled="{{!inputValue || isRecognizing}}"
|
|
>
|
|
<t-icon name="send" size="40rpx" color="{{inputValue && !isRecognizing ? '#FFFFFF' : '#6F655C'}}" />
|
|
</view>
|
|
<view
|
|
class="action-btn voice-btn {{recording ? 'active' : ''}}"
|
|
bindtap="onMicTap"
|
|
aria-role="button"
|
|
aria-label="{{recording ? '发送或结束语音输入' : '语音输入'}}"
|
|
>
|
|
<t-icon
|
|
name="microphone"
|
|
size="40rpx"
|
|
color="{{recording ? '#FFFFFF' : '#6F655C'}}"
|
|
/>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 辅助入口:紧贴输入区下方——拇指最容易够到的位置,操作方便。
|
|
左侧是会话动作(常见问题 / 清空聊天),常驻显示;材质与输入区右侧
|
|
的语音/发送键完全一致(浅橙衬底 + 浅橙描边 + 暖灰图标/文字、圆角 20rpx),
|
|
只是更矮一行,读成同一族的次级动作,不抢发送键的视线。
|
|
靠左与上方输入框、消息气泡同一条左边线。
|
|
右侧是图片输入,同一材质,靠右放置 -->
|
|
<view class="tool-bar">
|
|
<view class="tool-group">
|
|
<view class="tool-btn" bindtap="showQuickQuestions">
|
|
<t-icon name="help-circle" size="26rpx" color="#6F655C" />
|
|
<text class="tool-btn-text">常见问题</text>
|
|
</view>
|
|
<view
|
|
class="tool-btn"
|
|
bindtap="clearChat"
|
|
aria-role="button"
|
|
aria-label="清空聊天"
|
|
>
|
|
<t-icon name="delete" size="26rpx" color="#6F655C" />
|
|
<text class="tool-btn-text">清空聊天</text>
|
|
</view>
|
|
</view>
|
|
<view class="tool-group tool-group-end">
|
|
<view
|
|
class="tool-btn"
|
|
bindtap="onImageTap"
|
|
aria-role="button"
|
|
aria-label="拍照或选择图片"
|
|
>
|
|
<t-icon name="image" size="26rpx" color="#6F655C" />
|
|
<text class="tool-btn-text">图片</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view> |