diff --git a/miniprogram/pages/qa_exercise/qa_exercise.ts b/miniprogram/pages/qa_exercise/qa_exercise.ts index 329364d..f36378e 100644 --- a/miniprogram/pages/qa_exercise/qa_exercise.ts +++ b/miniprogram/pages/qa_exercise/qa_exercise.ts @@ -136,6 +136,7 @@ interface IData { chatSuggestions: Array<{ label: string; text: string }> inputBottom: number isRecording: boolean + isMicrophoneMode: boolean } interface IPageInstance { @@ -233,6 +234,8 @@ interface IPageInstance { onSendMessage: (e: any) => void onChatInput: (e: any) => void onChatBlur: (e: any) => void + switchToVoiceMode: () => void + switchToTextMode: () => void onChatCloseTap: (e: any) => void updateConversationMessages: (detail: any, lang: string, append?: boolean) => void showChatInput: () => void @@ -264,6 +267,7 @@ Page({ clozeSentenceTokens: [], modeAnim: '', isChatInputVisible: false, + isMicrophoneMode: false, scrollIntoView: '', isModeSwitching: false, progressText: '', @@ -2087,7 +2091,9 @@ Page({ onChatBlur(e: any) { if (this.isSuggestionTouching) return this.stopSuggestionTimer() - this.setData({ isChatInputVisible: false, scrollIntoView: '', chatPlaceholder: '请输入...' }) + // 移除自动隐藏逻辑,保留输入框 + // this.setData({ isChatInputVisible: false, scrollIntoView: '', chatPlaceholder: '请输入...' }) + this.setData({ scrollIntoView: '', chatPlaceholder: '请输入...' }) if (this.placeholderTimer) { clearTimeout(this.placeholderTimer) this.placeholderTimer = undefined @@ -2097,6 +2103,14 @@ Page({ }, 300) }, + switchToVoiceMode() { + this.setData({ isMicrophoneMode: true, isChatInputVisible: true }) + }, + + switchToTextMode() { + this.setData({ isMicrophoneMode: false, isChatInputVisible: true }) + }, + showChatInput() { if (!this.data.conversationLatestSession || this.data.conversationViewMode === 'setup') { return diff --git a/miniprogram/pages/qa_exercise/qa_exercise.wxml b/miniprogram/pages/qa_exercise/qa_exercise.wxml index d116edd..da62ff3 100644 --- a/miniprogram/pages/qa_exercise/qa_exercise.wxml +++ b/miniprogram/pages/qa_exercise/qa_exercise.wxml @@ -14,7 +14,7 @@ 填空 问答 - 识图 + 对话 @@ -24,7 +24,7 @@ - + @@ -330,7 +330,7 @@ @@ -340,6 +340,7 @@ - + - - - + + + + + + + + {{isRecording ? '松开发送' : '按住说话'}} + + + + + + + - + diff --git a/miniprogram/pages/qa_exercise/qa_exercise.wxss b/miniprogram/pages/qa_exercise/qa_exercise.wxss index 5c7ec46..de133d1 100644 --- a/miniprogram/pages/qa_exercise/qa_exercise.wxss +++ b/miniprogram/pages/qa_exercise/qa_exercise.wxss @@ -925,3 +925,43 @@ .microphone-bar:nth-child(8) { left: 198rpx; animation-duration: 419ms; } .microphone-bar:nth-child(9) { left: 226rpx; animation-duration: 487ms; } .microphone-bar:nth-child(10) { left: 254rpx; animation-duration: 442ms; } + +.voice-mode-panel { + background: #fff; + padding: 24rpx; + border-top: 1rpx solid #eee; + padding-bottom: calc(24rpx + env(safe-area-inset-bottom)); + width: 100%; + box-sizing: border-box; +} + +.voice-panel-controls { + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 32rpx; + gap: 32rpx; +} + +.microphone-btn { + flex: 1; + height: 88rpx; + background: #f2f3f5; + border-radius: 12rpx; + display: flex; + align-items: center; + justify-content: center; + color: #333; + font-size: 32rpx; + font-weight: 600; + transition: all 0.2s; +} + +.microphone-btn:active, .microphone-btn.recording { + background: #e5e6eb; +} + +.microphone-btn.recording { + background: #d54941; + color: #fff; +}