Merge branch 'develop' of http://25.13.9.101:9000/K17_AITS/tra-app into develop

This commit is contained in:
田岩
2026-03-12 08:35:54 +08:00
4 changed files with 38 additions and 13 deletions
+2 -2
View File
@@ -2,9 +2,9 @@
ENV = 'development.yh' ENV = 'development.yh'
# '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_H5_API_Url = 'http://25.18.122.78:9786'
# VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' # VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002'
# VITE_APP_BASE_H5_API_Url_TRAEXAM = 'http://25.64.32.154:9604' # VITE_APP_BASE_H5_API_Url_TRAEXAM = 'http://25.64.32.154:9604'
+1
View File
@@ -56,6 +56,7 @@ export function downloadFile(id = '', url = '') {
header['summary'] = token header['summary'] = token
let baseUrl = get_base_url(); let baseUrl = get_base_url();
let _url = id?`${baseUrl}/traoss/tras3/show/${id}?tk=${token}`:`${url}?tk=${token}` let _url = id?`${baseUrl}/traoss/tras3/show/${id}?tk=${token}`:`${url}?tk=${token}`
console.log(_url)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.downloadFile({ uni.downloadFile({
url: _url, url: _url,
+34 -11
View File
@@ -53,7 +53,8 @@
} from '@/common/common.js'; } from '@/common/common.js';
import { import {
downloadFile, downloadFile,
downloadVoiceFile downloadVoiceFile,
getPreviewFileUrl
} from '@/api/common.js' } from '@/api/common.js'
import { import {
useStorageStore useStorageStore
@@ -110,11 +111,12 @@
const pauseVoice = (flag) => { const pauseVoice = (flag) => {
if (!talkUserVoiceObj.value) return if (!talkUserVoiceObj.value) return
talkUserVoiceObj.value.pause() talkUserVoiceObj.value.pause()
if (flag === 'destory') talkVoiceObj.value.destory() if (flag === 'destory') talkUserVoiceObj.value.destory()
isPlaying.value = false isPlaying.value = false
emit('changePlay', '') emit('changePlay', '')
} }
const playVoice = () => { const playVoice = () => {
console.log(talkUserVoiceObj.value, 1111)
emit('changePlay', unref(dataInfo)?.id) emit('changePlay', unref(dataInfo)?.id)
talkUserVoiceObj.value.volume = 1 talkUserVoiceObj.value.volume = 1
if (isTesting.value) { if (isTesting.value) {
@@ -130,29 +132,50 @@
return return
} else { } else {
voiceLoading.value = true; 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) => { storageStore.getStorageById('audio', _id, (url) => {
if (url) { if (url) {
voiceLoading.value = false; voiceLoading.value = false;
itemVoice.value = url; itemVoice.value = url;
talkVoiceObj.value.src = url; talkUserVoiceObj.value.src = url;
if (voiceIsPlaying.value) return
if (unref(dataInfo)?.id !== props.activeVoiceId) return if (unref(dataInfo)?.id !== props.activeVoiceId) return
talkVoiceObj.value.play(); talkUserVoiceObj.value.play();
} else { } else {
// downloadVoiceFile(`/traoss/tras3/show/${_id}`)
// .then((res) => {
downloadFile(_id) downloadFile(_id)
.then((res) => { .then((res) => {
console.log(res)
if (res?.data) { if (res?.data) {
common.msg(res.data.message); common.msg(res.data.message);
return; return;
} }
voiceLoading.value = false; voiceLoading.value = false;
itemVoice.value = res.tempFilePath; itemVoice.value = res.tempFilePath;
talkVoiceObj.value.src = res.tempFilePath; talkUserVoiceObj.value.src = res.tempFilePath;
if (voiceIsPlaying.value) return
if (unref(dataInfo)?.id !== props.activeVoiceId) return if (unref(dataInfo)?.id !== props.activeVoiceId) return
talkVoiceObj.value.play(); talkUserVoiceObj.value.play();
storageStore.setStorage('audio', _id, itemVoice.value); 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) => { .catch((err) => {
voiceLoading.value = false; voiceLoading.value = false;
@@ -187,7 +210,7 @@
talkUserVoiceObj.value.onCanplay(() => { talkUserVoiceObj.value.onCanplay(() => {
setVoiceTime(0) setVoiceTime(0)
}) })
itemVoice.value = unref(dataInfo).talkingVoice // itemVoice.value = unref(dataInfo).talkingVoice
// talkUserVoiceObj.value.src = itemVoice.value // talkUserVoiceObj.value.src = itemVoice.value
// talkUserVoiceObj.value.sessionCategory = 'soloAmbient' // talkUserVoiceObj.value.sessionCategory = 'soloAmbient'
// //#ifdef APP-PLUS // //#ifdef APP-PLUS
@@ -227,7 +250,7 @@
deep: true, deep: true,
immediate: true immediate: true
}) })
watch(() => props.dataInfo.talkingVoice, (val) => { watch(() => props.dataInfo.ossKey, (val) => {
if (val) { if (val) {
initVoice() initVoice()
} }
+1
View File
@@ -220,6 +220,7 @@
}) => { }) => {
console.log('新发送语音', ossKey, text); console.log('新发送语音', ossKey, text);
if (!ossKey) { if (!ossKey) {
talkingList.value.pop();
uni.showToast({ uni.showToast({
title: '系统异常,请联系管理员', title: '系统异常,请联系管理员',
icon: 'none', icon: 'none',