Merge branch 'dev-recording' into develop
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
@@ -46,4 +46,15 @@
|
||||
height: 50rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&.blue{
|
||||
background-color: #06f;
|
||||
&.inputMode {
|
||||
border: 2rpx solid #dedede00;
|
||||
}
|
||||
|
||||
&.action {
|
||||
background-color: #0066ff99;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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: ''
|
||||
}
|
||||
});
|
||||
// 兼容以前的按钮参数
|
||||
|
||||
@@ -623,7 +623,8 @@
|
||||
};
|
||||
const downloadFnc = ref(null)
|
||||
const playVoice = (readType = 'pgth') => {
|
||||
console.log('playVoice11111111')
|
||||
|
||||
console.log(unref(dataInfo))
|
||||
if (voiceIsPlaying.value) return
|
||||
let _content = showContent.value;
|
||||
if (!_content) {
|
||||
@@ -765,6 +766,37 @@
|
||||
setTimeout(() => {
|
||||
setVoiceTime(0);
|
||||
}, 100);
|
||||
}else{
|
||||
console.log(type.value)
|
||||
if(type.value === 1){
|
||||
|
||||
downloadFile(unref(dataInfo).bucketKey)
|
||||
.then((res) => {
|
||||
|
||||
if (res?.data) {
|
||||
common.msg(res.data.message);
|
||||
return;
|
||||
}
|
||||
voiceLoading.value = false;
|
||||
itemVoice.value = res.tempFilePath;
|
||||
talkVoiceObj.value.src = res.tempFilePath;
|
||||
console.log('talkVoiceObj.value.src', talkVoiceObj.value.src)
|
||||
if (voiceIsPlaying.value) return
|
||||
if(unref(dataInfo)?.id !== props.activeVoiceId) return
|
||||
talkVoiceObj.value.play();
|
||||
console.log('播放')
|
||||
storageStore.setStorage('audio', unref(dataInfo)?.id, itemVoice.value);
|
||||
setTimeout(()=>{
|
||||
setVoiceTime(0)
|
||||
},100)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('err',err)
|
||||
voiceLoading.value = false;
|
||||
emit('changePlay', '');
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
// else{
|
||||
// setTimeout(()=>{
|
||||
@@ -783,33 +815,39 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
// const setVoiceTime = (sum) => {
|
||||
// sum += 1;
|
||||
// if (talkVoiceObj.value.duration) {
|
||||
// voiceTime.value = (Math.ceil(talkVoiceObj.value.duration) || 0) + 's';
|
||||
// } else {
|
||||
// if (sum === 100) {
|
||||
// voiceTime.value = (unref(dataInfo).voiceTime || 0) + 's';
|
||||
// return;
|
||||
// }
|
||||
// setTimeout(() => {
|
||||
// setVoiceTime(sum);
|
||||
// }, 300);
|
||||
// }
|
||||
// };
|
||||
const playQnsVoice = (readType = 'qns', item) => {
|
||||
console.log(type.value)
|
||||
if (type.value === 2) {
|
||||
// 文本转语音
|
||||
playVoice(readType);
|
||||
return;
|
||||
}else{
|
||||
emit('changePlay', unref(dataInfo)?.id)
|
||||
if(talkVoiceObj.value && talkVoiceObj.value.src) {
|
||||
console.log(2)
|
||||
console.log('talkVoiceObj.value.src', talkVoiceObj.value.src)
|
||||
talkVoiceObj.value.play()
|
||||
return
|
||||
}else{
|
||||
console.log(3)
|
||||
talkVoiceObj.value.src = ''
|
||||
if(unref(dataInfo).talkingVoice){
|
||||
setTimeout(()=>{
|
||||
talkVoiceObj.value.src = unref(dataInfo).talkingVoice
|
||||
talkVoiceObj.value.play()
|
||||
isPlaying.value = true
|
||||
},100)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// readType 阅读内容类型pgrh段落/qns问题
|
||||
emit('changePlay', unref(dataInfo)?.id);
|
||||
setTimeout(() => {
|
||||
itemVoice.value = item.talkingVoice;
|
||||
talkVoiceObj.value.src = item.talkingVoice;
|
||||
talkVoiceObj.value.play();
|
||||
}, 100);
|
||||
// // readType 阅读内容类型pgrh段落/qns问题
|
||||
// emit('changePlay', unref(dataInfo)?.id);
|
||||
// setTimeout(() => {
|
||||
// itemVoice.value = item.talkingVoice;
|
||||
// talkVoiceObj.value.src = item.talkingVoice;
|
||||
// talkVoiceObj.value.play();
|
||||
// }, 100);
|
||||
};
|
||||
const translateLoading = ref(false);
|
||||
// 翻译
|
||||
|
||||
+1811
-1720
File diff suppressed because it is too large
Load Diff
@@ -163,12 +163,12 @@
|
||||
const sendReply = (data) => {
|
||||
console.log(data,'111111111111')
|
||||
commentRef.value?.setReplyData(data, ()=>{
|
||||
commentInputRef.value.hideAll(true)
|
||||
commentInputRef.value?.hideAll(true)
|
||||
});
|
||||
}
|
||||
const hideKeyboradNow = () => {
|
||||
if (isShowing.value) return
|
||||
commentInputRef.value.hideAll()
|
||||
commentInputRef.value?.hideAll()
|
||||
}
|
||||
const getData = async () => {
|
||||
common.loading();
|
||||
|
||||
@@ -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
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user