feat(ai): AI 助手增加「更多」菜单并重排底部操作区
常见问题与清空聊天收进「更多」菜单,底部不再常驻两行低频操作; 页面禁止整页滚动、消息区独立滚动,欢迎区与输入面板按新版纸面/白面重构。
This commit is contained in:
+54
-61
@@ -12,15 +12,12 @@
|
||||
scroll-y
|
||||
scroll-into-view="{{scrollToMessage}}"
|
||||
enhanced
|
||||
show-scrollbar
|
||||
show-scrollbar="{{false}}"
|
||||
>
|
||||
<!-- 欢迎区:空会话时的落点 -->
|
||||
<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>
|
||||
<text class="welcome-title">陪诊服务咨询</text>
|
||||
<view class="question-heading"><text>您可以这样问</text><text class="question-heading-sub">点选即发送</text></view>
|
||||
<view class="question-list">
|
||||
<view
|
||||
class="quick-item"
|
||||
@@ -28,11 +25,16 @@
|
||||
wx:key="id"
|
||||
bindtap="onQuickQuestionTap"
|
||||
data-question="{{item.text}}"
|
||||
hover-class="question-hover"
|
||||
aria-role="button"
|
||||
aria-label="{{item.text}}"
|
||||
>
|
||||
<view class="question-mark" aria-hidden="true">?</view>
|
||||
<text>{{item.text}}</text>
|
||||
<t-icon name="chevron-right" size="26rpx" color="#9B4508" />
|
||||
</view>
|
||||
</view>
|
||||
<text class="welcome-note">AI 助手不替代医生诊断,紧急情况请及时就医。</text>
|
||||
</view>
|
||||
|
||||
<!-- 消息:头像在上、气泡在下,时间紧跟头像右侧;用户消息整条靠右 -->
|
||||
@@ -61,8 +63,9 @@
|
||||
</view>
|
||||
<!-- 用户:人像图标(暖陶土) -->
|
||||
<view wx:else class="avatar">
|
||||
<t-icon name="user-1" size="36rpx" color="#9B4508" />
|
||||
<t-icon name="user" size="30rpx" color="#6F655C" />
|
||||
</view>
|
||||
<text class="message-author">{{item.type === 'ai' ? '暖橙助手' : '我'}}</text>
|
||||
<!-- 时间只在与上一条相隔 ≥5 分钟时出现(首条必出现),
|
||||
每条都挂时间会把对话读成日志;显隐由 stampMessageTimes 统一计算 -->
|
||||
<text class="message-time" wx:if="{{item.showTime}}">{{item.time}}</text>
|
||||
@@ -75,7 +78,7 @@
|
||||
class="message-markdown"
|
||||
content="{{item.content}}"
|
||||
/>
|
||||
<text wx:elif="{{item.contentType === 'text'}}" class="message-text">{{item.content}}</text>
|
||||
<text wx:elif="{{item.contentType === 'text'}}" class="message-text" user-select>{{item.content}}</text>
|
||||
<image
|
||||
wx:if="{{item.contentType === 'image' && item.content}}"
|
||||
class="message-image"
|
||||
@@ -97,6 +100,9 @@
|
||||
wx:key="id"
|
||||
bindtap="onQuickQuestionTap"
|
||||
data-question="{{question.text}}"
|
||||
hover-class="question-hover"
|
||||
aria-role="button"
|
||||
aria-label="{{question.text}}"
|
||||
>
|
||||
<text>{{question.text}}</text>
|
||||
<t-icon name="chevron-right" size="26rpx" color="#9B4508" />
|
||||
@@ -106,7 +112,7 @@
|
||||
<text
|
||||
wx:if="{{item.type === 'ai' && item.contentType !== 'questions'}}"
|
||||
class="message-note"
|
||||
>内容由AI生成,仅供参考</text>
|
||||
>AI 生成,仅供参考,不替代医生诊断</text>
|
||||
<text
|
||||
wx:if="{{item.type === 'user' && item.status === 'failed'}}"
|
||||
class="message-retry"
|
||||
@@ -123,6 +129,7 @@
|
||||
<view class="avatar">
|
||||
<image class="avatar-img" src="/images/home-ink.png" mode="aspectFit" />
|
||||
</view>
|
||||
<text class="message-author">暖橙助手</text>
|
||||
</view>
|
||||
<view class="message-content">
|
||||
<view class="message-bubble typing-bubble">
|
||||
@@ -131,6 +138,7 @@
|
||||
<view class="dot"></view>
|
||||
<view class="dot"></view>
|
||||
</view>
|
||||
<text class="typing-text">{{isRecognizing ? '正在识别,请稍候' : '正在为您整理'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -159,16 +167,13 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 输入区:文字输入 + 语音 + 发送。
|
||||
语音与发送在输入框右侧组成一条竖排控制,同宽同高、共用外框、同色图标
|
||||
(未触发时都是暖灰 --muted,只有录音/可发时才翻成实心橙 + 白图标);
|
||||
两个输入动作收成一列;语音识别结果实时回填到这里,结束时直接发送,
|
||||
手动输入仍走发送键 -->
|
||||
<!-- 一个完整输入面板:上方文字,下方输入方式与发送;保留原录音发送逻辑。 -->
|
||||
<view class="composer">
|
||||
<view class="input-area">
|
||||
<textarea
|
||||
class="message-input {{recording || isRecognizing ? 'is-readonly' : ''}}"
|
||||
value="{{inputValue}}"
|
||||
placeholder="请输入您的问题..."
|
||||
placeholder="说说您的问题或需要…"
|
||||
placeholder-class="input-placeholder"
|
||||
auto-height
|
||||
maxlength="-1"
|
||||
@@ -179,62 +184,50 @@
|
||||
bindconfirm="sendMessage"
|
||||
focus="{{inputFocus}}"
|
||||
/>
|
||||
<view class="action-group {{recording ? 'is-recording' : ''}}">
|
||||
</view>
|
||||
<view class="composer-actions">
|
||||
<view class="input-tools">
|
||||
<view class="input-tool {{recording ? 'is-recording' : ''}}" bindtap="onMicTap" aria-role="button" aria-label="{{recording ? '结束并发送语音' : '语音输入'}}">
|
||||
<t-icon name="microphone" size="34rpx" color="{{recording ? '#9B4508' : '#6F655C'}}" />
|
||||
<text>{{recording ? '结束' : '语音'}}</text>
|
||||
</view>
|
||||
<view class="input-tool" bindtap="onImageTap" aria-role="button" aria-label="拍照或选择图片">
|
||||
<t-icon name="image" size="34rpx" color="#6F655C" />
|
||||
<text>图片</text>
|
||||
</view>
|
||||
<!-- 更多:常见问题与清空聊天收进同一入口,输入区不再为低频动作单占一行 -->
|
||||
<view class="input-tool {{showMoreMenu ? 'is-open' : ''}}" bindtap="toggleMoreMenu" aria-role="button" aria-label="更多功能" aria-expanded="{{showMoreMenu}}">
|
||||
<view class="more-dots" aria-hidden="true">
|
||||
<view class="more-dot"></view>
|
||||
<view class="more-dot"></view>
|
||||
<view class="more-dot"></view>
|
||||
</view>
|
||||
<text>更多</text>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="action-btn send-btn {{inputValue && !isRecognizing ? 'active' : ''}}"
|
||||
class="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'}}" />
|
||||
<text>发送</text>
|
||||
<t-icon name="chevron-right" size="30rpx" 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 class="more-mask" wx:if="{{showMoreMenu}}" bindtap="onCloseMoreMenu" aria-hidden="true"></view>
|
||||
<view class="more-menu" wx:if="{{showMoreMenu}}" aria-role="menu">
|
||||
<view class="more-item" bindtap="onMoreQuickQuestions" aria-role="menuitem">
|
||||
<t-icon name="help-circle" size="30rpx" color="#6F655C" />
|
||||
<text class="more-item-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 class="more-divider" wx:if="{{messages.length}}"></view>
|
||||
<view class="more-item more-item-muted" wx:if="{{messages.length}}" bindtap="onMoreClearChat" aria-role="menuitem">
|
||||
<t-icon name="delete" size="30rpx" color="#6F655C" />
|
||||
<text class="more-item-text">清空聊天记录</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user