diff --git a/.env.development b/.env.development index fe9b88ca..93437482 100644 --- a/.env.development +++ b/.env.development @@ -2,19 +2,12 @@ ENV = 'development' # 'development' +#VITE_APP_BASE_API_Url = 'https://aits.jlbank.com.cn:7001' -# VITE_APP_BASE_API_Url = 'https://aits.jlbank.com.cn:7001' +VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001' -#VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001' - -VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' -# VITE_APP_BASE_API_Url = 'http://192.168.247.200' -# VITE_APP_BASE_API_Url = 'http://aitscdn.jlbank.com.cn:7001' -# VITE_APP_BASE_API_Url = 'http://192.168.108.129' -# dev - # DEV #VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001' diff --git a/src/common/common.js b/src/common/common.js index 73107d3d..d9ec4948 100644 --- a/src/common/common.js +++ b/src/common/common.js @@ -335,17 +335,17 @@ export function setupKeyboardHeightListener(updateCallback) { const handleKeyboardHeightChange = (res) => { // 获取系统信息 const systemInfo = uni.getSystemInfoSync(); - console.log('systemInfo', systemInfo); + // console.log('systemInfo', systemInfo); // 计算安全区域底部高度 const safeAreaBottomHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom; - console.log('计算安全区域底部高度', safeAreaBottomHeight); + // console.log('计算安全区域底部高度', safeAreaBottomHeight); let keyboardHeight = res.height; - console.log('软键盘高度', keyboardHeight); + // console.log('软键盘高度', keyboardHeight); // 仅在iOS端补偿安全区域高度 if (systemInfo.platform === 'ios') { keyboardHeight = Math.max(0, keyboardHeight); // 避免负数 } - console.log('keyboardHeight', keyboardHeight); + // console.log('keyboardHeight', keyboardHeight); // 通过回调函数更新外部的响应式变量 updateCallback(keyboardHeight); }; diff --git a/src/common/ProtocolCodec.ts b/src/common/protocolCodec.ts similarity index 100% rename from src/common/ProtocolCodec.ts rename to src/common/protocolCodec.ts diff --git a/src/components/examination/question.vue b/src/components/examination/question.vue index a9ab2d4a..fe340a49 100644 --- a/src/components/examination/question.vue +++ b/src/components/examination/question.vue @@ -169,7 +169,7 @@ setTimeout(() => { textShow.value = true; textLoading.value = false; - }, 500); + }, 400); } else { textShow.value = false; } @@ -222,7 +222,7 @@ console.log('加载声音', props.dataInfo); if (newVal === '' && props.dataInfo.ossKey) { // 去下载oss内容 - console.log('真下载oss内容'); + console.log('真下载oss内容', props.dataInfo.ossKey); downloadFile(props.dataInfo.ossKey).then((res) => { voiceTime.value = ''; innerAudio.setAudioSrc(res.tempFilePath); @@ -236,6 +236,22 @@ }, { immediate: true } ); + watch( + () => props.dataInfo.ossKey, + (newVal) => { + if (props.dataInfo.voicePath === undefined && props.dataInfo.ossKey) { + console.log('真下载oss内容', props.dataInfo.ossKey); + downloadFile(props.dataInfo.ossKey).then((res) => { + voiceTime.value = ''; + props.dataInfo.voicePath = res.tempFilePath; + innerAudio.setAudioSrc(res.tempFilePath); + }); + } else if (newVal === undefined) { + innerAudio.stopAudio(); + } + }, + { immediate: true } + ); }); onUnload(() => { // 1. 停止当前播放(优先处理,避免音频继续播放) diff --git a/src/components/touch-btn/style/popup.scss b/src/components/touch-btn/style/popup.scss index e21164c4..1e65e767 100644 --- a/src/components/touch-btn/style/popup.scss +++ b/src/components/touch-btn/style/popup.scss @@ -51,7 +51,7 @@ position: absolute; width: 100%; bottom: 0; - &.voice_to_text { + &.voice_to_text,&.send_over { .btn-box-1 { animation: moveLeftOut 0.3s ease-out forwards; } @@ -61,6 +61,7 @@ .circle-bg-box { animation: moveBottomOut 0.3s ease-out forwards; } + } // 仅语音 &.voice-only { @@ -138,11 +139,15 @@ bottom: 0; opacity: 0; visibility: hidden; // 初始不可见且不占交互位置 - &.voice_to_text { + &.voice_to_text,&.send_over { display: flex !important; visibility: visible; // 激活后可见 animation: fadeIn 0.4s ease-out 0.1s forwards; } + // 仅文字模式,隐藏发送原语音按钮 + &.text-only>.trans-btn{ + visibility: hidden; + } .transVoiceIng { width: 154rpx; height: 154rpx; @@ -189,15 +194,19 @@ display: none; } } - &.init > .send-btn > .send-btn-loading { - display: block !important; + &.init > .send-btn { pointer-events: none; cursor: not-allowed; + .send-btn-loading { + display: block !important; + pointer-events: none; + cursor: not-allowed; + } } &.success > .send-btn > .send-btn-text { display: block !important; } - &.failed .send-btn { + &.failed .send-btn,&.networkError .send-btn { pointer-events: none; cursor: not-allowed; background-color: rgb(80, 80, 80); @@ -254,7 +263,7 @@ left: 78% !important; } - &.failed { + &.failed,&.networkError { width: 506rpx; height: 114rpx; min-height: 114rpx; @@ -269,7 +278,11 @@ // animation: fadeIn 0.4s ease-out 0.1s forwards; } .textarea { - // display: none; + visibility: hidden; // 初始不可见且不占交互位置 + } + } + &.init{ + .textarea { visibility: hidden; // 初始不可见且不占交互位置 } } diff --git a/src/components/touch-btn/touch-btn.images.ts b/src/components/touch-btn/touch-btn.images.ts index c6f901a8..d59e587e 100644 --- a/src/components/touch-btn/touch-btn.images.ts +++ b/src/components/touch-btn/touch-btn.images.ts @@ -17,7 +17,7 @@ export const icKeyboardSvg = () : string => { }; export const iconMicSvg = () : string => { const svgXml = ` - + `; return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgXml)}`; }; diff --git a/src/components/touch-btn/touch-btn.types.ts b/src/components/touch-btn/touch-btn.types.ts index 7db8a762..4f1940b3 100644 --- a/src/components/touch-btn/touch-btn.types.ts +++ b/src/components/touch-btn/touch-btn.types.ts @@ -5,8 +5,9 @@ * - 'voice_recording' : 录音中状态(语音录制面板展开,正在录音) * - 'text_input' : 文字输入中状态(文字输入面板展开,用户正在输入) * - 'voice_to_text' : 语音转文字状态(独立的语音转文字页面/面板展开) + * - 'send_over' : 发送完成 */ -export type StatusType = 'default' | 'voice_recording' | 'text_input' | 'voice_to_text' | 'voice_send_ing'; +export type StatusType = 'default' | 'voice_recording' | 'text_input' | 'voice_to_text' | 'voice_send_ing' | 'send_over'; /** * 语音转文字的子状态(仅当主状态为 voice_to_text 时生效) @@ -16,7 +17,8 @@ export type VoiceToTextSubStatus = | 'init' // 初始化(刚进入语音转文字页面) // | 'loading' // 转换中(正在处理语音→文字) | 'success' // 转换完成(成功得到文字结果) - | 'failed'; // 转换失败(网络/识别错误等) + | 'failed' // 转换失败(网络/识别错误等) + | 'networkError'; // 转换失败(网络错误等) /** 错误码枚举 - 直接映射提示文本 */ @@ -33,6 +35,7 @@ export interface ShowErrorTipOptions { delayTime?: number; } +type ChangeBtnCallback = () => void; /** * 触摸按钮组件的自定义事件类型定义 @@ -44,13 +47,13 @@ export type TouchBtnEmits = { * @param voiceData - 语音相关数据(包含ossKey、识别文本等核心字段) * @param duration - 录音时长(单位:毫秒),用于校验最短录音时长 */ - submitVoice: [params: { ossKey: string; text: string }]; + submitVoice: [params: { ossKey: string; text: string, recordId:string }]; /** * 提交文字答案(用户确认识别结果/手动编辑后触发) * @param answerText - 最终提交的文字答案内容 - * @param isManualEdit - 是否手动编辑过识别结果(true=手动修改,false=纯语音识别) + * @param changeBtn - 按钮状态变更的回调函数 */ - submitAnswer: [answerText: string, isManualEdit: boolean]; + submitAnswer: [answerText: string, changeBtn: ChangeBtnCallback]; /** * 开始录音(用户点击录音按钮时触发) * @param recordParams - 录音初始化参数(可选,默认使用组件内置配置) diff --git a/src/components/touch-btn/touch-btn.vue b/src/components/touch-btn/touch-btn.vue index cfd17f89..3d10a444 100644 --- a/src/components/touch-btn/touch-btn.vue +++ b/src/components/touch-btn/touch-btn.vue @@ -1,52 +1,85 @@ \ No newline at end of file + diff --git a/src/pages/index/dialog.vue b/src/pages/index/dialog.vue index 03f220d3..3e8c9059 100644 --- a/src/pages/index/dialog.vue +++ b/src/pages/index/dialog.vue @@ -3,17 +3,31 @@ - + AI问答 内容由AI生成 - - - + + 历史 消息 @@ -65,18 +79,28 @@ --> - - + + {{ item }} - @@ -111,18 +135,25 @@ - - - + - + @@ -133,51 +164,20 @@