|
@@ -16,13 +16,13 @@
|
|
|
<div class="drawerContent m-5">
|
|
|
<!-- <div class="text-lg my-2.5">数字人播报</div>-->
|
|
|
<n-list
|
|
|
- v-if="list && list.flat()"
|
|
|
+ v-if="list"
|
|
|
style="--n-color-modal: none"
|
|
|
:show-divider="false"
|
|
|
>
|
|
|
<!-- {{list}}-->
|
|
|
<n-list-item
|
|
|
- v-for="(vi, index) in list.flat()"
|
|
|
+ v-for="(vi, index) in list"
|
|
|
:key="index"
|
|
|
style="width: 100%"
|
|
|
>
|
|
@@ -30,7 +30,11 @@
|
|
|
{{ `当前空间${vi.media ? '视频' : '模型'}` }} ID: {{ vi.sid }}
|
|
|
</div>
|
|
|
|
|
|
- <n-select :options="audioOptions" ></n-select>
|
|
|
+ <n-select
|
|
|
+ v-model:value="vi.audioId"
|
|
|
+ :options="audioOptions"
|
|
|
+ @update:value="(val) => handleSelect(val, vi.sid)"
|
|
|
+ ></n-select>
|
|
|
</n-list-item>
|
|
|
</n-list>
|
|
|
</div>
|
|
@@ -60,25 +64,26 @@ const active = ref(true)
|
|
|
|
|
|
const boxVideos = computed(() => main.sceneInfo.boxVideos)
|
|
|
const boxModels = computed(() => main.sceneInfo.boxModels)
|
|
|
+const aiData = computed(() => main.getEditorData.aiSetting)
|
|
|
|
|
|
-const list = ref<any[]>([])
|
|
|
-
|
|
|
-const bindAudioIds = ref<{ id: string }[]>([])
|
|
|
-const bindAudioFilePath = ref()
|
|
|
+const list = ref<{ sid: string; audioFilePath: string; audioId }[]>([])
|
|
|
+const audiolist = ref<any[]>([])
|
|
|
const audioOptions = ref<any[]>([])
|
|
|
|
|
|
onMounted(async () => {
|
|
|
active.value = true
|
|
|
const res = await fetchTtsList(main.sceneCode)
|
|
|
if (res) {
|
|
|
- const arr = Array.from(res as any as SaveTOTTSParams[])
|
|
|
- .filter((i) => i.type === 'tts')
|
|
|
- .map((item) => {
|
|
|
- return {
|
|
|
- label: item.name,
|
|
|
- value: item.id
|
|
|
- }
|
|
|
- })
|
|
|
+ const result = Array.from(res as any as SaveTOTTSParams[]).filter(
|
|
|
+ (i) => i.type === 'tts'
|
|
|
+ )
|
|
|
+ audiolist.value = result
|
|
|
+ const arr = result.map((item) => {
|
|
|
+ return {
|
|
|
+ label: item.name,
|
|
|
+ value: item.id
|
|
|
+ }
|
|
|
+ })
|
|
|
console.log('array', arr)
|
|
|
audioOptions.value = arr
|
|
|
}
|
|
@@ -89,28 +94,50 @@ onMounted(async () => {
|
|
|
const videoData = JSON.parse(boxVideos.value)
|
|
|
const boxData = JSON.parse(boxModels.value)
|
|
|
console.log('boxVideos', videoData)
|
|
|
- videoData && list.value.push(videoData)
|
|
|
- boxData && list.value.push(boxData)
|
|
|
+ if (videoData && aiData.value.length === 0) {
|
|
|
+ list.value = list.value.concat(
|
|
|
+ videoData.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ audioId: null,
|
|
|
+ audioFilePath: null
|
|
|
+ }
|
|
|
+ })
|
|
|
+ )
|
|
|
+ }
|
|
|
+ if (videoData && aiData.value.length === 0) {
|
|
|
+ list.value = list.value.concat(
|
|
|
+ boxData.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ audioId: null,
|
|
|
+ audioFilePath: null
|
|
|
+ }
|
|
|
+ })
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
+watchEffect(() => {
|
|
|
+ if (aiData.value.length > 0) {
|
|
|
+ list.value = aiData.value
|
|
|
+ }
|
|
|
+})
|
|
|
onUnmounted(() => {
|
|
|
// setWidthSceneRef(0)
|
|
|
})
|
|
|
-watch(
|
|
|
- bindAudioIds,
|
|
|
- () => {
|
|
|
- console.log('bindAudioIds', bindAudioIds.value)
|
|
|
- // if (bindAudioId.value) {
|
|
|
- // const file = audioOptions.value.find((v) => v.value === bindAudioId.value)
|
|
|
- // console.log('file', file)
|
|
|
- // debugger
|
|
|
- // }
|
|
|
- },
|
|
|
- {
|
|
|
- deep: true
|
|
|
+const handleSelect = (audioId: any, vid: any) => {
|
|
|
+ const file = audiolist.value.find((i) => i.id === audioId)
|
|
|
+ const models = Array.from(list.value.flat() || []).find((i) => i.sid === vid)
|
|
|
+ const fileName = file.voicePath.substring(file.voicePath.lastIndexOf('/') + 1)
|
|
|
+ if (file.voicePath?.length && models) {
|
|
|
+ // debugger
|
|
|
+ models.audioFilePath = fileName
|
|
|
+ console.log('models', models)
|
|
|
+ main.syncAISetting(list.value)
|
|
|
}
|
|
|
-)
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="sass" scoped>
|