diff --git a/src/pages/course/components/touchBtn.vue b/src/pages/course/components/touchBtn.vue index 189d94e2..dbd610e5 100644 --- a/src/pages/course/components/touchBtn.vue +++ b/src/pages/course/components/touchBtn.vue @@ -34,6 +34,9 @@ + + + @@ -150,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(() => { @@ -255,6 +260,9 @@ const showOverlayTalking = (obj) => { }) return } + if(!canStart.value){ + return + } isMoving.value = true emit('startRecord') recNum.value += 1 @@ -263,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(() => { @@ -442,6 +451,34 @@ const changeBtn = () => { height: 234rpx; margin: 0 auto; background-color: #06f; + border-radius: 32rpx; + position: relative; + &.is-out{ + background-color: #ff3e49; + &::after{ + background-color: #ff3e49; + } + } + .gif-box{ + position: absolute; + width: 200rpx; + height: 80rpx; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + } + &::after{ + content: ''; + width: 44rpx; + height: 44rpx; + clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); + background-color: #06f; + overflow: hidden; + position: absolute; + bottom: -22rpx; + left:50%; + margin-left: -22rpx; + } } .white-bg-box{ height: 365rpx; diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue index 8e9b09eb..82c8202d 100644 --- a/src/pages/course/study.vue +++ b/src/pages/course/study.vue @@ -48,9 +48,9 @@ 课程学习 - - {{ showOrder }} / {{ pgrphNum }} - + + {{ showOrder }} / {{ pgrphNum }} + { initsocketTask() getData('1'); }) + const keyboardHeight = ref('0px') + const setHeight = (res) => { + keyboardHeight.value = res.height +'px' + scrollToBottomNow() + } onHide(()=>{ + uni.offKeyboardHeightChange(setHeight) if(watchFlag.value === 1) return changePlayItemId('') socketStore.closeSocket() @@ -654,6 +660,7 @@ onHide(()=>{ // }).finally(() => {}) }) onShow(()=>{ + uni.onKeyboardHeightChange(setHeight) if(watchFlag.value === 1) return // getData('2'); initsocketTask() @@ -959,8 +966,9 @@ const chooseRateNow = (item) => { position: absolute; overflow: hidden; left:0; - top: 0; - height: 100%; + bottom: 0; + // height: 100%; + height: calc(100% - v-bind(keyboardHeight)); width: 100%; padding:0 0rpx; box-sizing: border-box; @@ -991,7 +999,8 @@ const chooseRateNow = (item) => { height: 36rpx; line-height: 36rpx; text-align: center; - padding-top: 30rpx; + padding-top: 20rpx; + padding-bottom: 10rpx; box-sizing: content-box; background: url(@/static/images/course/study-bg.png) no-repeat; border-radius: 30rpx 30rpx 0 0; @@ -1006,6 +1015,7 @@ const chooseRateNow = (item) => { padding: 10rpx 30rpx; background: url(@/static/images/course/study-bg.png) no-repeat; background-size: cover; + background-position: center bottom; box-sizing: border-box; width: 100%; .talking-list-cont{ 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 cbbcb32a..9cb0178e 100644 --- a/src/pages/index/dialog.vue +++ b/src/pages/index/dialog.vue @@ -14,6 +14,7 @@ + @@ -43,7 +44,7 @@ - @@ -286,7 +287,8 @@ talkingText: answerText.value, isLoading: false, id: _id, - ...body + ...body, + askData: {...askData.value} }) } else if (body.event === 'token') { answerIsOver.value = false @@ -349,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('停止获取数据') @@ -541,11 +547,16 @@ const refreshData = () => { loadData(); }; + + const keyboardHeight = ref('0px') + const setHeight = (res) => { + keyboardHeight.value = res.height +'px' + } onHide(() => { - + uni.offKeyboardHeightChange(setHeight) }) onShow(() => { - + uni.onKeyboardHeightChange(setHeight) }) onUnload(() => { watchFlag.value = 1 @@ -561,7 +572,7 @@ position: relative; display: flex; flex-direction: column; - height: 100vh; + height: calc(100vh - 0px); overflow: hidden; } @@ -582,8 +593,8 @@ position: absolute; overflow: hidden; left: 0; - top: 0%; - height: 100%; + bottom: 0%; + height: calc(100% - v-bind(keyboardHeight)); width: 100%; padding: 0; box-sizing: border-box;