Commit 22ef7d9e authored by nick zheng's avatar nick zheng

Merge branch 'beta' into 'master'

Beta

See merge request !7
parents 4be8038b a01e78c8
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue' import { computed } from 'vue'
import CustomIcon from '@/components/custom-icon/custom-icon.vue' import CustomIcon from '@/components/custom-icon/custom-icon.vue'
import { DigitalHumanDialogueTimbreItem } from '../../dialogue-type' import { DigitalHumanDialogueTimbreItem } from '../../dialogue-type'
import { useDigitalHumanDialogueStore } from '@/store/modules/digital-human-dialogue' import { useDigitalHumanDialogueStore } from '@/store/modules/digital-human-dialogue'
...@@ -12,6 +12,7 @@ interface Props { ...@@ -12,6 +12,7 @@ interface Props {
interface Emits { interface Emits {
(e: 'click', value: string): void (e: 'click', value: string): void
(e: 'toggle', value: boolean): void (e: 'toggle', value: boolean): void
(e: 'play', value: string): void
} }
defineProps<Props>() defineProps<Props>()
...@@ -19,13 +20,8 @@ defineProps<Props>() ...@@ -19,13 +20,8 @@ defineProps<Props>()
const emit = defineEmits<Emits>() const emit = defineEmits<Emits>()
const digitalHumanDialogueStore = useDigitalHumanDialogueStore() const digitalHumanDialogueStore = useDigitalHumanDialogueStore()
const digitalAudio = ref<HTMLAudioElement>()
const timebreId = computed(() => digitalHumanDialogueStore.humanInfo.timebreId) const timebreId = computed(() => digitalHumanDialogueStore.humanInfo.timebreId)
function playAudio() {
digitalAudio.value?.play()
}
</script> </script>
<template> <template>
...@@ -40,7 +36,11 @@ function playAudio() { ...@@ -40,7 +36,11 @@ function playAudio() {
<div class="flex-1 overflow-hidden"> <div class="flex-1 overflow-hidden">
<div class="mb-2 flex items-center gap-2"> <div class="mb-2 flex items-center gap-2">
<div class="max-w-32 truncate">{{ dialogueTimbreItem?.name }}</div> <div class="max-w-32 truncate">{{ dialogueTimbreItem?.name }}</div>
<CustomIcon class="cursor-pointer text-lg" icon="mingcute:volume-line" @click.stop.prevent="playAudio" /> <CustomIcon
class="cursor-pointer text-lg"
icon="mingcute:volume-line"
@click.stop.prevent="emit('play', dialogueTimbreItem!.audioUrl)"
/>
</div> </div>
<NScrollbar x-scrollable> <NScrollbar x-scrollable>
<div class="flex gap-2"> <div class="flex gap-2">
...@@ -52,5 +52,4 @@ function playAudio() { ...@@ -52,5 +52,4 @@ function playAudio() {
<CustomIcon class="cursor-pointer text-lg" icon="ant-design:swap-outlined" @click="emit('toggle', true)" /> <CustomIcon class="cursor-pointer text-lg" icon="ant-design:swap-outlined" @click="emit('toggle', true)" />
</div> </div>
</div> </div>
<audio ref="digitalAudio" :src="dialogueTimbreItem?.audioUrl"></audio>
</template> </template>
...@@ -27,6 +27,8 @@ const digitalTimbreMaleList = ref<DigitalHumanDialogueTimbreItem[]>([]) ...@@ -27,6 +27,8 @@ const digitalTimbreMaleList = ref<DigitalHumanDialogueTimbreItem[]>([])
const showAll = ref(false) const showAll = ref(false)
const searchName = ref('') const searchName = ref('')
const digitalAudioRef = ref<HTMLAudioElement>()
const speed = computed({ const speed = computed({
get() { get() {
return digitalHumanDialogueStore.humanInfo.speed return digitalHumanDialogueStore.humanInfo.speed
...@@ -74,6 +76,7 @@ async function getDigitalTimbreList() { ...@@ -74,6 +76,7 @@ async function getDigitalTimbreList() {
function handleUpdateAudioType(audioType: string) { function handleUpdateAudioType(audioType: string) {
digitalHumanDialogueStore.humanInfo.timebreId = audioType === 'mandarin' ? '5132' : '' digitalHumanDialogueStore.humanInfo.timebreId = audioType === 'mandarin' ? '5132' : ''
digitalAudioRef.value?.pause()
} }
async function handleSearch(value: string) { async function handleSearch(value: string) {
...@@ -88,6 +91,12 @@ async function handleSearch(value: string) { ...@@ -88,6 +91,12 @@ async function handleSearch(value: string) {
function handleClickAudioCard(timbreId: string) { function handleClickAudioCard(timbreId: string) {
digitalHumanDialogueStore.setTimbreId(timbreId) digitalHumanDialogueStore.setTimbreId(timbreId)
} }
function handlePlayDigitalAudio(audioUrl: string) {
digitalAudioRef.value?.pause()
digitalAudioRef.value!.src = audioUrl
digitalAudioRef.value?.play()
}
</script> </script>
<template> <template>
...@@ -104,7 +113,12 @@ function handleClickAudioCard(timbreId: string) { ...@@ -104,7 +113,12 @@ function handleClickAudioCard(timbreId: string) {
</div> </div>
<div v-show="isMandarinAudioType"> <div v-show="isMandarinAudioType">
<DigitalAudioCard :dialogue-timbre-item="digitalTimbreValue" :show-toggle="true" @toggle="showAll = true" /> <DigitalAudioCard
:dialogue-timbre-item="digitalTimbreValue"
:show-toggle="true"
@toggle="showAll = true"
@play="handlePlayDigitalAudio"
/>
</div> </div>
<div class="mt-4 text-lg">聲音</div> <div class="mt-4 text-lg">聲音</div>
...@@ -145,7 +159,10 @@ function handleClickAudioCard(timbreId: string) { ...@@ -145,7 +159,10 @@ function handleClickAudioCard(timbreId: string) {
:key="index" :key="index"
:dialogue-timbre-item="timbre" :dialogue-timbre-item="timbre"
@click="handleClickAudioCard" @click="handleClickAudioCard"
@play="handlePlayDigitalAudio"
/> />
</NScrollbar> </NScrollbar>
</div> </div>
<audio ref="digitalAudioRef" />
</template> </template>
...@@ -241,6 +241,7 @@ function handleGetDraftListUpdatePageSize(pageSize: number) { ...@@ -241,6 +241,7 @@ function handleGetDraftListUpdatePageSize(pageSize: number) {
:data="audioDraftList" :data="audioDraftList"
:max-height="tableContentY" :max-height="tableContentY"
:scroll-x="1086" :scroll-x="1086"
:checked-row-keys="checkedDraftIdList"
@update:checked-row-keys="handleUpdateCheckedDraftList" @update:checked-row-keys="handleUpdateCheckedDraftList"
> >
<template #empty> <template #empty>
......
...@@ -248,6 +248,7 @@ function handleGetTaskListUpdatePageSize(pageSize: number) { ...@@ -248,6 +248,7 @@ function handleGetTaskListUpdatePageSize(pageSize: number) {
:row-key="(row: VideoWorkItem) => row.id" :row-key="(row: VideoWorkItem) => row.id"
:max-height="tableContentY" :max-height="tableContentY"
:scroll-x="1086" :scroll-x="1086"
:checked-row-keys="checkedVideoWorkIds"
@update:checked-row-keys="handleUpdateCheckedVideoWorkIds" @update:checked-row-keys="handleUpdateCheckedVideoWorkIds"
> >
<template #empty> <template #empty>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment