feat: subtitles editor
This commit is contained in:
@@ -3,10 +3,13 @@ import type { PropType } from 'vue'
|
||||
import dayjs from 'dayjs'
|
||||
import { useDownload } from '~/composables/useDownload'
|
||||
import gsap from 'gsap'
|
||||
import SRTEditor from '~/components/aigc/course-generate/SRTEditor.vue'
|
||||
|
||||
const toast = useToast()
|
||||
const { metaSymbol } = useShortcuts()
|
||||
|
||||
const srtEditor = ref()
|
||||
|
||||
const props = defineProps({
|
||||
course: {
|
||||
type: Object as PropType<resp.gen.CourseGenItem>,
|
||||
@@ -25,6 +28,14 @@ defineShortcuts({
|
||||
}
|
||||
},
|
||||
},
|
||||
'meta_d': {
|
||||
handler: () => {
|
||||
if (isDropdownOpen.value && isDownloadable.value) {
|
||||
srtEditor.value.open()
|
||||
isDropdownOpen.value = false
|
||||
}
|
||||
},
|
||||
},
|
||||
'meta_s': {
|
||||
handler: () => {
|
||||
if (isDropdownOpen.value && isDownloadable.value) {
|
||||
@@ -73,9 +84,6 @@ watch(generateProgress, (newValue) => {
|
||||
}, {
|
||||
immediate: true,
|
||||
})
|
||||
watch(tweenedGenerateProgress, val => {
|
||||
console.log(val)
|
||||
})
|
||||
|
||||
const downloadProgress = ref(0)
|
||||
|
||||
@@ -117,8 +125,8 @@ const startDownload = async (
|
||||
download()
|
||||
}
|
||||
|
||||
const copyTaskId = () => {
|
||||
navigator.clipboard.writeText(props.course.task_id)
|
||||
const copyTaskId = (extraMessage?: string) => {
|
||||
navigator.clipboard.writeText(props.course.task_id + (extraMessage ? ` ${ extraMessage }` : ''))
|
||||
toast.add({
|
||||
title: '复制成功',
|
||||
description: '已复制任务 ID',
|
||||
@@ -181,10 +189,11 @@ const copyTaskId = () => {
|
||||
<p class="text-xs pt-0.5 text-neutral-400 space-x-2">
|
||||
<span>{{ dayjs(course.create_time * 1000).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
<button
|
||||
v-if="course.task_id"
|
||||
class="hover:text-primary font-medium"
|
||||
tabindex="-1"
|
||||
:title="course.task_id"
|
||||
@click="copyTaskId"
|
||||
@click="copyTaskId(isFailed ? `\n\n${course.message}\n${course.ppt_url}` : '')"
|
||||
>
|
||||
复制ID
|
||||
</button>
|
||||
@@ -215,6 +224,10 @@ const copyTaskId = () => {
|
||||
icon: 'i-solar-subtitles-linear',
|
||||
shortcuts: [metaSymbol, 'D'],
|
||||
disabled: !isDownloadable,
|
||||
click: () => {
|
||||
srtEditor.open()
|
||||
isDropdownOpen = false
|
||||
}
|
||||
}, {
|
||||
label: '下载字幕',
|
||||
icon: 'i-tabler-file-download',
|
||||
@@ -272,6 +285,10 @@ const copyTaskId = () => {
|
||||
/>
|
||||
</UCard>
|
||||
</UModal>
|
||||
<SRTEditor
|
||||
ref="srtEditor"
|
||||
:course="course"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user