代码问题
This commit is contained in:
@@ -41,7 +41,8 @@ export const ChatMessageApi = {
|
|||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
Authorization: `Bearer ${token}`
|
Authorization: `Bearer ${token}`,
|
||||||
|
'tenant-id': import.meta.env?.VITE_TENANT_ID
|
||||||
},
|
},
|
||||||
openWhenHidden: true,
|
openWhenHidden: true,
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ export const useVoiceCopyStore = defineStore('voiceCopy', {
|
|||||||
/**
|
/**
|
||||||
* 加载配音列表
|
* 加载配音列表
|
||||||
*/
|
*/
|
||||||
async load() {
|
async load(forceRefresh = false) {
|
||||||
if (this.loaded && !this.loading) return
|
if(!forceRefresh){
|
||||||
|
if (this.loaded && !this.loading) return
|
||||||
|
}
|
||||||
|
|
||||||
this.loading = true
|
this.loading = true
|
||||||
try {
|
try {
|
||||||
@@ -166,7 +168,7 @@ export const useVoiceCopyStore = defineStore('voiceCopy', {
|
|||||||
*/
|
*/
|
||||||
async refresh() {
|
async refresh() {
|
||||||
this.loaded = false
|
this.loaded = false
|
||||||
await this.load()
|
await this.load(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* 试听优化:添加缓存机制,同一参数下第二次试听直接播放缓存,无需重复调用API
|
* 试听优化:添加缓存机制,同一参数下第二次试听直接播放缓存,无需重复调用API
|
||||||
*/
|
*/
|
||||||
defineOptions({ name: 'DigitalVideoPage' })
|
defineOptions({ name: 'DigitalVideoPage' })
|
||||||
import { ref, computed, onMounted, watch, onUnmounted } from 'vue'
|
import { ref, computed, onMounted, watch, onUnmounted, onActivated } from 'vue'
|
||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
import { InboxOutlined, SoundOutlined, LoadingOutlined } from '@ant-design/icons-vue'
|
import { InboxOutlined, SoundOutlined, LoadingOutlined } from '@ant-design/icons-vue'
|
||||||
import { VoiceService } from '@/api/voice'
|
import { VoiceService } from '@/api/voice'
|
||||||
@@ -40,7 +40,7 @@ const MAX_PREVIEW_CACHE_SIZE = 50 // 最多缓存50个音色的试听音频
|
|||||||
// TTS 配置
|
// TTS 配置
|
||||||
const ttsText = ref('')
|
const ttsText = ref('')
|
||||||
const selectedTtsVoice = ref('')
|
const selectedTtsVoice = ref('')
|
||||||
const speechRate = ref(1.5)
|
const speechRate = ref(1.0)
|
||||||
const instruction = ref('neutral') // 指令参数,用于控制音色风格
|
const instruction = ref('neutral') // 指令参数,用于控制音色风格
|
||||||
const emotion = ref('neutral') // 情感参数
|
const emotion = ref('neutral') // 情感参数
|
||||||
const emotionActive = ref(false) // 是否激活情感tab(false为指令,true为情感)
|
const emotionActive = ref(false) // 是否激活情感tab(false为指令,true为情感)
|
||||||
@@ -730,7 +730,8 @@ const playAudioFromBase64 = (audioBase64, format = 'mp3', onEnded = null) => {
|
|||||||
|
|
||||||
// 生命周期
|
// 生命周期
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await voiceStore.load()
|
|
||||||
|
await voiceStore.refresh()
|
||||||
// 默认选择第一个音色
|
// 默认选择第一个音色
|
||||||
if (voiceSource.value === 'user' && userVoiceCards.value.length > 0) {
|
if (voiceSource.value === 'user' && userVoiceCards.value.length > 0) {
|
||||||
selectVoiceProfile(userVoiceCards.value[0])
|
selectVoiceProfile(userVoiceCards.value[0])
|
||||||
@@ -742,6 +743,8 @@ onMounted(async () => {
|
|||||||
await loadLastTask()
|
await loadLastTask()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
// 停止音频播放
|
// 停止音频播放
|
||||||
previewAudio?.pause?.()
|
previewAudio?.pause?.()
|
||||||
@@ -853,7 +856,6 @@ let previewObjectUrl = ''
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="voice-item-meta">
|
<div class="voice-item-meta">
|
||||||
<span class="voice-tag">{{ voice.category }}</span>
|
|
||||||
<a-button
|
<a-button
|
||||||
size="small"
|
size="small"
|
||||||
type="link"
|
type="link"
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
style="width: 300px"
|
style="width: 300px"
|
||||||
format="YYYY-MM-DD"
|
format="YYYY-MM-DD"
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
||||||
placeholder="['开始日期', '结束日期']"
|
:placeholder="['开始日期', '结束日期']"
|
||||||
@change="handleFilterChange"
|
@change="handleFilterChange"
|
||||||
/>
|
/>
|
||||||
<a-button type="primary" @click="handleFilterChange">查询</a-button>
|
<a-button type="primary" @click="handleFilterChange">查询</a-button>
|
||||||
|
|||||||
Reference in New Issue
Block a user