Merge branch 'develop' of http://25.13.9.101:9000/K17_AITS/tra-app into develop
This commit is contained in:
+2
-2
@@ -2,9 +2,9 @@
|
||||
ENV = 'development.yh'
|
||||
# 'development.yh'
|
||||
|
||||
# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001'
|
||||
VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001'
|
||||
|
||||
VITE_APP_BASE_H5_API_Url = 'http://25.18.122.91:9786'
|
||||
# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.91:9786'
|
||||
# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.78:9786'
|
||||
# VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002'
|
||||
# VITE_APP_BASE_H5_API_Url_TRAEXAM = 'http://25.64.32.154:9604'
|
||||
|
||||
@@ -56,6 +56,7 @@ export function downloadFile(id = '', url = '') {
|
||||
header['summary'] = token
|
||||
let baseUrl = get_base_url();
|
||||
let _url = id?`${baseUrl}/traoss/tras3/show/${id}?tk=${token}`:`${url}?tk=${token}`
|
||||
console.log(_url)
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.downloadFile({
|
||||
url: _url,
|
||||
|
||||
@@ -53,7 +53,8 @@
|
||||
} from '@/common/common.js';
|
||||
import {
|
||||
downloadFile,
|
||||
downloadVoiceFile
|
||||
downloadVoiceFile,
|
||||
getPreviewFileUrl
|
||||
} from '@/api/common.js'
|
||||
import {
|
||||
useStorageStore
|
||||
@@ -110,11 +111,12 @@
|
||||
const pauseVoice = (flag) => {
|
||||
if (!talkUserVoiceObj.value) return
|
||||
talkUserVoiceObj.value.pause()
|
||||
if (flag === 'destory') talkVoiceObj.value.destory()
|
||||
if (flag === 'destory') talkUserVoiceObj.value.destory()
|
||||
isPlaying.value = false
|
||||
emit('changePlay', '')
|
||||
}
|
||||
const playVoice = () => {
|
||||
console.log(talkUserVoiceObj.value, 1111)
|
||||
emit('changePlay', unref(dataInfo)?.id)
|
||||
talkUserVoiceObj.value.volume = 1
|
||||
if (isTesting.value) {
|
||||
@@ -130,29 +132,50 @@
|
||||
return
|
||||
} else {
|
||||
voiceLoading.value = true;
|
||||
let _id = unref(dataInfo)?.fileId
|
||||
let _id = unref(dataInfo)?.fileId || unref(dataInfo)?.ossKey
|
||||
console.log('dataInfo', unref(dataInfo))
|
||||
storageStore.getStorageById('audio', _id, (url) => {
|
||||
if (url) {
|
||||
voiceLoading.value = false;
|
||||
itemVoice.value = url;
|
||||
talkVoiceObj.value.src = url;
|
||||
if (voiceIsPlaying.value) return
|
||||
talkUserVoiceObj.value.src = url;
|
||||
if (unref(dataInfo)?.id !== props.activeVoiceId) return
|
||||
talkVoiceObj.value.play();
|
||||
talkUserVoiceObj.value.play();
|
||||
} else {
|
||||
// downloadVoiceFile(`/traoss/tras3/show/${_id}`)
|
||||
// .then((res) => {
|
||||
downloadFile(_id)
|
||||
.then((res) => {
|
||||
console.log(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
|
||||
talkUserVoiceObj.value.src = res.tempFilePath;
|
||||
if (unref(dataInfo)?.id !== props.activeVoiceId) return
|
||||
talkVoiceObj.value.play();
|
||||
talkUserVoiceObj.value.play();
|
||||
storageStore.setStorage('audio', _id, itemVoice.value);
|
||||
// uni.saveFile({
|
||||
// tempFilePath: res.tempFilePath,
|
||||
// success:(_res)=>{
|
||||
// voiceLoading.value = false;
|
||||
// itemVoice.value = _res.savedFilePath;
|
||||
// talkUserVoiceObj.value.src = _res.savedFilePath;
|
||||
// if (unref(dataInfo)?.id !== props.activeVoiceId) return
|
||||
// talkUserVoiceObj.value.play();
|
||||
// storageStore.setStorage('audio', _id, itemVoice.value);
|
||||
// },
|
||||
// fail:() => {
|
||||
// emit('changePlay', '');
|
||||
// voiceLoading.value = false;
|
||||
// },
|
||||
// complete:()=>{
|
||||
// voiceLoading.value = false;
|
||||
// }
|
||||
// })
|
||||
})
|
||||
.catch((err) => {
|
||||
voiceLoading.value = false;
|
||||
@@ -187,7 +210,7 @@
|
||||
talkUserVoiceObj.value.onCanplay(() => {
|
||||
setVoiceTime(0)
|
||||
})
|
||||
itemVoice.value = unref(dataInfo).talkingVoice
|
||||
// itemVoice.value = unref(dataInfo).talkingVoice
|
||||
// talkUserVoiceObj.value.src = itemVoice.value
|
||||
// talkUserVoiceObj.value.sessionCategory = 'soloAmbient'
|
||||
// //#ifdef APP-PLUS
|
||||
@@ -227,7 +250,7 @@
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
watch(() => props.dataInfo.talkingVoice, (val) => {
|
||||
watch(() => props.dataInfo.ossKey, (val) => {
|
||||
if (val) {
|
||||
initVoice()
|
||||
}
|
||||
|
||||
@@ -220,6 +220,7 @@
|
||||
}) => {
|
||||
console.log('新发送语音', ossKey, text);
|
||||
if (!ossKey) {
|
||||
talkingList.value.pop();
|
||||
uni.showToast({
|
||||
title: '系统异常,请联系管理员',
|
||||
icon: 'none',
|
||||
|
||||
Reference in New Issue
Block a user