JLBA202505130001_关于吉林银行新建AI智能培训系统的需求_feat: 陪练语音按钮

This commit is contained in:
杨航
2026-03-10 10:01:35 +08:00
parent 66334c5290
commit 5e8d6931bd
5 changed files with 1159 additions and 964 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ ENV = 'development'
#VITE_APP_BASE_API_Url = 'https://aits.jlbank.com.cn:7001'
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7003'
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
# DEV
+11
View File
@@ -46,4 +46,15 @@
height: 50rpx;
}
}
&.blue{
background-color: #06f;
&.inputMode {
border: 2rpx solid #dedede00;
}
&.action {
background-color: #0066ff99;
}
}
}
+8 -2
View File
@@ -1,6 +1,6 @@
<template>
<view>
<view class="talk-btns-components" :class="{ action: isRecording, inputMode: !isInputVisible }">
<view :class="['talk-btns-components', props.theme, { action: isRecording, inputMode: !isInputVisible }]">
<view class="touch-btn" @click="disabled_click">
<button
v-if="isInputVisible"
@@ -11,7 +11,9 @@
@touchcancel="stopRecord()"
:plain="true"
>
<text class="voice-text">{{ isRecording ? '松开发送' : '按住说话' }}</text>
<slot>
<text class="voice-text">{{ isRecording ? '松开发送' : '按住说话' }}</text>
</slot>
</button>
<input
v-if="!isVoiceOnlyMode && !isInputVisible"
@@ -180,6 +182,10 @@
/* '01': '不限制回答方式', '02': '仅文字回答', '03': '仅语音回答'*/
return ['01', '02', '03'].includes(value);
}
},
theme: {
type: String,
default: ''
}
});
// 兼容以前的按钮参数
+46 -14
View File
@@ -51,6 +51,15 @@
import {
getPhoneEnvBool
} from '@/common/common.js';
import {
downloadFile,
downloadVoiceFile
} from '@/api/common.js'
import {
useStorageStore
} from '@/store/storage.js';
const storageStore = useStorageStore();
const props = defineProps({
dataInfo: {
default: () => ({}),
@@ -101,14 +110,14 @@
const pauseVoice = (flag) => {
if (!talkUserVoiceObj.value) return
talkUserVoiceObj.value.pause()
if(flag === 'destory') talkVoiceObj.value.destory()
if (flag === 'destory') talkVoiceObj.value.destory()
isPlaying.value = false
emit('changePlay', '')
}
const playVoice = () => {
emit('changePlay', unref(dataInfo)?.id)
talkUserVoiceObj.value.volume = 1
if(isTesting.value){
if (isTesting.value) {
restartPlay()
return
}
@@ -120,14 +129,37 @@
}, 300)
return
} else {
talkUserVoiceObj.value.src = ''
if (unref(dataInfo).talkingVoice) {
setTimeout(() => {
talkUserVoiceObj.value.src = itemVoice.value
talkUserVoiceObj.value.play()
isPlaying.value = true
}, 100)
}
voiceLoading.value = true;
let _id = unref(dataInfo)?.fileId
storageStore.getStorageById('audio', _id, (url) => {
if (url) {
voiceLoading.value = false;
itemVoice.value = url;
talkVoiceObj.value.src = url;
if (voiceIsPlaying.value) return
if (unref(dataInfo)?.id !== props.activeVoiceId) return
talkVoiceObj.value.play();
} else {
downloadFile(_id)
.then((res) => {
if (res?.data) {
common.msg(res.data.message);
return;
}
voiceLoading.value = false;
itemVoice.value = res.tempFilePath;
talkVoiceObj.value.src = res.tempFilePath;
if (voiceIsPlaying.value) return
if (unref(dataInfo)?.id !== props.activeVoiceId) return
talkVoiceObj.value.play();
storageStore.setStorage('audio', _id, itemVoice.value);
})
.catch((err) => {
voiceLoading.value = false;
emit('changePlay', '');
});
}
});
}
}
const IsAndEnv = getPhoneEnvBool('AND');
@@ -171,11 +203,11 @@
const setVoiceTime = (sum) => {
plus.io.getAudioInfo({
filePath: unref(dataInfo).talkingVoice,
success:(res)=>{
voiceTime.value = (Math.floor(res.duration) || 1) + 's'
success: (res) => {
voiceTime.value = (Math.floor(res.duration) || 1) + 's'
},
fail:(res)=>{
voiceTime.value = (props.dataInfo.voiceTime || 1) + 's'
fail: (res) => {
voiceTime.value = (props.dataInfo.voiceTime || 1) + 's'
}
})
// let _sum = sum + 1
+1093 -947
View File
File diff suppressed because it is too large Load Diff