diff --git a/.env.development b/.env.development index acccd2fd..fa31ca92 100644 --- a/.env.development +++ b/.env.development @@ -6,7 +6,7 @@ ENV = 'development' # VITE_APP_BASE_API_Url = 'https://aits.jlbank.com.cn:7001' -#VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' +VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001' # VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' @@ -14,7 +14,7 @@ ENV = 'development' # VITE_APP_BASE_API_Url = 'http://aitscdn.jlbank.com.cn:7001' # VITE_APP_BASE_API_Url = 'http://192.168.108.129' # dev -VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001' +#VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001' # sit #VITE_APP_BASE_API_Url = 'http://25.18.122.91:9786' @@ -44,6 +44,7 @@ VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001' # VITE_APP_BASE_H5_API_Url_TRASTUDY = 'http://25.64.16.130:9602' # VITE_APP_BASE_H5_API_Url_TRAASK = 'http://25.64.16.144:9605' -#VITE_APP_BASE_H5_API_Url_TRAEXAM = 'http://25.64.16.139:9604' + +# VITE_APP_BASE_H5_API_Url_TRAEXAM = 'http://25.64.16.154:9604' diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index 15f11888..b7f2bc25 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -2,7 +2,8 @@ "version" : "1.0", "configurations" : [ { - "playground" : "custom", + "customPlaygroundType" : "device", + "playground" : "standard", "type" : "uni-app:app-android" }, { diff --git a/package.json b/package.json index b0df4ff2..77bfbc17 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "tra-app", "version": "0.0.1", "description": "", + "overrides": {"rollup":"4.14.3"}, "scripts": { "dev:h5": "uni", "dev:rd": "uni -p h5 --mode development.rd", @@ -39,11 +40,12 @@ "dompurify": "^3.3.0", "markdown-it": "^14.1.0", "pinia": "^2.3.1", + "pnpm": "^10.25.0", "terser": "^5.42.0", + "text-encoding": "^0.7.0", "uuid": "^11.1.0", "vue": "^3.5.11", - "vue-i18n": "^9.1.9", - "text-encoding": "^0.7.0" + "vue-i18n": "^9.1.9" }, "devDependencies": { "@dcloudio/types": "^3.4.8", diff --git a/src/App.vue b/src/App.vue index df02f786..4c64256a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -21,7 +21,7 @@ \ No newline at end of file diff --git a/src/pages/sparring/components/talk-camera-安卓可用.nvue b/src/pages/sparring/components/talk-camera-安卓可用.nvue new file mode 100644 index 00000000..85245c81 --- /dev/null +++ b/src/pages/sparring/components/talk-camera-安卓可用.nvue @@ -0,0 +1,322 @@ + + + + + \ No newline at end of file diff --git a/src/pages/sparring/components/talk-camera.nvue b/src/pages/sparring/components/talk-camera.nvue index f7d5a6c7..a9012400 100644 --- a/src/pages/sparring/components/talk-camera.nvue +++ b/src/pages/sparring/components/talk-camera.nvue @@ -1,63 +1,176 @@ diff --git a/src/pages/sparring/js/useCamera.js b/src/pages/sparring/js/useCamera.js new file mode 100644 index 00000000..63ec64f1 --- /dev/null +++ b/src/pages/sparring/js/useCamera.js @@ -0,0 +1,10 @@ +export default function useCamera(aaas = null, options = {}) { + +return { + ws, + close, + initConnection, + send, + isRecording + }; +} \ No newline at end of file diff --git a/src/pages/sparring/js/useWebSocket.js b/src/pages/sparring/js/useWebSocket.js index 0b7cd92d..19c64a3b 100644 --- a/src/pages/sparring/js/useWebSocket.js +++ b/src/pages/sparring/js/useWebSocket.js @@ -72,7 +72,6 @@ export default function useWebSocket(aaas = null, options = {}) { body } = ProtocolCodec.unpack(res.data); switch (msgType) { - case MessageType.IDENTITY: console.log('身份校验', body); onStartRecord(body) @@ -89,16 +88,22 @@ export default function useWebSocket(aaas = null, options = {}) { case 1: // ASR或TTS初始化出错 console.log('后端返回的错误', body.errMsg); - case 4: console.log('通话接通失败', body.errMsg); // 通话接通失败,请稍后再试! + ws.value.close({ + code: 4001, + reason: '当前服务器繁忙,请稍后在试!' + }) + break; + case 5: // 使用人数过多等其他错误 ws.value.close({ code: 4001, reason: body.errMsg }) break; default: + console.log('其他错误码的默认处理', body); // 其他错误码的默认处理(如果需要) // ws.value.close({ // code: 1001, diff --git a/src/pages/sparring/talk.vue b/src/pages/sparring/talk.vue index 42e699ab..e4c28d63 100644 --- a/src/pages/sparring/talk.vue +++ b/src/pages/sparring/talk.vue @@ -4,8 +4,6 @@ - - {{ formattedTime }} 正在接通中 @@ -47,9 +45,7 @@ } from '@dcloudio/uni-app'; import { ProtocolCodec, - MessageType, - CompressionType, - ControlCommand + MessageType } from './js/ProtocolCodec'; import common from '@/common/common'; import talkMicrophone from './components/talk-microphone.vue'; @@ -130,10 +126,10 @@ } }; // 未接通时候报错处理,仅返回和少量销毁 - const noConnectDestroy = () => { + const noConnectDestroy = (msg) => { console.log('未接通'); setTimeout(() => { - common.show('', '当前服务器繁忙,请稍后在试!', false).then((res) => { + common.show('', msg, false).then((res) => { if (res) common.navigateBack(); }); }, 500); @@ -220,7 +216,7 @@ destroy(); } else { // 否则是未接通 - noConnectDestroy(); + noConnectDestroy(error?.reason); } } else if (error?.code === 1001) { // 正常运行中后端掉线了 @@ -234,7 +230,7 @@ // 用户主动挂断 } else if (error?.code === 4001) { // 自定义异常挂断,参数错误 - noConnectDestroy(); + noConnectDestroy(error?.reason); } }; onLoad((e) => { @@ -282,7 +278,12 @@ console.log('组件卸载'); if (timer) clearInterval(timer); }); - onBackPress((res) => res.from === 'backbutton'); + onBackPress((res) => { + if (res.from === 'backbutton') { + closeTalking(); + return true; + } + }); \ No newline at end of file + diff --git a/src/pages/sparring/talkVideo.nvue b/src/pages/sparring/talkVideo.nvue new file mode 100644 index 00000000..44050056 --- /dev/null +++ b/src/pages/sparring/talkVideo.nvue @@ -0,0 +1,325 @@ + + + + diff --git a/src/pages/sparring/talkVoice.vue b/src/pages/sparring/talkVoice.vue new file mode 100644 index 00000000..21ec7fc5 --- /dev/null +++ b/src/pages/sparring/talkVoice.vue @@ -0,0 +1,437 @@ + + + + diff --git a/src/pages/sparring/tip.vue b/src/pages/sparring/tip.vue index 590dc959..b24b2df3 100644 --- a/src/pages/sparring/tip.vue +++ b/src/pages/sparring/tip.vue @@ -69,7 +69,9 @@ {{ detailInfo.sceneDesc }} - 陪练角色不具备主动终止场景陪练的功能,当用户完成预设陪练目标时,需由用户手动发起结束陪练操作。 + + 陪练角色不具备主动终止场景陪练的功能,当用户完成预设陪练目标时,需由用户手动发起结束陪练操作。 + -请点击下方按钮开始{{ detailInfo.traInterTypDesc }} @@ -141,7 +143,7 @@ import points from '@/components/points-and-badge/points'; import usePointsAndBadge from '@/components/points-and-badge/usePointsAndBadge'; import { initRecord } from '@/composables/useExamSubject.js'; - import permissionApi from '@/common/permission' + import permissionApi from '@/common/permission'; const { pointAndBadgesRun, badgeRef, pointsRef } = usePointsAndBadge(); const socketStore = useSocketStore(); @@ -247,26 +249,33 @@ const toTalking = async () => { try { - //#ifdef APP-PLUS - console.log('申请权限'); - try { - // await initRecord(); - await permissionApi.judgeIosPermission('record') - await permissionApi.judgeIosPermission('camera') - } catch(e) { - console.error('摄像头或者麦克风权限申请失败:', e); - return; + console.log('申请权限'); + try { + await permissionApi.judgeIosPermission('record'); + if (detailInfo.value.traInterTyp === '03') { + await permissionApi.judgeIosPermission('camera'); } + } catch (e) { + console.error('摄像头或者麦克风权限申请失败:', e); + return; + } //#endif common.setPageCache('tipMsgsceneDesc', { ossAddr: detailInfo.value.ossAddr, chaName: detailInfo.value.chaName, traInterTyp: detailInfo.value.traInterTyp, - traInterTypDesc: detailInfo.value.traInterTypDesc, + traInterTypDesc: detailInfo.value.traInterTypDesc }); + let _gotUrl; + if (detailInfo.value.traInterTyp === '02') { + _gotUrl = '/pages/sparring/talk'; + } else if (detailInfo.value.traInterTyp === '03') { + _gotUrl = '/pages/sparring/talk'; // 没改好,暂时跳到一个页 + } common.redirectTo( - '/pages/sparring/talk?traId=' + + _gotUrl + + '?traId=' + traId.value + '&chaId=' + chaId.value + @@ -899,7 +908,7 @@ text-align: center; } } - .talking-desc{ + .talking-desc { // padding-top: 24rpx; padding: 24rpx 20rpx 0; font-size: 24rpx; diff --git a/src/pages/test/index.vue b/src/pages/test/index.vue index 281077f4..9de5393a 100644 --- a/src/pages/test/index.vue +++ b/src/pages/test/index.vue @@ -36,7 +36,7 @@ } const aaaa = async() => { - + common.navigateTo('/pages/test/testChat') } diff --git a/src/pages/test/testChat.nvue b/src/pages/test/testChat.nvue new file mode 100644 index 00000000..c1c5ad39 --- /dev/null +++ b/src/pages/test/testChat.nvue @@ -0,0 +1,101 @@ + + diff --git a/src/pages/test/testChat.vue b/src/pages/test/testChat.vue deleted file mode 100644 index 336c20c6..00000000 --- a/src/pages/test/testChat.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - - diff --git a/src/pages/test/testChat3.vue b/src/pages/test/testChat3.vue index e69a2c28..42e699ab 100644 --- a/src/pages/test/testChat3.vue +++ b/src/pages/test/testChat3.vue @@ -1,20 +1,473 @@ - + + \ No newline at end of file diff --git a/src/pages/testingHall/details.vue b/src/pages/testingHall/details.vue index 8aca099a..eb297ff9 100644 --- a/src/pages/testingHall/details.vue +++ b/src/pages/testingHall/details.vue @@ -8,7 +8,7 @@ 考试详情 - + 未完成 已完成 @@ -297,7 +297,8 @@ width: 100%; min-height: 100%; flex: 1; - + z-index: 2; + background-color: #ffffff; .paper { height: 100%; margin: 24rpx 30rpx 0 30rpx; diff --git a/src/pages/wrongQuestionRecord/correct.vue b/src/pages/wrongQuestionRecord/correct.vue index 04e38824..f63b90e9 100644 --- a/src/pages/wrongQuestionRecord/correct.vue +++ b/src/pages/wrongQuestionRecord/correct.vue @@ -1,793 +1,793 @@ diff --git a/src/pagesB.json b/src/pagesB.json index 5fa2084c..8e125be4 100644 --- a/src/pagesB.json +++ b/src/pagesB.json @@ -101,6 +101,16 @@ } } }, + { + "path": "pages/sparring/talkVideo", + "style": { + "navigationBarTitleText": "AI陪练视频通话", + "disableSwipeBack": true, + "app-plus": { + "titleNView": false + } + } + }, { "path": "pages/sparring/result", "style": { diff --git a/src/store.js b/src/store.js index 23cb5271..d157ed09 100644 --- a/src/store.js +++ b/src/store.js @@ -1,3 +1,6 @@ +// #ifndef APP-PLUS-NVUE import { createPinia } from 'pinia'; const store = createPinia(); - export default store; \ No newline at end of file + + export default store; +// #endif \ No newline at end of file diff --git a/src/store/socket.js b/src/store/socket.js index d2643715..e7b60392 100644 --- a/src/store/socket.js +++ b/src/store/socket.js @@ -4,6 +4,7 @@ import { getToken } from '@/common/common.js' import { get_base_url } from '@/api/request.js' import SocketClass from '@/api/socket.js' + export const useSocketStore = defineStore('socketStore',{ state:()=>({ SocketObj: null diff --git a/src/store/storage.js b/src/store/storage.js index f6baf020..80cf4ace 100644 --- a/src/store/storage.js +++ b/src/store/storage.js @@ -1,6 +1,7 @@ import { defineStore } from 'pinia'; import { ref } from 'vue'; + export const useStorageStore = defineStore('storageStore',{ state:()=>({ imgObjStr: '{}',