diff --git a/.env.development b/.env.development index f235ef78..e1778666 100644 --- a/.env.development +++ b/.env.development @@ -7,6 +7,7 @@ ENV = 'development' 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' @@ -15,7 +16,8 @@ VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001' #VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001' # sit -#VITE_APP_BASE_API_Url = 'http://25.18.122.91:9786' +# VITE_APP_BASE_API_Url = 'http://25.18.122.91:9786' + # UAT # VITE_APP_BASE_API_Url = 'http://25.18.122.78:9786' diff --git a/.env.development.yh b/.env.development.yh index 193ce295..2b8b529b 100644 --- a/.env.development.yh +++ b/.env.development.yh @@ -2,9 +2,9 @@ ENV = 'development.yh' # 'development.yh' -# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001' +VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001' -VITE_APP_BASE_H5_API_Url = 'http://25.18.122.91:9786' +# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.91:9786' # VITE_APP_BASE_H5_API_Url = 'http://25.18.122.78:9786' # VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' # VITE_APP_BASE_H5_API_Url_TRAEXAM = 'http://25.64.32.154:9604' diff --git a/src/App.vue b/src/App.vue index 63d8cafc..5b1d72d2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -7,6 +7,9 @@ animationType: 'slide-in-bottom' }); }); + //#ifdef APP-PLUS + plus.screen.lockOrientation('portrait-primary') + // #endif }, onShow: function () { diff --git a/src/api/socket.js b/src/api/socket.js index 0869f8d8..2b304f90 100644 --- a/src/api/socket.js +++ b/src/api/socket.js @@ -86,7 +86,7 @@ export default class WebSocketUtil { // console.log('WebSocket连接已关闭', res); clearInterval(this.heartbeatTimer); // 清除心跳计时器 this.triggerEvent('close', res); // 触发连接关闭事件 - this.tryReconnect(); // 尝试重连 + // this.tryReconnect(); // 尝试重连 }); // 监听WebSocket错误事件 @@ -106,7 +106,7 @@ export default class WebSocketUtil { */ on(event, callback) { if (this.callbacks[event]) { - this.callbacks[event].push(callback); + this.callbacks[event] = [callback]; } return this; } diff --git a/src/components/markdown-preview/markdown-preview.vue b/src/components/markdown-preview/markdown-preview.vue index 0ce9ed50..27615aff 100644 --- a/src/components/markdown-preview/markdown-preview.vue +++ b/src/components/markdown-preview/markdown-preview.vue @@ -24,7 +24,8 @@ watch:{ mdString: { handler(val){ - this.contentHtml = this.parseContent(val) + let _text = val.replace(//g,'>') + this.contentHtml = this.parseContent(_text) }, deep: true, immediate: true diff --git a/src/pages.json b/src/pages.json index 68ecbebe..690c2981 100644 --- a/src/pages.json +++ b/src/pages.json @@ -590,6 +590,7 @@ "navigationBarBackgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8", "navigationStyle": "custom", + "screenOrientation": "portrait", "app-plus": { "titleView": false, "bounce": "none", diff --git a/src/pages/analytics/study.vue b/src/pages/analytics/study.vue index 42a3cf6f..64a62a9a 100644 --- a/src/pages/analytics/study.vue +++ b/src/pages/analytics/study.vue @@ -107,36 +107,36 @@ - + - + {{item.title}} {{item.content}} - + - + {{item.title}} {{item.content}} - + - + {{suggestObj.content}} - + - + 暂无数据 @@ -225,26 +225,45 @@ } } const loading = ref(false) + const loading1 = ref(false) + const loading2 = ref(false) + const loading3 = ref(false) + const loading4 = ref(false) const getInfoNow = async (params) => { loading.value = true - try { - let _res1 = await queryStudyStatistics(params) + loading2.value = true + loading1.value = true + loading3.value = true + queryStudyStatistics(params).then(_res1 => { statisticsObj.value = { ..._res1.body } - let _res2 = await queryDimesionInfo(params) + loading.value = false + }).catch(() => { + loading.value = false + }) + queryDimesionInfo(params).then(_res2 => { dimesionList.value = [..._res2.body] - let _res3 = await queryHabitInfo(params) + loading1.value = false + }).catch(() => { + loading1.value = false + }) + queryHabitInfo(params).then(_res3 => { studyList.value = [..._res3.body] - let _res4 = await querySuggestInfo(params) + loading2.value = false + }).catch(() => { + loading2.value = false + }) + querySuggestInfo(params).then(_res4 => { if (_res4.body && _res4.body.length > 0) { suggestObj.value = { ..._res4.body[0] } } - } catch {} finally { - loading.value = false - } + loading3.value = false + }).catch(() => { + loading3.value = false + }) } // 跳转 课程详情 const toCourseDetail = item => { @@ -263,9 +282,12 @@ } const getCrsListNow = () => { + loading4.value = true queryRecmdCrsInfo().then(res => { - console.log(res) courseList.value = res.body || [] + loading4.value = false + }).catch(() => { + loading4.value = false }) } onMounted(() => { @@ -377,8 +399,9 @@ backdrop-filter: blur(10rpx); z-index: 1; - &.loading-box-cont{ + &.loading-box-cont { background: #ddeafa; + &::before { content: ''; display: block; diff --git a/src/pages/course/components/talkingItem.vue b/src/pages/course/components/talkingItem.vue index 5cced8fb..b5899afa 100644 --- a/src/pages/course/components/talkingItem.vue +++ b/src/pages/course/components/talkingItem.vue @@ -694,7 +694,7 @@ voiceTime.value = (Math.ceil(talkVoiceObj.value.duration) || 0) + 's'; } else { if (sum === 100) { - voiceTime.value = 0 + 's'; + voiceTime.value = (unref(dataInfo).voiceTime || 0) + 's'; return; } setTimeout(() => { diff --git a/src/pages/course/components/touchBtn.vue b/src/pages/course/components/touchBtn.vue index 3d1a24b3..3bd0a45c 100644 --- a/src/pages/course/components/touchBtn.vue +++ b/src/pages/course/components/touchBtn.vue @@ -174,6 +174,7 @@ const initRecord = () => { recordObjCom.value = uni.getRecorderManager(); unref(recordObjCom)?.onStop((res, duration) => { + isRecording.value = false if(isGettingPermission.value){ isGettingPermission.value = false return @@ -196,13 +197,20 @@ }); } else { closeModel(); - emit('uploadVoice', audioPath.value); + emit('uploadVoice', audioPath.value, recordTime.value); } } else { closeModel(); } }); unref(recordObjCom).onStart(() => { + isRecording.value = true + recordTime.value = 0 + setRecordTime() + if(isGettingPermission.value){ + isGettingPermission.value = false + return + } startFlag.value = 1; setTimeout(() => { startFlag.value = 2; @@ -219,6 +227,16 @@ } }); }; + const setRecordTime = () => { + setTimeout(()=>{ + if(isRecording.value){ + recordTime.value += 1 + setRecordTime() + } + },1000) + } + const isRecording = ref(false) + const recordTime = ref(0) const startFlag = ref(1); // const canStart = ref(true) const startRecord = () => { diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue index 9413450c..62073b71 100644 --- a/src/pages/course/study.vue +++ b/src/pages/course/study.vue @@ -839,7 +839,7 @@ const testAnswer = computed(() => { let _num = _arr.map(t => [1, 2, 6].indexOf(Number(t.type)) >= 0).filter(t => !!t) return _num.length < 5 }) -const uploadRecordNow = voicePath => { +const uploadRecordNow = (voicePath, voiceTime) => { if (!testAnswer.value) { common.msg('每个问题最多连续发送五次答案!') return @@ -911,7 +911,8 @@ const uploadRecordNow = voicePath => { userInfo: { ...choiceTeacherInfo.value }, - id: _id + id: _id, + voiceTime: voiceTime } } else { return t diff --git a/src/pages/index/components/question.vue b/src/pages/index/components/question.vue index d8623d81..1d59196a 100644 --- a/src/pages/index/components/question.vue +++ b/src/pages/index/components/question.vue @@ -131,7 +131,7 @@ import { onUnload } from '@dcloudio/uni-app'; voiceTime.value = (Math.ceil(talkVoiceObj.value.duration) || 1 ) + 's' }else{ if(sum === 20) { - voiceTime.value = 0 + 's' + voiceTime.value = (unref(dataInfo).voiceTime || 0) + 's'; return } setTimeout(()=>{ diff --git a/src/pages/index/dialog.vue b/src/pages/index/dialog.vue index 4d0f6bc4..5c60a1ab 100644 --- a/src/pages/index/dialog.vue +++ b/src/pages/index/dialog.vue @@ -662,7 +662,7 @@ submitAnswerNow(item); }; // 发送语音 - const uploadRecordNow = (voicePath) => { + const uploadRecordNow = (voicePath, voiceTime) => { // /traask/traAskchat/voiceTrans //#ifndef APP-PLUS // h5 假数据 @@ -683,7 +683,8 @@ intrctContent: _res.body.transContent, bucketKey: _res.body.fileId, ossFileAddr: _res.body.ossFileAddr, - talkingVoice: voicePath + talkingVoice: voicePath, + voiceTime: voiceTime }; sendMessage({ commond: 'ASK', @@ -791,6 +792,9 @@ initsocketTask(); }; onLoad(() => { + //#ifdef APP-PLUS + plus.screen.lockOrientation('portrait-primary') + // #endif changeAppHeightBottom(); if (!common.isLogin()) { common.navigateTo('/pages/login/login'); diff --git a/src/pages/sparring/components/question.vue b/src/pages/sparring/components/question.vue index d9b1e7d4..05f34268 100644 --- a/src/pages/sparring/components/question.vue +++ b/src/pages/sparring/components/question.vue @@ -130,8 +130,12 @@ talkUserVoiceObj.value.onError(() => { talkUserVoiceObj.value.src = '' }) + talkUserVoiceObj.value.onCanplay(() => { + setVoiceTime(0) + }) itemVoice.value = unref(dataInfo).talkingVoice talkUserVoiceObj.value.src = itemVoice.value + talkUserVoiceObj.value.sessionCategory = 'soloAmbient' //#ifdef APP-PLUS // 安卓端 须播放一次,不然再次播放会没有声音 if (IsAndEnv) { @@ -141,9 +145,9 @@ // talkUserVoiceObj.value.pause() } // #endif - setTimeout(() => { - setVoiceTime(0) - }, 100) + // setTimeout(() => { + // setVoiceTime(0) + // }, 100) } const isTesting = ref(false) const setVoiceTime = (sum) => { @@ -152,7 +156,7 @@ voiceTime.value = (Math.ceil(talkUserVoiceObj.value.duration) || 1) + 's' } else { if (sum === 20) { - voiceTime.value = 0 + 's' + voiceTime.value = (props.dataInfo.voiceTime|| 0) + 's' return } setTimeout(() => { diff --git a/src/pages/sparring/components/talking-item.vue b/src/pages/sparring/components/talking-item.vue index bb5e1d5b..3a2ed46e 100644 --- a/src/pages/sparring/components/talking-item.vue +++ b/src/pages/sparring/components/talking-item.vue @@ -16,7 +16,7 @@ :isAnswering="props.isAnswering" @handleEvents="handleEvents" :activeVoiceId="activeVoiceId"> - + 回答提示 diff --git a/src/pages/sparring/components/touchBtn.vue b/src/pages/sparring/components/touchBtn.vue index dd26ed33..2598f6df 100644 --- a/src/pages/sparring/components/touchBtn.vue +++ b/src/pages/sparring/components/touchBtn.vue @@ -127,6 +127,7 @@ const initRecord = () => { recordObjCom.value = uni.getRecorderManager(); unref(recordObjCom)?.onStop((res, duration) => { + isRecording.value = false if(isGettingPermission.value){ isGettingPermission.value = false return @@ -141,13 +142,16 @@ }); } else { closeModel(); - emit('uploadVoice', audioPath.value); + emit('uploadVoice', audioPath.value, recordTime.value); } } else { closeModel(); } }); unref(recordObjCom).onStart(() => { + isRecording.value = true + recordTime.value = 0 + setRecordTime() if(isGettingPermission.value){ stopRecord(); return @@ -167,6 +171,16 @@ } }); }; + const setRecordTime = () => { + setTimeout(()=>{ + if(isRecording.value){ + recordTime.value += 1 + setRecordTime() + } + },1000) + } + const isRecording = ref(false) + const recordTime = ref(0) const startFlag = ref(1); const startRecord = () => { isStartNum.value += 1; diff --git a/src/pages/sparring/detail.vue b/src/pages/sparring/detail.vue index 1bb1291d..99726c28 100644 --- a/src/pages/sparring/detail.vue +++ b/src/pages/sparring/detail.vue @@ -18,7 +18,8 @@ 已陪练次数:{{ detailInfo.practiceTimes }} 类型:{{ detailInfo.traInterTypDesc }} - 截止时间:{{detailInfo.limitTyp === '01' ? '不限制' : detailInfo.endTm}} + 截止时间:{{detailInfo.limitTyp === '01' ? '不限制' : detailInfo.endTm}} + 通过分数:{{detailInfo.passGrade || 0}} 分 @@ -296,6 +297,9 @@ display: inline-block; width: 50%; margin-bottom: 15rpx; + &.full{ + width: 100%; + } } &-tags { diff --git a/src/pages/sparring/tip.vue b/src/pages/sparring/tip.vue index 3ccb5315..d4f484d1 100644 --- a/src/pages/sparring/tip.vue +++ b/src/pages/sparring/tip.vue @@ -104,6 +104,7 @@ onShow, onLoad, onUnload, + onLaunch, onBackPress } from '@dcloudio/uni-app'; import common from '@/common/common'; @@ -188,7 +189,7 @@ }, time); }); }; - const uploadRecordNow = (voicePath) => { + const uploadRecordNow = (voicePath, voiceTime) => { //#ifndef APP-PLUS // h5 假数据 // #endif @@ -199,6 +200,8 @@ isLoading: true }); scrollToBottomNow(); + // 设为提问中状态 + answerIsOver.value = false commonUploadVoiceFile(voicePath, '/trapractice/traPartnerChat/voiceTrans', {}) .then((_res) => { if (!!(_res.body.transContent || '').trim()) { @@ -208,13 +211,15 @@ intrctContent: _res.body.transContent, fileId: _res.body.fileId, ossFileAddr: _res.body.ossFileAddr, - talkingVoice: voicePath + talkingVoice: voicePath, + voiceTime: voiceTime }; sendMessage({ commond: 'ASK', body: askData.value }); } else { + answerIsOver.value = true talkingList.value.pop(); uni.showToast({ title: '未识别到文字', @@ -224,6 +229,7 @@ } }) .catch((err) => { + answerIsOver.value = true talkingList.value.pop(); uni.showToast({ title: '系统异常,请联系管理员', @@ -294,8 +300,10 @@ common .show('提示信息', '网络环境不稳定,请重试!', false, '', '确认') .then((res) => { - reconcatNum.value += 1; - common.redirectTo(`/pages/index/dialog`); + overNow(()=>{ + reconcatNum.value += 1; + common.redirectTo(`/pages/index/dialog`); + }) }) .finally(() => { showModelComfirm.value = false; @@ -310,6 +318,7 @@ let _id = new Date().getTime() + 'id'; if (rtnCode === '0000') { if (commond === 'ASK-OPEN') { + console.log('ASK-OPEN!', body) // 新连接 sendMessage({ commond: 'ASK-START', @@ -323,7 +332,7 @@ return; } if (commond === 'ASK-START') { - // console.log('开启对话!') + console.log('开启对话!', body) execId.value = body.execId; return; } @@ -332,7 +341,9 @@ console.log(body); console.log(talkingList.value[talkingList.value.length - 1].isLoading); if (talkingList.value.length > 0 && talkingList.value[talkingList.value.length - 1].isLoading) { - talkingList.value.pop(); + talkingList.value = talkingList.value.filter(t => { + return !(t.type === 'question' && t.isLoading) + }) } // seqNo.value = body.seqNo; // touchBtnCallBack.value && touchBtnCallBack.value(); @@ -367,7 +378,10 @@ if (body.event === 'start') { answerIsOver.value = false; answerText.value = ''; - talkingList.value.pop(); + // talkingList.value.pop(); + talkingList.value = talkingList.value.filter(t => { + return !(t.type === 'answer' && t.isLoading) + }) talkingList.value.push({ type: 'answer', talkingText: answerText.value, @@ -410,12 +424,12 @@ return; } if (commond === 'ASK-OVER') { - console.log(body ); + console.log(body); console.log('陪练已结束,去结果页面!'); - common.navigateTo('/pages/sparring/result?isOver=1&traId=' + traId.value - + '&execId=' + execId.value - + '&type=' + talkingType.value - + '&isPreview=' + (isPreview.value ? '1' : '')) + common.navigateTo('/pages/sparring/result?isOver=1&traId=' + traId.value + + '&execId=' + execId.value + + '&type=' + talkingType.value + + '&isPreview=' + (isPreview.value ? '1' : '')) return; } } else { @@ -436,28 +450,35 @@ const overTalking = () => { common.show('提示', '确定结束陪练吗?').then(res => { if (res) { - partnerChatReportTrigger({ - execId: execId.value, - traId: traId.value, - talkingType: isPreview.value ? 'preview' : 'practice' - }).then(res => { - watchFlag.value = 1; - sendMessage({ - commond: 'ASK-STOP', - body: { - execId: execId.value || '' - } - }) - socketStore?.closeSocket(); - changePlayItemId('') - common.navigateTo('/pages/sparring/result?isOver=1&traId=' + traId.value + '&execId=' + execId - .value + '&type=' + talkingType.value + '&isPreview=' + (isPreview.value ? '1' : '')) - // pointAndBadgesRun(talkingType.value === '01'? '07': '08', '', ()=>{ - // common.navigateTo('/pages/sparring/result?isOver=1&traId=' + traId.value + '&execId=' + execId.value + '&type=' + talkingType.value + '&isPreview=' + (isPreview.value ?'1':'')) - // }) - }) + overNow() } }) + } + const overNow = (cb= ()=>{}) => { + partnerChatReportTrigger({ + execId: execId.value, + traId: traId.value, + talkingType: isPreview.value ? 'preview' : 'practice' + }).then(res => { + watchFlag.value = 1; + sendMessage({ + commond: 'ASK-STOP', + body: { + execId: execId.value || '' + } + }) + socketStore?.closeSocket(); + changePlayItemId('') + common.navigateTo('/pages/sparring/result?isOver=1&traId=' + traId.value + '&execId=' + execId + .value + '&type=' + talkingType.value + '&isPreview=' + (isPreview.value ? '1' : '')) + // pointAndBadgesRun(talkingType.value === '01'? '07': '08', '', ()=>{ + // common.navigateTo('/pages/sparring/result?isOver=1&traId=' + traId.value + '&execId=' + execId.value + '&type=' + talkingType.value + '&isPreview=' + (isPreview.value ?'1':'')) + // }) + }).catch(()=>{ + cb() + }) + + } const sendMessage = (data) => { unref(SocketObj).send(data); @@ -471,8 +492,13 @@ talkingType.value = params.type; isPreview.value = params.isPreview === '1' getDetailInfo() + console.log('onLoad') + //#ifdef APP-PLUS + plus.screen.lockOrientation('portrait-primary') + // #endif }); onUnload(() => { + console.log('onUnload') watchFlag.value = 1; sendMessage({ commond: 'ASK-STOP', @@ -481,7 +507,11 @@ } }) socketStore?.closeSocket(); + execId.value = '' }); + onLaunch(() => { + console.log('onLaunch') + }) onMounted(() => { // getDetailInfo() }) diff --git a/src/pagesOther.json b/src/pagesOther.json index 3b5f6d23..26d99725 100644 --- a/src/pagesOther.json +++ b/src/pagesOther.json @@ -103,6 +103,7 @@ "navigationBarBackgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8", "navigationStyle": "custom", + "screenOrientation": "portrait", "app-plus": { "titleView": false, "bounce": "none",