diff --git a/.env.development b/.env.development index 93437482..f620d0e7 100644 --- a/.env.development +++ b/.env.development @@ -5,7 +5,7 @@ ENV = 'development' #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:7002' # DEV diff --git a/src/components/touch-btn/touch-btn.vue b/src/components/touch-btn/touch-btn.vue index 3d10a444..cd4b4857 100644 --- a/src/components/touch-btn/touch-btn.vue +++ b/src/components/touch-btn/touch-btn.vue @@ -59,7 +59,7 @@ - + - + 取消 @@ -127,14 +127,6 @@ const voice_to_text_status = ref('init'); const popupRef = ref(null); const props = defineProps({ - // mode控制功能模式 - mode: { - type: String, - default: 'text-only', - validator: (value: string) => { - return ['voice-only', 'text-only', 'both'].includes(value); - } - }, isDisabled: { default: false, type: Boolean @@ -168,8 +160,24 @@ // 最小录音间隔 type: Number, default: 1000 + }, + answerMethod:{ + type: String, + default: '01', + validator: (value: string) => { + /* '01': '不限制回答方式', '02': '仅文字回答', '03': '仅语音回答'*/ + return ['01', '02', '03'].includes(value); + } } }); + const workMode = computed(() => { + const modeMap = { + '01': 'both', + '02': 'text-only', + '03': 'voice-only' + }; + return modeMap[props.answerMethod] || 'both'; + }); const textAreaText = computed({ get() { return allText.value + tempText.value; @@ -184,7 +192,7 @@ (isOutStatus.value === '03' || status.value === 'voice_to_text' || status.value === 'send_over') && classes.push('is-translate'); // 仅语音模式,01松手后要和03操作一样 - // isOutStatus.value === '01' && props.mode === 'text-only' && status.value == 'voice_to_text' && classes.push('is-translate'); + // isOutStatus.value === '01' && workMode.value === 'text-only' && status.value == 'voice_to_text' && classes.push('is-translate'); voice_to_text_status.value !== '' && classes.push(voice_to_text_status.value); return classes; }); @@ -202,8 +210,8 @@ const recordStartTime = ref(0); // 录音开始时间戳 const pressTimer = ref(null); // 计算属性:判断是否仅语音/仅文字模式(简化模板逻辑) - const isVoiceOnlyMode = computed(() => props.mode === 'voice-only'); - const isTextOnlyMode = computed(() => props.mode === 'text-only'); + const isVoiceOnlyMode = computed(() => workMode.value === 'voice-only'); + const isTextOnlyMode = computed(() => workMode.value === 'text-only'); const talkRightIcon = computed(() => { if (isInputVisible.value) return TouchBtnImages.icKeyboardSvg(); if (inputText.value) return TouchBtnImages.iconSendSvg(); @@ -214,7 +222,7 @@ const { y: touchY, x: touchX } = touchPos; if (touchY >= bottomAreaTopBoundary) return '01'; // 仅语音模式只能返回取消(02) - if (props.mode === 'voice-only') return '02'; + if (workMode.value === 'voice-only') return '02'; return touchX < horizontalSplitX ? '02' : '03'; }); // 监听按下移动 @@ -284,7 +292,7 @@ text = controlBody.txt.trim(); } const _isOutStatus = - props.mode === 'text-only' && isOutStatus.value === '01' ? '03' : isOutStatus.value; + workMode.value === 'text-only' && isOutStatus.value === '01' ? '03' : isOutStatus.value; // 只有模式为01的时候才发送出去 if (_isOutStatus === '01') { emit('submitVoice', { ossKey, text, recordId: recordId.value }); @@ -341,7 +349,7 @@ const stopRecord = async (errrStatus = '') => { clearTimeout(pressTimer.value); if (!isRecording.value) return; // 未处于录音状态 - const _isOutStatus = props.mode === 'text-only' && isOutStatus.value === '01' ? '03' : isOutStatus.value; + const _isOutStatus = workMode.value === 'text-only' && isOutStatus.value === '01' ? '03' : isOutStatus.value; console.log('_isOutStatus', _isOutStatus); // 拖动到转文字按钮上抬手或者仅文字模式的发送也强行算他转文字 if (_isOutStatus === '03') { @@ -407,7 +415,7 @@ if (voiceTimer) clearTimeout(voiceTimer); voiceTimer = setTimeout(() => { voiceTimer = null; - if (props.mode === 'voice-only') { + if (workMode.value === 'voice-only') { if (status.value === 'send_over') return; status.value = 'send_over'; // 恢复成默认状态 emit('submitVoice', { ossKey: '', text: '', recordId: recordId.value }); diff --git a/src/pages/practice/index.vue b/src/pages/practice/index.vue index 6e9745f3..b2ab1c49 100644 --- a/src/pages/practice/index.vue +++ b/src/pages/practice/index.vue @@ -67,7 +67,7 @@ - + /> --> - + /> @@ -123,7 +123,7 @@ import Subject from '@/components/examination/subject.vue'; import CharactersSubject from '@/components/examination/characters-subject.vue'; // import TouchBtn from '@/components/examination/touchBtn.vue'; - import TouchBtn from '@/pages/course/components/touchBtn.vue'; + // import TouchBtn from '@/pages/course/components/touchBtn.vue'; import TouchBtnOnlyVoice from '@/pages/course/components/touchBtnOnlyVoice.vue'; import common from '@/common/common'; import { setPageCache, formatSeconds, getPageCache, setupKeyboardHeightListener } from '@/common/common';