diff --git a/.env.development b/.env.development index db90fd74..70d0ab7c 100644 --- a/.env.development +++ b/.env.development @@ -24,16 +24,16 @@ VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' # dev -# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7002' +# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001' # sit -# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.92:9786' +VITE_APP_BASE_H5_API_Url = 'http://25.18.122.92:9786' # UAT # VITE_APP_BASE_H5_API_Url = 'http://25.18.122.78:9786' # 任东 # VITE_APP_BASE_H5_API_Url_TRAAPP = 'http://25.64.16.130:9601' -# VITE_APP_BASE_H5_API_Url_TRASTUDY = 'http://25.64.16.130:9602' +VITE_APP_BASE_H5_API_Url_TRASTUDY = 'http://25.64.16.130:9602' # VITE_APP_BASE_H5_API_Url_TRAEXAM = 'http://25.64.16.140:9604' # 张建成 diff --git a/src/api/common.js b/src/api/common.js index 3fd4c96e..6b581b7d 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -86,22 +86,24 @@ export const commonUploadVoiceFile = (file, url, data = {}, fileKey = 'voice') = filePath: file, name: fileKey, formData: data, + timeout: 6000, success(result) { try { const res = JSON.parse(result.data); if (res.rtnCode === '0000') { - resolve(result); + return resolve(result); } else if (REQUES_ERROR_CODES['NO_LOGIN'].includes(res.rtnCode)) { goto_login_fun() - } else { - reject(new Error(res.message)); + return reject('NO_LOGIN'); } + return reject('Other'); } catch (error) { reject(new Error('Failed to parse response')); } }, fail(error) { - reject(new Error('Upload failed')); + console.log('err', error); + return reject('Other'); } }); }); diff --git a/src/components/examination/question.vue b/src/components/examination/question.vue index 2d8693d3..678d4a7a 100644 --- a/src/components/examination/question.vue +++ b/src/components/examination/question.vue @@ -81,9 +81,9 @@ import { computed, unref, ref, toRefs, watch, onMounted, nextTick } from 'vue'; import { onUnload } from '@dcloudio/uni-app'; // import { useinnerAudio, useAudioFun } from '@/store/innerAudio'; - + import { useAudio } from './useAudio.js'; - import {downloadFile} from '@/api/common.js' + import { downloadFile } from '@/api/common.js'; const props = defineProps({ dataInfo: { default: () => ({}), @@ -128,7 +128,7 @@ }); const innerAudio = useAudio(); - + const status = computed(() => props.status); watch( () => props.status, @@ -157,6 +157,9 @@ nextTick(() => { textShow.value = true; }); + setTimeout(() => { + voiceTime.value = ''; + }, 0); } emit('buutton_click', type, props.dataInfo); }; @@ -173,7 +176,7 @@ textShow.value = false; } }; - + const playVoice = () => { // isPlaying.value = true; console.log('点击播放'); @@ -206,20 +209,22 @@ // 赋值显示 console.log('displayTime', displayTime); voiceTime.value = displayTime + 's'; - console.log('displayTime', voiceTime.value); }); watch( () => props.dataInfo.voicePath, (newVal) => { - console.log('newVal', newVal); - if(newVal === '' && props.dataInfo.ossKey) { // 去下载oss内容 + + if (newVal === '' && props.dataInfo.ossKey) { + // 去下载oss内容 console.log('去下载oss内容'); - downloadFile(props.dataInfo.ossKey).then(res => { + downloadFile(props.dataInfo.ossKey).then((res) => { + voiceTime.value = ''; innerAudio.setAudioSrc(res.tempFilePath); - }) - } else if(newVal === undefined){ + }); + } else if (newVal === undefined) { innerAudio.stopAudio(); } else { + voiceTime.value = ''; innerAudio.setAudioSrc(newVal); } }, diff --git a/src/components/examination/touchBtn.vue b/src/components/examination/touchBtn.vue index 63ae6fd5..8be65c9f 100644 --- a/src/components/examination/touchBtn.vue +++ b/src/components/examination/touchBtn.vue @@ -148,6 +148,7 @@ }; // 结束录音 const stopRecord = (status = false) => { + console.log('结束录音stopRecord', status); if (props.isDisabled) return; if (startTimer.value) { clearTimeout(startTimer.value); @@ -162,10 +163,12 @@ const times = Math.max(500 - endTime + startTime, 0); setTimeout(() => { console.log('延迟数据', times); - nextTick(() => { - popupRef.value.close(); - recorderManager.stop(); - }); + // nextTick(() => { + + // }); + popupRef.value.close(); + console.log('停止录音'); + recorderManager.stop(); }, times); } nextTick(() => (recordingStatus.value = 'not_started')); @@ -181,13 +184,18 @@ console.log('说话时长', recordDuration); if (props.minRecordDuration > recordDuration) { nextTick(() => common.msg('说话时间太短,没有听清!')); + // console.log('说话时间太短,没有听清'); return; } - - stopRecord(true); // 在去主动执行一次关闭 + popupRef.value?.close(); + recordingStatus.value = 'not_started' + // stopRecord(true); // 在去主动执行一次关闭 console.log('录音结束,时长:', recordDuration, '秒'); emit('submit', 'voice', res.tempFilePath); }); + recorderManager.onError(function (err) { + console.log('录音错误', err); + }); recorderManager.onStart(function (res) { // 检测是否已经抬手结束了 console.log('检测是否已经抬手结束了', recordingStatus.value); diff --git a/src/enum.js b/src/enum.js index 117cf9cf..7ec50154 100644 --- a/src/enum.js +++ b/src/enum.js @@ -31,4 +31,5 @@ export const SUBJECT_TYPE = [{ value: "ES", label: "问答题", } -] \ No newline at end of file +] +export const defaultAvatar = '/static/images/me/default_user_avatar.png' \ No newline at end of file diff --git a/src/pages/course/components/talkingItem.vue b/src/pages/course/components/talkingItem.vue index d304916f..f5f1a5b1 100644 --- a/src/pages/course/components/talkingItem.vue +++ b/src/pages/course/components/talkingItem.vue @@ -10,943 +10,1074 @@ 8 问题反馈信息 9 已学完当前知识点反馈信息 --> -