fix; bug

This commit is contained in:
yanghang
2025-07-15 15:23:58 +08:00
parent 0f79e7bfda
commit 7eb43b153b
9 changed files with 79 additions and 35 deletions
@@ -64,6 +64,10 @@
watch: {
imgId: {
handler(newval, oldval) {
if(newval.indexOf('/') === 0) {
this.imgUrlShow = this.base_url + newval
return
}
if(newval.indexOf('http') === 0){
this.imgUrlShow = newval
return
@@ -128,7 +132,9 @@
},
mounted() {
if (this.imgId) {
if(this.imgId.indexOf('http') === 0){
if(this.imgId.indexOf('/') === 0) {
this.imgUrlShow = this.base_url + this.imgId
}else if(this.imgId.indexOf('http') === 0){
this.imgUrlShow = this.imgId
}else{
this.getPreviewUrlBlob(this.imgId);
+2 -12
View File
@@ -162,7 +162,7 @@
},
{
"text": "学习",
"pagePath": "pages/study/index"
"pagePath": "pages/course/index"
},
{
"text": "场景",
@@ -198,15 +198,5 @@
"bounce": "none"
}
},
"uniIdRouter": {},
"condition" : { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
"list": [
{
"name": "", //模式名称
"path": "", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到
}
]
}
"uniIdRouter": {}
}
+7 -2
View File
@@ -147,8 +147,13 @@
></image>
</view>
<view class="icon text-btn" v-if="type === 1" @click.stop="translateVoice(dataInfo)"></view>
<view class="icon text-right-btn" @click.stop="finishQuestion(dataInfo)" v-if="isLast">完成</view>
<view class="icon text-right-btn" @click.stop="withdraw" v-show="showWithdraw">撤回
<view class="icon text-right-btn" @click.stop="finishQuestion(dataInfo)" v-show="isLast">完成</view>
<view
class="icon text-right-btn"
@click.stop="withdraw"
v-show="isLast"
>撤回
<!-- v-show="showWithdraw" -->
</view>
</view>
</view>
+32 -7
View File
@@ -38,7 +38,7 @@
</template>
<script setup>
import { toRefs, ref, computed, unref, onMounted, onUnmounted, nextTick } from 'vue';
import { toRefs, ref, computed, unref, onMounted, onUnmounted, nextTick, watch } from 'vue';
import common from '../../../common/common';
import permission from '@/common/permission.js'
const emit = defineEmits(['uploadVoice', 'submitAnswer','startRecord'])
@@ -46,9 +46,17 @@ const props = defineProps({
isDisabled:{
default: Boolean,
type: true
},
isLoading:{
default: false,
type: Boolean
}
})
const { isDisabled } = toRefs(props)
const isLoadingState = computed(() => props.isLoading)
watch(()=>props.isLoading,()=>{},{
deep:true,immediate:true
})
const showTalkingModel = ref(false)
const keyboardIsShow = ref(false)
const answerValue = ref('')
@@ -63,6 +71,12 @@ const initRecord = () => {
recordObjCom.value = uni.getRecorderManager()
unref(recordObjCom)?.onStop((res, duration)=>{
audioPath.value = res.tempFilePath
uni.saveFile({
tempFilePath:res.tempFilePath,
success:(res)=>{
console.log(res)
}
})
})
unref(recordObjCom).start({format:'mp3'})
stopRecord()
@@ -99,10 +113,6 @@ onMounted(async ()=>{
// }
// // #endif
})
// const playRecord = () => {
// audioObj.src = audioPath.value
// unref(audioObj).play()
// }
// 录音结束
// 记录 按下移动位置
@@ -116,6 +126,9 @@ const isOut = computed(() => {
let moveVal = (windowInfo.screenHeight - touchY.value) > _btnHeight
return moveVal
})
const outScreen = computed(()=>{
(windowInfo.screenHeight - touchY.value) <= 0
})
const recNum = ref(1)
const activeNum = ref(1)
@@ -135,8 +148,16 @@ const getRecordPermission = async (obj) => {
// #endif
}
const showOverlayTalking = (obj) => {
recNum.value += 1
if(isLoadingState.value){
uni.showToast({
title: '发送回答中,请稍后再试!',
icon: "none",
duration:1000
})
return
}
emit('startRecord')
recNum.value += 1
if(!isDisabled.value){
showTalkingModel.value = true
touchX.value = obj.changedTouches[0].pageX
@@ -150,7 +171,7 @@ const showOverlayTalking = (obj) => {
},59 * 1010)
}else{
uni.showToast({
title: '请先获取问题信息',
title: '暂无问题需要回答',
icon: "none",
duration:1000
})
@@ -169,6 +190,7 @@ const hideOverlayTalking = (obj) => {
},1000)
}
}else{
showTalkingModel.value = false
common.msg('录音失败,请重试!')
}
activeNum.value = recNum.value
@@ -177,6 +199,9 @@ const hideOverlayTalking = (obj) => {
const handleMove = (obj) => {
touchX.value = obj.changedTouches[0].pageX
touchY.value = obj.changedTouches[0].pageY
if(outScreen.value){
hideOverlayTalking(obj)
}
}
// 发送文本
const showKeyboard = () => {
+22 -6
View File
@@ -82,7 +82,8 @@
@uploadVoice="uploadRecordNow"
@submitAnswer="submitAnswerNow"
@startRecord="changePlayItemId('')"
:isDisabled="((lastTalkingInfo.type||0) !== 4) || isUploadingVoice"
:isLoading="isUploadingVoice"
:isDisabled="((lastTalkingInfo.type||0) !== 4)"
/>
</view>
<uv-overlay :show="showSeekModel" opacity=".6" @click="showSeekModel = false">
@@ -194,7 +195,7 @@ const getData = async (flag) => {
step.value = 2
return
}
common.show('提示信息', '此门课程已有学习历史,请选择是否继续学习?',true, '重新开始','继续学习').then((res) => {
common.show('提示', '系统检测到您已存在学习记录,要继续学习',true, '重新学习','继续学习').then((res) => {
if(res) {
// 继续学习 获取学习历史接口
// 滚动到最下面
@@ -341,7 +342,7 @@ const getGraphInfoUnStudy = (flag = 0) => {
common.show('恭喜你已学完全部知识点', '有什么心得跟我们分享吗?',true, '取消','去评论').then((res) => {
if(res) {
// 去评论
common.navigateTo(`/pages/courseDetail/submit?crsId=${crsId.value}&crsNum=${crsNum.value}&from=study`)
common.navigateTo(`/pages/courseDetail/submit?crsId=${crsId.value}&crsNum=${crsNum.value}&from=study&imgId=${imageId.value}`)
}else{
// 取消
common.navigateTo(`/pages/courseDetail/index?crsId=${crsId.value}&crsNum=${crsNum.value}&from=study`)
@@ -565,9 +566,11 @@ const sendMessage = (data) => {
}
// ws 结束
const startPgrphId = ref('')
const imageId = ref('')
onLoad((params) => {
crsId.value = params.crsId||'';
crsNum.value = params.crsNum||'';
imageId.value = params.imgId || ''
startPgrphId.value = params.pgrphId||'';
getData('1');
});
@@ -617,7 +620,7 @@ const uploadRecordNow = (voicePath) => {
userInfo: {...choiceTeacherInfo.value},
id: _id
})
isUploadingVoice.value = false
setIsUploadingVoice()
scrollToBottomNow()
// #endif
//#ifdef APP-PLUS
@@ -660,9 +663,9 @@ const uploadRecordNow = (voicePath) => {
})
scrollToBottomNow()
}else{}
isUploadingVoice.value = false
setIsUploadingVoice()
}).catch(err=>{
isUploadingVoice.value = false
setIsUploadingVoice()
talkingList.value = talkingList.value.filter(t=>t.id !== _id)
uni.showToast({
title: '系统异常,请联系管理员',
@@ -672,12 +675,22 @@ const uploadRecordNow = (voicePath) => {
})
// #endif
}
const setIsUploadingVoice = (flag = false) => {
if(flag){
isUploadingVoice.value = true
}else{
setTimeout(()=>{
isUploadingVoice.value = false
},100)
}
}
// 发送文本
const submitAnswerNow = (val, cb) => {
if(!testAnswer.value){
common.msg('每个问题最多连续发送五次答案!')
return
}
isUploadingVoice.value = true
let _data = {
qnsId: unref(lastTalkingInfo).qnsId,// 问题ID 必输项:true 类型:String
pgrphId: unref(lastTalkingInfo).pgrphId,// 段落ID 必输项:true 类型:String
@@ -691,6 +704,7 @@ const submitAnswerNow = (val, cb) => {
requestBody: JSON.stringify(_data)
})
.then(res=>{
setIsUploadingVoice()
let _id = new Date().getTime() + 'id'
let _body = res.body|| {}
if(!_body.chatBody) {
@@ -709,6 +723,8 @@ const submitAnswerNow = (val, cb) => {
})
scrollToBottomNow()
cb && cb()
}).catch(()=>{
setIsUploadingVoice()
})
}
// 撤回
+1 -1
View File
@@ -52,7 +52,7 @@
<view class="btn-box btn-box-height font_pf" v-if="[0,1].includes(tabAct)">
<uv-button type="primary"
@click="common.navigateTo('/pages/course/study?crsNum='+crsNum+'&crsId='+form.crsId)">去学习</uv-button>
@click="common.navigateTo('/pages/course/study?crsNum='+crsNum+'&crsId='+form.crsId + '&imgId=' + form.imgId)">去学习</uv-button>
<uv-button type="primary">去练习</uv-button>
<uv-button type="primary">去考试</uv-button>
+6 -4
View File
@@ -3,7 +3,7 @@
<!-- <MarkdownPreview/> -->
<view class="top-bg"></view>
<view class="bot-bg"></view>
<view class="index-dialog-body">
<scroll-view class="index-dialog-body" :scroll-y="true" upper-threshold="0" refresher-enabled="true" refresher-default-style="none" @refresherrefresh="scrolltolower">
<view class="seek-setting">
设置
<image src="@/static/images/course/setting.png" alt="" class="image-icon"></image>
@@ -84,7 +84,7 @@
@startRecord="startRecordCallback"
:isDisabled="false"
/>
</view>
</scroll-view>
</view>
</template>
@@ -126,14 +126,16 @@
const routerTo = (type) => {
switch(type){
case 'AI学':
common.navigateTo('/pages/course/index')
common.switchTab('/pages/course/index')
break;
default:
common.msg('页面建设中,敬请期待!')
break;
}
}
const scrolltolower = () => {
common.switchTab('/pages/index/index')
}
const uploadRecordNow = (voicePath) => {
}
+1 -1
View File
@@ -80,7 +80,7 @@
<!-- 8个导航 -->
<view class="navigation_div">
<view class="group">
<view class="item" @click="common.navigateTo('/pages/course/index')">
<view class="item" @click="common.switchTab('/pages/course/index')">
<image class="icon" src="@/static/images/index/navigation_course.png"></image>
<view class="title">课程中心</view>
</view>
+1 -1
View File
@@ -62,7 +62,7 @@
},
{
"text": "学习",
"pagePath": "pages/study/index"
"pagePath": "pages/course/index"
},
{
"text": "场景",