From 67acff93c3f95929fd8b73230b4781cd3fb23754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E8=88=AA?= Date: Fri, 8 Aug 2025 14:24:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/components/touchBtn.vue | 24 ++- src/pages/index/components/answer.vue | 185 ++++++++++---------- src/pages/index/components/talking-item.vue | 5 + src/pages/index/dialog.vue | 37 ++-- 4 files changed, 136 insertions(+), 115 deletions(-) diff --git a/src/pages/course/components/touchBtn.vue b/src/pages/course/components/touchBtn.vue index db5808bf..dbd610e5 100644 --- a/src/pages/course/components/touchBtn.vue +++ b/src/pages/course/components/touchBtn.vue @@ -153,22 +153,24 @@ const initRecord = () => { }) } const startFlag = ref(1) +const canStart = ref(true) const startRecord = () => { unref(recordObjCom).start({format:'mp3'}) } const stopRecord = () => { - // setTimeout(() => { - try{ - if(unref(recordObjCom).stop){ - unref(recordObjCom).stop() - }else{ - closeModel() - } - }catch{ + try{ + if(unref(recordObjCom).stop){ + unref(recordObjCom).stop() + }else{ closeModel() } - // }, 500) + }catch{ + closeModel() + } + setTimeout(() => { + canStart.value = true + }, 1000) } const closeModel = (cb = () => {}) => { setTimeout(() => { @@ -258,6 +260,9 @@ const showOverlayTalking = (obj) => { }) return } + if(!canStart.value){ + return + } isMoving.value = true emit('startRecord') recNum.value += 1 @@ -266,6 +271,7 @@ const showOverlayTalking = (obj) => { touchY.value = obj.changedTouches[0].pageY baseY.value = obj.currentTarget.offsetTop //#ifdef APP-PLUS + canStart.value = false startRecord() // #endif setTimeout(() => { diff --git a/src/pages/index/components/answer.vue b/src/pages/index/components/answer.vue index 06b21d24..930d6937 100644 --- a/src/pages/index/components/answer.vue +++ b/src/pages/index/components/answer.vue @@ -9,14 +9,14 @@ - + - + + - --> + @@ -57,6 +57,10 @@ isLoading:{ default: false, type:Boolean + }, + isAnswering: { + default: false, + type: Boolean } }) @@ -89,95 +93,96 @@ .talking-cont{ padding-bottom: 20rpx; } - .btns-cont{ + .btns-cont{ + overflow: hidden; + border-top: 3rpx solid #eee; + padding-bottom: 10rpx; + .replay-btn{ + float: left; + width: 46rpx; + height: 46rpx; overflow: hidden; - border-top: 3rpx solid #eee; - .replay-btn{ - float: left; - width: 46rpx; - height: 46rpx; - overflow: hidden; - margin-right: 16rpx; - margin-top: 25rpx; - } - .play-btn{ - float: left; - width: 46rpx; - height: 46rpx; - overflow: hidden; - margin-right: 16rpx; - margin-top: 25rpx; - } - .next-learn-btn{ - float: left; - padding: 0 60rpx 0 20rpx; - height: 62rpx; - line-height: 62rpx; - font-size: 30rpx; - background-color: #06f; - color: #fff; - border-radius: 8rpx; - margin-top: 16rpx; - margin-right: 16rpx; - position: relative; - &.replay-study-btn{ - float: right; - } - &.restart{ - background-color: #eaf2ff; - color: #06f; - } - .icon-iamge{ - width: 25rpx; - height: 25rpx; - position: absolute; - right: 20rpx; - top: 50%; - margin-top: -12rpx; - } - } - .replay-learn-btn{ - float: left; - padding: 0 60rpx 0 20rpx; - height: 62rpx; - line-height: 62rpx; - font-size: 30rpx; - color: #06f; - background-color: #eaf2ff; - border-radius: 8rpx; - margin-top: 16rpx; - margin-right: 16rpx; - position: relative; - .icon-iamge{ - width: 25rpx; - height: 25rpx; - position: absolute; - right: 20rpx; - top: 50%; - margin-top: -12rpx; - } - } - .next-btn{ + margin-right: 20rpx; + margin-top: 20rpx; + } + .play-btn{ + float: left; + width: 46rpx; + height: 46rpx; + overflow: hidden; + margin-right: 20rpx; + margin-top: 20rpx; + } + .next-learn-btn{ + float: left; + padding: 0 60rpx 0 20rpx; + height: 62rpx; + line-height: 62rpx; + font-size: 30rpx; + background-color: #06f; + color: #fff; + border-radius: 8rpx; + margin-top: 16rpx; + margin-right: 16rpx; + position: relative; + &.replay-study-btn{ float: right; - padding: 0 60rpx 0 20rpx; - height: 62rpx; - line-height: 62rpx; - font-size: 30rpx; - background-color: #06f; - color: #fff; - border-radius: 8rpx; - margin-top: 16rpx; - position: relative; - .icon-iamge{ - width: 25rpx; - height: 25rpx; - position: absolute; - right: 20rpx; - top: 50%; - margin-top: -12rpx; - } + } + &.restart{ + background-color: #eaf2ff; + color: #06f; + } + .icon-iamge{ + width: 25rpx; + height: 25rpx; + position: absolute; + right: 20rpx; + top: 50%; + margin-top: -12rpx; } } + .replay-learn-btn{ + float: left; + padding: 0 60rpx 0 20rpx; + height: 62rpx; + line-height: 62rpx; + font-size: 30rpx; + color: #06f; + background-color: #eaf2ff; + border-radius: 8rpx; + margin-top: 16rpx; + margin-right: 16rpx; + position: relative; + .icon-iamge{ + width: 25rpx; + height: 25rpx; + position: absolute; + right: 20rpx; + top: 50%; + margin-top: -12rpx; + } + } + .next-btn{ + float: right; + padding: 0 60rpx 0 20rpx; + height: 62rpx; + line-height: 62rpx; + font-size: 30rpx; + background-color: #06f; + color: #fff; + border-radius: 8rpx; + margin-top: 16rpx; + position: relative; + .icon-iamge{ + width: 25rpx; + height: 25rpx; + position: absolute; + right: 20rpx; + top: 50%; + margin-top: -12rpx; + } + } + } } \ No newline at end of file diff --git a/src/pages/index/components/talking-item.vue b/src/pages/index/components/talking-item.vue index c0af806d..00b6596b 100644 --- a/src/pages/index/components/talking-item.vue +++ b/src/pages/index/components/talking-item.vue @@ -10,6 +10,7 @@ v-else-if="talkingType === 'answer'" :dataInfo="props.talkingInfo" :isLoading="!!props.talkingInfo.isLoading" + :isAnswering="props.isAnswering" @handleEvents="handleEvents" > @@ -34,6 +35,10 @@ activeVoiceId:{ default:'', type: String + }, + isAnswering: { + default: false, + type: Boolean } }) watch(() => props.activeVoiceId, () => {},{deep: true,immediate: true}) diff --git a/src/pages/index/dialog.vue b/src/pages/index/dialog.vue index 6e984d11..9cb0178e 100644 --- a/src/pages/index/dialog.vue +++ b/src/pages/index/dialog.vue @@ -44,7 +44,7 @@ - @@ -287,7 +287,8 @@ talkingText: answerText.value, isLoading: false, id: _id, - ...body + ...body, + askData: {...askData.value} }) } else if (body.event === 'token') { answerIsOver.value = false @@ -350,22 +351,26 @@ const talkItemEvents = (type, data, id = '') => { switch (type) { case 'reAnswer': - console.log('重新获取数据') - // 设置停止回调 - stopAnswerCallBack.value = ($data) => { - sendMessage({ - "commond": 'ASK', - "body": $data - }) - } - // 停止获取 + console.log('重新提问回答') sendMessage({ - "commond": 'ASK-STOP', - "body": { - reqBatch: reqBatch.value, - seqNo: seqNo.value, - } + "commond": 'ASK', + "body": data.askData }) + // // 设置停止回调 + // stopAnswerCallBack.value = ($data) => { + // sendMessage({ + // "commond": 'ASK', + // "body": $data + // }) + // } + // // 停止获取 + // sendMessage({ + // "commond": 'ASK-STOP', + // "body": { + // reqBatch: reqBatch.value, + // seqNo: seqNo.value, + // } + // }) break; case 'stop': console.log('停止获取数据')