Merge branch 'develop' into 'sit'

Develop

See merge request K17_AITS/tra-app!13
This commit is contained in:
田岩
2025-07-11 18:14:00 +08:00
4 changed files with 95 additions and 26 deletions
+41 -7
View File
@@ -1,6 +1,17 @@
<template>
<view class="video-view-box">
<video class="video-cont" v-if="fileUrlShow" :src="fileUrlShow" controls></video>
<view class="video-view-box" @click="showModel = true">
<view class="img-box">
<image
class="icon"
src="@/static/images/course/play.png"
style="width: 100%;height: 100%;"
></image>
</view>
<uv-overlay :show="showModel" opacity=".6" @click.stop="showModel = false">
<view class="overlay-box" @click.stop="showModel = false">
<video class="video-cont-center" v-if="showModel && fileUrlShow" :src="fileUrlShow" controls @error="playError" object-fit="contain"></video>
</view>
</uv-overlay>
</view>
</template>
@@ -17,6 +28,7 @@
},
data() {
return {
showModel: false,
fileUrlShow:'',
watching:false
};
@@ -30,7 +42,7 @@
watch: {
fileId: {
handler(newval, oldval) {
if(newval.indexOf('http:') === 0){
if(newval.indexOf('http') === 0){
this.fileUrlShow = newval
return
}
@@ -43,6 +55,9 @@
}
},
methods: {
playError(info){
console.log('err',info)
},
getPreviewUrlBlob(id) {
if (!id) {
this.fileUrlShow = ''
@@ -60,8 +75,9 @@
},
},
mounted() {
console.log(this.fileId)
if (this.fileId) {
if(this.fileId.indexOf('http:') === 0){
if(this.fileId.indexOf('http') === 0){
this.fileUrlShow = this.fileId
}else{
this.getPreviewUrlBlob(this.fileId);
@@ -72,13 +88,31 @@
}
</script>
<style>
<style lang="scss" scoped>
.video-view-box{
width: 100%;
height: 100%;
background-color: #eee;
background-color: #fafafa !important;
position: relative;
}
.video-view-box .video-cont{
.img-box{
position: absolute;
left: 50%;
top: 50%;
width: 100rpx;
height: 100rpx;
transform: translate(-50%, -50%);
}
.overlay-box .video-cont-center{
max-width: 100%;
max-height: 80%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.overlay-box{
position: relative;
width: 100%;
height: 100%;
}
+32 -7
View File
@@ -23,9 +23,9 @@
<!-- 请您思考并作答:<br> -->
{{ showContent }}
</text>
<view v-if="type === 3">
<view v-if="type === 3" style="overflow: hidden;">
<ImagePreview class="cont-img-box" v-if="(dataInfo.imageAddrs||[]).length>0" :imgId="dataInfo.imageAddrs[0]" :previewDetail="true"></ImagePreview>
<VideoPreview class="cont-img-box" v-if="(dataInfo.vidoAddrs||[]).length>0" :imgId="dataInfo.vidoAddrs[0]"></VideoPreview>
<VideoPreview class="cont-img-box" v-if="(dataInfo.vidoAddrs||[]).length>0" :fileId="dataInfo.vidoAddrs[0]"></VideoPreview>
</view>
<view v-if="type === 5 && !dataInfo.isLoading" style="padding-top: 16rpx;">
<ChartFour v-if="dataInfo.evalDimens.length === 4" :dataList="dataInfo.evalDimens" :score="dataInfo.intrctGrade"/>
@@ -124,6 +124,7 @@
<view :class="['talking-gif', !voiceLoading && (activeVoiceId === dataInfo.id) ? 'is-play' : '']">
<CommonLoading color="#fff" v-show="voiceLoading || dataInfo.isLoading"/>
</view>
<view class="right-time">{{voiceTime}}s</view>
<view class="talking-cont" v-show="!dataInfo.isLoading">
<text :class="['talking-text translate-text loading']" v-show="!translateLoading">
{{ showContent }}
@@ -152,7 +153,7 @@
</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(dataInfo)" v-show="showWithdraw">撤回
<view class="icon text-right-btn" @click.stop="withdraw" v-show="showWithdraw">撤回
</view>
</view>
</view>
@@ -297,7 +298,11 @@ const audioCacheObj = computed(() => storageStore.audioObj)
const changeBr = (str = '') => {
return str.replace(/\/n/g,"\n")
}
const voiceTime = ref('')
onMounted(()=>{
console.log()
initVoice()
})
onUnload(()=>{
pauseVoice()
})
@@ -384,6 +389,16 @@ const audioCacheObj = computed(() => storageStore.audioObj)
})
}
}
const initVoice = (readType = 'qns', item, isplay=false) => {
if(unref(dataInfo).talkingVoice){
itemVoice.value = unref(dataInfo).talkingVoice
talkVoiceObj.value.src = itemVoice.value
setTimeout(()=>{
voiceTime.value = Math.ceil(talkVoiceObj.value.duration) || 0 + 's'
console.log(voiceTime.value)
},100)
}
}
const playQnsVoice = (readType = 'qns', item) =>{
if(type.value === 2){
// 文本转语音
@@ -436,8 +451,9 @@ const audioCacheObj = computed(() => storageStore.audioObj)
emit('nextQuestion', unref(dataInfo), 'reStartPrgh')
}
// 撤回
const withdraw = (data) => {
emit('withdraw',data)
const withdraw = () => {
console.log(unref(dataInfo))
emit('withdraw', unref(dataInfo))
}
// 完成
const finishQuestion = (data) => {
@@ -527,7 +543,7 @@ const audioCacheObj = computed(() => storageStore.audioObj)
height: 269rpx;
border-radius: 15rpx;
overflow: hidden;
background-color: #eee;
background-color: #fafafa;
margin-bottom: 20rpx;
}
}
@@ -663,6 +679,7 @@ const audioCacheObj = computed(() => storageStore.audioObj)
border-radius: 15rpx;
background-color: #06f;
padding-bottom: 30rpx;
position: relative;
color: #fff;
.talking-gif{
width: 200rpx;
@@ -675,6 +692,14 @@ const audioCacheObj = computed(() => storageStore.audioObj)
background-size: contain;
}
}
.right-time{
position: absolute;
right: 20rpx;
top: 20rpx;
font-size: 28rpx;
height: 38rpx;
line-height: 38rpx;
}
.talking-cont{
margin-top: 16rpx;
overflow: hidden;
+20 -9
View File
@@ -39,6 +39,7 @@
<script setup>
import { toRefs, ref, computed, unref, onMounted, onUnmounted, nextTick } from 'vue';
import common from '../../../common/common';
const emit = defineEmits(['uploadVoice', 'submitAnswer','startRecord'])
const props = defineProps({
answerType:{
@@ -60,7 +61,6 @@ const recordObjCom = uni.getRecorderManager()
const initRecord = () => {
unref(recordObjCom)?.onStop((res, duration)=>{
audioPath.value = res.tempFilePath
console.log(duration)
})
}
const startRecord = () => {
@@ -94,7 +94,10 @@ const isOut = computed(() => {
let moveVal = (windowInfo.screenHeight - touchY.value) > _btnHeight
return moveVal
})
const recNum = ref(1)
const activeNum = ref(1)
const showOverlayTalking = (obj) => {
recNum.value += 1
emit('startRecord')
if(answerType.value === 4){
showTalkingModel.value = true
@@ -104,6 +107,9 @@ const showOverlayTalking = (obj) => {
//#ifdef APP-PLUS
startRecord()
// #endif
setTimeout(() => {
hideOverlayTalking()
},59 * 1010)
}else{
uni.showToast({
title: '请先获取问题信息!',
@@ -114,15 +120,20 @@ const showOverlayTalking = (obj) => {
}
const hideOverlayTalking = (obj) => {
if(!showTalkingModel.value) return
showTalkingModel.value = false
//#ifdef APP-PLUS
stopRecord()
// #endif
if(!isOut.value){
setTimeout(()=>{
emit('uploadVoice', audioPath.value)
},1000)
if(activeNum.value + 1 === recNum.value){
showTalkingModel.value = false
//#ifdef APP-PLUS
stopRecord()
// #endif
if(!isOut.value){
setTimeout(()=>{
emit('uploadVoice', audioPath.value)
},1000)
}
}else{
common.msg('录音失败,请重试!')
}
activeNum.value = recNum.value
}
const handleMove = (obj) => {
+2 -3
View File
@@ -597,7 +597,6 @@ const uploadRecordNow = (voicePath) => {
requestBody: JSON.stringify(_data)
}).then(res=>{
let _res = JSON.parse(res.data)
console.log(_res)
if(_res.rtnCode === '0000'){
talkingList.value = talkingList.value.map(t=>{
if(t.id === _id){
@@ -608,7 +607,7 @@ const uploadRecordNow = (voicePath) => {
qnsId: _data.qnsId,
talkingContent: '',
talkingVoice: voicePath,
intrctId: _res.chatBody,
intrctId: _res.body.chatBody,
type: 1,
userInfo: {...choiceTeacherInfo.value},
id: _id
@@ -690,7 +689,7 @@ const finishQuestionNow = (data) => {
.then(res=> {
// common.msg('完成成功,开始获取评分维度数据!')
let _state = res.body.chatBody.processStat
if(_state = 'ER'){
if(_state === 'ER'){
common.msg('提交答案失败!')
return
}