diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index b7f2bc25..eb3df681 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -7,7 +7,11 @@ "type" : "uni-app:app-android" }, { + "bundleId" : "cn.com.jlbank.aits", + "certificateFile" : "/Users/jlbank/Desktop/tra-app/certificate/ios/开发证书.p12", + "certificateProfileFile" : "/Users/jlbank/Desktop/tra-app/certificate/ios/jiaixuedev.mobileprovision", "playground" : "standard", + "runSignStatus" : 1, "type" : "uni-app:app-ios" } ] diff --git a/Ios/HBuilder-Hello/HBuilder-Hello.xcodeproj/project.xcworkspace/xcuserdata/jlbank.xcuserdatad/UserInterfaceState.xcuserstate b/Ios/HBuilder-Hello/HBuilder-Hello.xcodeproj/project.xcworkspace/xcuserdata/jlbank.xcuserdatad/UserInterfaceState.xcuserstate index 6a7028fd..083859e1 100644 Binary files a/Ios/HBuilder-Hello/HBuilder-Hello.xcodeproj/project.xcworkspace/xcuserdata/jlbank.xcuserdatad/UserInterfaceState.xcuserstate and b/Ios/HBuilder-Hello/HBuilder-Hello.xcodeproj/project.xcworkspace/xcuserdata/jlbank.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/src/api/pointsMall.js b/src/api/pointsMall.js new file mode 100644 index 00000000..27034a8d --- /dev/null +++ b/src/api/pointsMall.js @@ -0,0 +1,9 @@ +import request from '@/api/request' +// 积分商城-活动列表 +export const queryPointsActivityPaging = (data) => { + return request({ + url: '/traapp/traPointsActivity/queryPointsActivityPaging', + method: 'post', + data + }); +}; \ No newline at end of file diff --git a/src/common/permission.js b/src/common/permission.js index 70571bd5..2d62c0be 100644 --- a/src/common/permission.js +++ b/src/common/permission.js @@ -75,8 +75,8 @@ function judgeIosPermissionRecord() { console.log('麦克风state', state); switch (state) { case 'authorized': - console.log("麦克风权限是否开启"); - resolve() + console.log("麦克风权限已经开启"); + resolve('authorized') break; case 'denied': // ios拒绝,安卓拒绝或者未授权都是这个 if (IsAndEnv) { // 安卓二次判定 @@ -94,10 +94,10 @@ function judgeIosPermissionRecord() { // 前往权限设置页面 uni.openAppAuthorizeSetting(); } - reject() + reject(new Error('前往权限设置页面用户点击了否')) break; case 'not determined': // 表示尚未请求授权,仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关 - resolve() + resolve('not determined') break; case 'config error': // 只有在 App 端时返回 resolve() diff --git a/src/components/touch-btn/touch-btn.vue b/src/components/touch-btn/touch-btn.vue index 48b0211b..4cc1c125 100644 --- a/src/components/touch-btn/touch-btn.vue +++ b/src/components/touch-btn/touch-btn.vue @@ -96,12 +96,13 @@ import { wsUrl, bottomAreaTopBoundary, horizontalSplitX } from './touch-btn'; import { ref, computed, onMounted, nextTick, watch, reactive } from 'vue'; import common from '@/common/common'; - import { onHide } from '@dcloudio/uni-app'; + import { onHide, onLaunch } from '@dcloudio/uni-app'; import { getPhoneEnvBool, getToken } from '@/common/common.js'; - import { startAudioRecord, stopAudioRecord } from '@/uni_modules/ty-recording'; + import { startAudioRecord, stopAudioRecord,preRequestRecordPermission } from '@/uni_modules/ty-recording'; import { ProtocolCodec, MessageType, ControlCommand, ControlCode } from '@/pages/sparring/js/ProtocolCodec'; import permissionApi from '@/common/permission'; - + + const emit = defineEmits(['submit']); const ws = ref(null); const status = ref('voice'); @@ -164,9 +165,13 @@ const inputText = ref(''); let startTime = 0; // 开启语音 - const startRecord = async (obj) => { + const startRecord = async (obj: { touches: any[]; }) => { try { - await permissionApi.judgeIosPermission('record'); + const state = await permissionApi.judgeIosPermission('record'); + if(state === 'not determined') { // 苹果专用 + preRequestRecordPermission(() => {}) + return; + } } catch (e) { console.error('麦克风权限申请失败:', e); return; @@ -174,54 +179,61 @@ const changedTouche = obj.touches[0]; touchPos.x = changedTouche.clientX; touchPos.y = changedTouche.clientY; - ws.value = uni.connectSocket({ - url: wsUrl + '?summary=' + getToken(), - fail: () => {}, - success: () => {} - }); - ws.value.onOpen((res) => { - console.log('ws已连接'); - popupRef.value.open(); - startAudioRecord({ - onFrame: (pcmData) => { - console.log(pcmData.length); - ws.value.send({ - data: ProtocolCodec.pack(MessageType.AUDIO_DATA, pcmData) - }); - }, - onStart: ({ startTime }) => { - console.log('开始', startTime); - }, - onStop: () => { - console.log('关闭'); - }, - onError: ({ errCode, errMsg }) => { - if (errCode === 9010001) { - console.log(errMsg); - } + popupRef.value.open(); + startAudioRecord({ + onFrame: (pcmData: any) => { + console.log('pcmData', pcmData); + // console.log('pcmData', pcmData.length); + // ws.value.send({ + // data: ProtocolCodec.pack(MessageType.AUDIO_DATA, pcmData) + // }); + }, + onStart: (res: any) => { + console.log('启动', res); + + }, + onStop: () => { + console.log('关闭'); + }, + onError: ({ errCode, errMsg }) => { + console.log('onError',errMsg); + if (errCode === 9010001) { + console.log(errMsg); } - }); - }); - ws.value.onError((err) => { - console.log('err', err); - }); - ws.value.onClose((err) => { - console.log('onClose', err); - }); - ws.value.onMessage((res) => { - try { - const { msgType, body } = ProtocolCodec.unpack(res.data); - console.log('来消息了', msgType, body); - if (msgType === MessageType.TEXT_MESSAGE) { - tempText.value = ''; - allText.value = allText.value + body; - } else if (msgType === MessageType.TIP_MESSAGE) { - tempText.value = body; - } - } catch (e) { - console.log('后端发来的信息有问题'); } }); + + + // ws.value = uni.connectSocket({ + // url: wsUrl + '?summary=' + getToken(), + // fail: () => {}, + // success: () => {} + // }); + // ws.value.onOpen((res) => { + // console.log('ws已连接'); + // popupRef.value.open(); + + // }); + // ws.value.onError((err) => { + // console.log('err', err); + // }); + // ws.value.onClose((err) => { + // console.log('onClose', err); + // }); + // ws.value.onMessage((res) => { + // try { + // const { msgType, body } = ProtocolCodec.unpack(res.data); + // console.log('来消息了', msgType, body); + // if (msgType === MessageType.TEXT_MESSAGE) { + // tempText.value = ''; + // allText.value = allText.value + body; + // } else if (msgType === MessageType.TIP_MESSAGE) { + // // tempText.value = body; + // } + // } catch (e) { + // console.log('后端发来的信息有问题'); + // } + // }); }; // 关掉遮罩层 const closePopup = () => { diff --git a/src/pages.json b/src/pages.json index 5ce9cb98..2c448bd3 100644 --- a/src/pages.json +++ b/src/pages.json @@ -420,6 +420,15 @@ } } }, + { + "path": "pages/pointsMall/pointsMall", + "style": { + "navigationBarTitleText": "积分商城", + "app-plus": { + "titleNView": false + } + } + }, { "path": "pages/course/index", "style": { @@ -605,9 +614,7 @@ "titleView": false, "bounce": "none", "softinputNavBar": "none" - }, - "rpxCalcMaxDeviceWidth": 600, - "rpxCalcBaseDeviceWidth": 375 + } }, "uniIdRouter": {} } \ No newline at end of file diff --git a/src/pages/index/components/class_scroll.vue b/src/pages/index/components/class_scroll.vue index eed3763b..98ad4c3a 100644 --- a/src/pages/index/components/class_scroll.vue +++ b/src/pages/index/components/class_scroll.vue @@ -1,13 +1,17 @@ @@ -125,16 +138,27 @@ } } } + .answerTipButtonDiv { + margin: 20rpx 0 20rpx 0; + } .answerTipButton { margin: 20rpx 0 20rpx 0; - width: 190rpx; + width: 200rpx; height: 60rpx; border-radius: 60rpx; line-height: 60rpx; background-color: #2688f9; text-align: center; + padding-right: 10rpx; color: #fff; font-size: 30rpx; + position: relative; + .loading-div { + position: absolute; + right: 18rpx; + top: calc(50% - 4rpx); + transform: translateY(-50%); + } } .talk-tip-list-div { diff --git a/src/pages/sparring/detail.vue b/src/pages/sparring/detail.vue index 11d44505..7b98335c 100644 --- a/src/pages/sparring/detail.vue +++ b/src/pages/sparring/detail.vue @@ -64,13 +64,15 @@ @click="previewFile(item)"> {{ item.dataName }}.{{ item.dataSuffix }} - + + + 去练习 去考试 - + diff --git a/src/pages/sparring/js/useWebSocket.js b/src/pages/sparring/js/useWebSocket.js index d5f890b7..00d91a21 100644 --- a/src/pages/sparring/js/useWebSocket.js +++ b/src/pages/sparring/js/useWebSocket.js @@ -110,9 +110,6 @@ export default function useWebSocket(aaas = null, options = {}) { break; case MessageType.CONTROL_CMD: // 控制消息 - console.log('控制消息', body, body.type === ControlCode.AI_ANSWER_BEGIN); - console.log('控制消息2', ControlCode.AI_ANSWER_BEGIN); - if (body.type === ControlCode.FINISH_PUSH) { // 开始播放,记录当前播放的语音id console.log('开始播放,记录当前播放的语音id', body.lock); setPlayNumber(body.lock) @@ -125,7 +122,6 @@ export default function useWebSocket(aaas = null, options = {}) { } break; case MessageType.TEXT_MESSAGE: - console.log('TEXT_MESSAGE', body); addTalkText(body) break; case MessageType.TIP_MESSAGE: diff --git a/src/pages/sparring/talk.vue b/src/pages/sparring/talk.vue index aeb5ad80..5dce092b 100644 --- a/src/pages/sparring/talk.vue +++ b/src/pages/sparring/talk.vue @@ -19,24 +19,13 @@ {{ dataInfo.sceneDesc }} - + - + @@ -85,7 +74,6 @@ // 点击回答提示 const clickTipButton = () => { - console.log('点击回答提示', {type:ControlCode.AI_CLUE}); send(ProtocolCodec.pack(MessageType.CONTROL_CMD, {type:ControlCode.AI_CLUE})) } @@ -271,7 +259,7 @@ onLoad((e) => { dataInfo.traId = e.traId ?? ''; dataInfo.chaId = e.chaId ?? ''; - dataInfo.traType = '02'; // 陪练类型 01-练习 02-考试 + dataInfo.traType = e.type; // 陪练类型 01-练习 02-考试 dataInfo.traInterTyp = e.traInterTyp ?? '02'; // 陪练交互类型 01 对话 02 语音 03 视频 // dataInfo.traInterType = '02'; // 陪练交互类型 01 对话 02 语音 03 视频 //#ifdef APP-PLUS @@ -337,6 +325,15 @@