refactor!: 升级 @nuxt/ui@3,重构所有页面和组件,调整配置,移除不在需求中的页面
This commit is contained in:
@@ -41,7 +41,7 @@ type subtitleStyleSchema = InferType<typeof subtitleStyleSchema>
|
||||
|
||||
const subtitleStyleState = reactive<subtitleStyleSchema>({
|
||||
color: '#fff',
|
||||
effect: 'shadow-sm',
|
||||
effect: 'shadow-xs',
|
||||
fontSize: 24,
|
||||
bottomOffset: 12,
|
||||
})
|
||||
@@ -58,7 +58,7 @@ const loadSrt = async () => {
|
||||
toast.add({
|
||||
title: '加载字幕失败',
|
||||
description: `${err}` || '未知错误',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
})
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
@@ -79,8 +79,8 @@ const parseSrt = (srt: string) => {
|
||||
subtitles.value.push(subtitle)
|
||||
}
|
||||
subtitle = {
|
||||
start: match[1],
|
||||
end: match[2],
|
||||
start: match[1] || '',
|
||||
end: match[2] || '',
|
||||
text: '',
|
||||
}
|
||||
} else if (subtitle) {
|
||||
@@ -105,23 +105,23 @@ const generateSrt = () => {
|
||||
|
||||
const formatTime = (time: string) => {
|
||||
const parts = time.split(',')
|
||||
const timeParts = parts[0].split(':')
|
||||
const timeParts = parts[0]?.split(':') || []
|
||||
return {
|
||||
hours: parseInt(timeParts[0]),
|
||||
minutes: parseInt(timeParts[1]),
|
||||
seconds: parseInt(timeParts[2]),
|
||||
milliseconds: parseInt(parts[1]),
|
||||
hours: parseInt(timeParts[0] || '0'),
|
||||
minutes: parseInt(timeParts[1] || '0'),
|
||||
seconds: parseInt(timeParts[2] || '0'),
|
||||
milliseconds: parseInt(parts[1] || '0'),
|
||||
}
|
||||
}
|
||||
|
||||
const formatTimeToDayjs = (time: string) => {
|
||||
const parts = time.split(',')
|
||||
const timeParts = parts[0].split(':')
|
||||
const timeParts = parts[0]?.split(':') || []
|
||||
return dayjs()
|
||||
.hour(parseInt(timeParts[0]))
|
||||
.minute(parseInt(timeParts[1]))
|
||||
.second(parseInt(timeParts[2]))
|
||||
.millisecond(parseInt(parts[1]))
|
||||
.hour(parseInt(timeParts[0] || '0'))
|
||||
.minute(parseInt(timeParts[1] || '0'))
|
||||
.second(parseInt(timeParts[2] || '0'))
|
||||
.millisecond(parseInt(parts[1] || '0'))
|
||||
}
|
||||
|
||||
const syncSubtitles = () => {
|
||||
@@ -183,7 +183,7 @@ const saveNewSubtitle = () => {
|
||||
.then((_) => {
|
||||
modified.value = false
|
||||
toast.add({
|
||||
color: 'green',
|
||||
color: 'success',
|
||||
title: '字幕已保存',
|
||||
description: '修改后的字幕文件已保存',
|
||||
})
|
||||
@@ -202,7 +202,7 @@ const exportVideo = async () => {
|
||||
toast.add({
|
||||
title: '获取字幕失败',
|
||||
description: '无法获取字幕文件,请稍后重试',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-alert-triangle',
|
||||
})
|
||||
return
|
||||
@@ -213,7 +213,7 @@ const exportVideo = async () => {
|
||||
color: subtitleStyleState.color,
|
||||
fontSize: subtitleStyleState.fontSize,
|
||||
textShadow:
|
||||
subtitleStyleState.effect === 'shadow-sm'
|
||||
subtitleStyleState.effect === 'shadow-xs'
|
||||
? {
|
||||
offsetX: 2,
|
||||
offsetY: 2,
|
||||
@@ -258,346 +258,349 @@ defineExpose({
|
||||
<template>
|
||||
<div>
|
||||
<USlideover
|
||||
v-model="isDrawerActive"
|
||||
:prevent-close="modified"
|
||||
:ui="{ width: 'max-w-lg' }"
|
||||
v-model:open="isDrawerActive"
|
||||
:dismissible="!modified"
|
||||
:ui="{
|
||||
wrapper: 'max-w-lg',
|
||||
body: 'flex flex-col flex-1 overflow-hidden',
|
||||
}"
|
||||
>
|
||||
<UCard
|
||||
class="flex flex-col flex-1 overflow-hidden"
|
||||
:ui="{
|
||||
body: { base: 'overflow-auto flex-1' },
|
||||
ring: '',
|
||||
divide: 'divide-y divide-gray-100 dark:divide-gray-800',
|
||||
}"
|
||||
>
|
||||
<template #header>
|
||||
<UButton
|
||||
color="gray"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
icon="tabler:x"
|
||||
class="flex sm:hidden absolute end-5 top-5 z-10"
|
||||
square
|
||||
padded
|
||||
@click="isDrawerActive = false"
|
||||
/>
|
||||
<div class="flex flex-col">
|
||||
<h3
|
||||
class="text-base font-semibold leading-6 text-gray-900 dark:text-white"
|
||||
>
|
||||
字幕编辑器
|
||||
</h3>
|
||||
<h3
|
||||
class="text-xs font-semibold text-blue-500"
|
||||
v-if="course.title"
|
||||
>
|
||||
{{ course.title }}
|
||||
</h3>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div
|
||||
v-if="isLoading"
|
||||
class="flex justify-center items-center text-primary"
|
||||
<template #content>
|
||||
<UCard
|
||||
class="flex flex-1 flex-col overflow-hidden"
|
||||
:ui="{
|
||||
body: 'overflow-auto flex-1',
|
||||
}"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="32"
|
||||
height="32"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<defs>
|
||||
<filter id="svgSpinnersGooeyBalls20">
|
||||
<feGaussianBlur
|
||||
in="SourceGraphic"
|
||||
result="y"
|
||||
stdDeviation="1"
|
||||
/>
|
||||
<feColorMatrix
|
||||
in="y"
|
||||
result="z"
|
||||
values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -7"
|
||||
/>
|
||||
<feBlend
|
||||
in="SourceGraphic"
|
||||
in2="z"
|
||||
/>
|
||||
</filter>
|
||||
</defs>
|
||||
<g filter="url(#svgSpinnersGooeyBalls20)">
|
||||
<circle
|
||||
cx="5"
|
||||
cy="12"
|
||||
r="4"
|
||||
fill="currentColor"
|
||||
>
|
||||
<animate
|
||||
attributeName="cx"
|
||||
calcMode="spline"
|
||||
dur="2s"
|
||||
keySplines=".36,.62,.43,.99;.79,0,.58,.57"
|
||||
repeatCount="indefinite"
|
||||
values="5;8;5"
|
||||
/>
|
||||
</circle>
|
||||
<circle
|
||||
cx="19"
|
||||
cy="12"
|
||||
r="4"
|
||||
fill="currentColor"
|
||||
>
|
||||
<animate
|
||||
attributeName="cx"
|
||||
calcMode="spline"
|
||||
dur="2s"
|
||||
keySplines=".36,.62,.43,.99;.79,0,.58,.57"
|
||||
repeatCount="indefinite"
|
||||
values="19;16;19"
|
||||
/>
|
||||
</circle>
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
dur="0.75s"
|
||||
repeatCount="indefinite"
|
||||
type="rotate"
|
||||
values="0 12 12;360 12 12"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="flex flex-col h-full gap-2 overflow-hidden overscroll-y-none overshadow"
|
||||
>
|
||||
<div class="relative w-full aspect-video flex-1">
|
||||
<div
|
||||
class="absolute w-fit mx-auto inset-x-0 font-sans font-bold subtitle"
|
||||
:class="{
|
||||
stroke: subtitleStyleState.effect === 'stroke',
|
||||
}"
|
||||
:style="{
|
||||
lineHeight: '1',
|
||||
color: subtitleStyleState.color,
|
||||
fontSize: subtitleStyleState.fontSize / 1.5 + 'px',
|
||||
bottom: subtitleStyleState.bottomOffset / 1.5 + 'px',
|
||||
textShadow:
|
||||
subtitleStyleState.effect === 'shadow-sm'
|
||||
? '2px 2px 4px rgba(0, 0, 0, 0.25)'
|
||||
: undefined,
|
||||
}"
|
||||
>
|
||||
{{ subtitles.find((sub) => sub.active)?.text }}
|
||||
</div>
|
||||
<video
|
||||
controls
|
||||
ref="videoElement"
|
||||
class="rounded-sm"
|
||||
style="-webkit-user-drag: none"
|
||||
:src="course.video_url"
|
||||
@timeupdate="syncSubtitles"
|
||||
<template #header>
|
||||
<UButton
|
||||
color="neutral"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
icon="tabler:x"
|
||||
class="absolute end-5 top-5 z-10 flex sm:hidden"
|
||||
square
|
||||
padded
|
||||
@click="isDrawerActive = false"
|
||||
/>
|
||||
</div>
|
||||
<UAccordion
|
||||
:items="[{ label: '字幕选项' }]"
|
||||
color="gray"
|
||||
size="lg"
|
||||
>
|
||||
<template #item>
|
||||
<div
|
||||
class="border dark:border-neutral-700 rounded-lg space-y-4 p-4 pb-6"
|
||||
<div class="flex flex-col">
|
||||
<h3
|
||||
class="text-base font-semibold leading-6 text-gray-900 dark:text-white"
|
||||
>
|
||||
<div class="w-full flex flex-col justify-center">
|
||||
<div
|
||||
class="rounded-md w-full aspect-video relative overflow-hidden"
|
||||
>
|
||||
<img
|
||||
class="object-cover w-full h-full rounded-md"
|
||||
src="https://static-xsh.oss-cn-chengdu.aliyuncs.com/file/2024-08-04/9ed1e5c0133824f0bcf79d1ad9e9ecbb.png"
|
||||
/>
|
||||
<span
|
||||
class="absolute font-sans font-bold bottom-0 left-1/2 transform -translate-x-1/2 subtitle"
|
||||
:class="{
|
||||
stroke: subtitleStyleState.effect === 'stroke',
|
||||
}"
|
||||
:style="{
|
||||
lineHeight: '1',
|
||||
color: subtitleStyleState.color,
|
||||
fontSize: subtitleStyleState.fontSize / 1.5 + 'px',
|
||||
bottom: subtitleStyleState.bottomOffset / 1.5 + 'px',
|
||||
textShadow:
|
||||
subtitleStyleState.effect === 'shadow-sm'
|
||||
? '2px 2px 4px rgba(0, 0, 0, 0.25)'
|
||||
: undefined,
|
||||
}"
|
||||
字幕编辑器
|
||||
</h3>
|
||||
<h3
|
||||
class="text-xs font-semibold text-blue-500"
|
||||
v-if="course.title"
|
||||
>
|
||||
{{ course.title }}
|
||||
</h3>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div
|
||||
v-if="isLoading"
|
||||
class="text-primary flex items-center justify-center"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="32"
|
||||
height="32"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<defs>
|
||||
<filter id="svgSpinnersGooeyBalls20">
|
||||
<feGaussianBlur
|
||||
in="SourceGraphic"
|
||||
result="y"
|
||||
stdDeviation="1"
|
||||
/>
|
||||
<feColorMatrix
|
||||
in="y"
|
||||
result="z"
|
||||
values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -7"
|
||||
/>
|
||||
<feBlend
|
||||
in="SourceGraphic"
|
||||
in2="z"
|
||||
/>
|
||||
</filter>
|
||||
</defs>
|
||||
<g filter="url(#svgSpinnersGooeyBalls20)">
|
||||
<circle
|
||||
cx="5"
|
||||
cy="12"
|
||||
r="4"
|
||||
fill="currentColor"
|
||||
>
|
||||
<animate
|
||||
attributeName="cx"
|
||||
calcMode="spline"
|
||||
dur="2s"
|
||||
keySplines=".36,.62,.43,.99;.79,0,.58,.57"
|
||||
repeatCount="indefinite"
|
||||
values="5;8;5"
|
||||
/>
|
||||
</circle>
|
||||
<circle
|
||||
cx="19"
|
||||
cy="12"
|
||||
r="4"
|
||||
fill="currentColor"
|
||||
>
|
||||
<animate
|
||||
attributeName="cx"
|
||||
calcMode="spline"
|
||||
dur="2s"
|
||||
keySplines=".36,.62,.43,.99;.79,0,.58,.57"
|
||||
repeatCount="indefinite"
|
||||
values="19;16;19"
|
||||
/>
|
||||
</circle>
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
dur="0.75s"
|
||||
repeatCount="indefinite"
|
||||
type="rotate"
|
||||
values="0 12 12;360 12 12"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="overshadow flex h-full flex-col gap-2 overflow-hidden overscroll-y-none"
|
||||
>
|
||||
<div class="relative aspect-video w-full flex-1">
|
||||
<div
|
||||
class="subtitle absolute inset-x-0 mx-auto w-fit font-sans font-bold"
|
||||
:class="{
|
||||
stroke: subtitleStyleState.effect === 'stroke',
|
||||
}"
|
||||
:style="{
|
||||
lineHeight: '1',
|
||||
color: subtitleStyleState.color,
|
||||
fontSize: subtitleStyleState.fontSize / 1.5 + 'px',
|
||||
bottom: subtitleStyleState.bottomOffset / 1.5 + 'px',
|
||||
textShadow:
|
||||
subtitleStyleState.effect === 'shadow-xs'
|
||||
? '2px 2px 4px rgba(0, 0, 0, 0.25)'
|
||||
: undefined,
|
||||
}"
|
||||
>
|
||||
{{ subtitles.find((sub) => sub.active)?.text }}
|
||||
</div>
|
||||
<video
|
||||
controls
|
||||
ref="videoElement"
|
||||
class="rounded-xs"
|
||||
style="-webkit-user-drag: none"
|
||||
:src="course.video_url"
|
||||
@timeupdate="syncSubtitles"
|
||||
/>
|
||||
</div>
|
||||
<UAccordion
|
||||
:items="[{ label: '字幕选项' }]"
|
||||
color="gray"
|
||||
size="lg"
|
||||
>
|
||||
<template #content>
|
||||
<div
|
||||
class="space-y-4 rounded-lg border p-4 pb-6 dark:border-neutral-700"
|
||||
>
|
||||
<div class="flex w-full flex-col justify-center">
|
||||
<div
|
||||
class="relative aspect-video w-full overflow-hidden rounded-md"
|
||||
>
|
||||
字幕样式预览
|
||||
<img
|
||||
class="h-full w-full rounded-md object-cover"
|
||||
src="https://static-xsh.oss-cn-chengdu.aliyuncs.com/file/2024-08-04/9ed1e5c0133824f0bcf79d1ad9e9ecbb.png"
|
||||
/>
|
||||
<span
|
||||
class="subtitle absolute bottom-0 left-1/2 -translate-x-1/2 transform font-sans font-bold"
|
||||
:class="{
|
||||
stroke: subtitleStyleState.effect === 'stroke',
|
||||
}"
|
||||
:style="{
|
||||
lineHeight: '1',
|
||||
color: subtitleStyleState.color,
|
||||
fontSize: subtitleStyleState.fontSize / 1.5 + 'px',
|
||||
bottom: subtitleStyleState.bottomOffset / 1.5 + 'px',
|
||||
textShadow:
|
||||
subtitleStyleState.effect === 'shadow-xs'
|
||||
? '2px 2px 4px rgba(0, 0, 0, 0.25)'
|
||||
: undefined,
|
||||
}"
|
||||
>
|
||||
字幕样式预览
|
||||
</span>
|
||||
</div>
|
||||
<span class="text-2xs font-medium italic opacity-50 mt-1">
|
||||
字幕预览仅供参考,以实际渲染效果为准
|
||||
</span>
|
||||
</div>
|
||||
<span class="text-sm italic opacity-50">
|
||||
字幕预览仅供参考,以实际渲染效果为准
|
||||
</span>
|
||||
<UForm
|
||||
:schema="subtitleStyleSchema"
|
||||
:state="subtitleStyleState"
|
||||
class="flex flex-col gap-4"
|
||||
>
|
||||
<div class="flex gap-4">
|
||||
<UFormField
|
||||
label="字幕颜色"
|
||||
name="fontColor"
|
||||
class="w-full"
|
||||
size="xs"
|
||||
>
|
||||
<USelectMenu
|
||||
:items="[
|
||||
{
|
||||
label: '黑色',
|
||||
value: '#000',
|
||||
},
|
||||
{
|
||||
label: '白色',
|
||||
value: '#fff',
|
||||
},
|
||||
]"
|
||||
value-key="value"
|
||||
v-model="subtitleStyleState.color"
|
||||
/>
|
||||
</UFormField>
|
||||
<UFormField
|
||||
label="字幕效果"
|
||||
name="effect"
|
||||
class="w-full"
|
||||
size="xs"
|
||||
>
|
||||
<USelectMenu
|
||||
:items="[
|
||||
{
|
||||
label: '阴影',
|
||||
value: 'shadow-xs',
|
||||
},
|
||||
{
|
||||
label: '描边',
|
||||
value: 'stroke',
|
||||
},
|
||||
]"
|
||||
value-key="value"
|
||||
v-model="subtitleStyleState.effect"
|
||||
/>
|
||||
</UFormField>
|
||||
</div>
|
||||
<UFormField
|
||||
:label="`字幕大小 ${subtitleStyleState.fontSize}px`"
|
||||
name="fontSize"
|
||||
size="xs"
|
||||
>
|
||||
<USlider
|
||||
:max="64"
|
||||
:min="20"
|
||||
:step="2"
|
||||
size="sm"
|
||||
v-model="subtitleStyleState.fontSize"
|
||||
/>
|
||||
</UFormField>
|
||||
<UFormField
|
||||
:label="`字幕偏移量 ${subtitleStyleState.bottomOffset}px`"
|
||||
name="offset"
|
||||
size="xs"
|
||||
>
|
||||
<USlider
|
||||
:max="30"
|
||||
:min="0"
|
||||
:step="1"
|
||||
size="sm"
|
||||
v-model="subtitleStyleState.bottomOffset"
|
||||
/>
|
||||
</UFormField>
|
||||
</UForm>
|
||||
</div>
|
||||
<UForm
|
||||
:schema="subtitleStyleSchema"
|
||||
:state="subtitleStyleState"
|
||||
class="flex flex-col gap-4"
|
||||
>
|
||||
<div class="flex gap-4">
|
||||
<UFormGroup
|
||||
label="字幕颜色"
|
||||
name="fontColor"
|
||||
class="w-full"
|
||||
size="xs"
|
||||
>
|
||||
<USelectMenu
|
||||
:options="[
|
||||
{
|
||||
label: '黑色',
|
||||
value: '#000',
|
||||
},
|
||||
{
|
||||
label: '白色',
|
||||
value: '#fff',
|
||||
},
|
||||
]"
|
||||
option-attribute="label"
|
||||
value-attribute="value"
|
||||
v-model="subtitleStyleState.color"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="字幕效果"
|
||||
name="effect"
|
||||
class="w-full"
|
||||
size="xs"
|
||||
>
|
||||
<USelectMenu
|
||||
:options="[
|
||||
{
|
||||
label: '阴影',
|
||||
value: 'shadow-sm',
|
||||
},
|
||||
{
|
||||
label: '描边',
|
||||
value: 'stroke',
|
||||
},
|
||||
]"
|
||||
option-attribute="label"
|
||||
value-attribute="value"
|
||||
v-model="subtitleStyleState.effect"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</div>
|
||||
<UFormGroup
|
||||
:label="`字幕大小 ${subtitleStyleState.fontSize}px`"
|
||||
name="fontSize"
|
||||
size="xs"
|
||||
>
|
||||
<URange
|
||||
:max="64"
|
||||
:min="20"
|
||||
:step="2"
|
||||
size="sm"
|
||||
v-model="subtitleStyleState.fontSize"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
:label="`字幕偏移量 ${subtitleStyleState.bottomOffset}px`"
|
||||
name="offset"
|
||||
size="xs"
|
||||
>
|
||||
<URange
|
||||
:max="30"
|
||||
:min="0"
|
||||
:step="1"
|
||||
size="sm"
|
||||
v-model="subtitleStyleState.bottomOffset"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</UForm>
|
||||
</div>
|
||||
</template>
|
||||
</UAccordion>
|
||||
<ul
|
||||
class="flex-1 px-0.5 pb-[100%] overflow-y-auto space-y-0.5 scroll-smooth relative"
|
||||
>
|
||||
<li
|
||||
v-for="(subtitle, index) in subtitles"
|
||||
:key="index"
|
||||
:id="'subtitle-' + index"
|
||||
</template>
|
||||
</UAccordion>
|
||||
<ul
|
||||
class="relative flex-1 space-y-0.5 overflow-y-auto scroll-smooth px-0.5 pb-[100%]"
|
||||
>
|
||||
<div :class="{ 'text-primary': subtitle.active }">
|
||||
<span class="text-xs font-medium opacity-60">
|
||||
{{ formatTimeToDayjs(subtitle.start).format('HH:mm:ss') }}
|
||||
-
|
||||
{{ formatTimeToDayjs(subtitle.end).format('HH:mm:ss') }}
|
||||
<span class="opacity-50">
|
||||
[{{
|
||||
formatTimeToDayjs(subtitle.end).diff(
|
||||
formatTimeToDayjs(subtitle.start),
|
||||
'second'
|
||||
)
|
||||
}}s]
|
||||
<li
|
||||
v-for="(subtitle, index) in subtitles"
|
||||
:key="index"
|
||||
:id="'subtitle-' + index"
|
||||
>
|
||||
<div :class="{ 'text-primary': subtitle.active }">
|
||||
<span class="text-xs font-medium opacity-60">
|
||||
{{ formatTimeToDayjs(subtitle.start).format('HH:mm:ss') }}
|
||||
-
|
||||
{{ formatTimeToDayjs(subtitle.end).format('HH:mm:ss') }}
|
||||
<span class="opacity-50">
|
||||
[{{
|
||||
formatTimeToDayjs(subtitle.end).diff(
|
||||
formatTimeToDayjs(subtitle.start),
|
||||
'second'
|
||||
)
|
||||
}}s]
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<UInput
|
||||
v-model="subtitle.text"
|
||||
class="w-full"
|
||||
placeholder="请输入字幕内容"
|
||||
:name="'subtitle-' + index"
|
||||
:autofocus="false"
|
||||
:color="subtitle.active ? 'primary' : undefined"
|
||||
@click="onSubtitleInputClick(subtitle)"
|
||||
@input="
|
||||
() => {
|
||||
if (!modified) modified = true
|
||||
}
|
||||
"
|
||||
>
|
||||
<template #trailing>
|
||||
<UIcon
|
||||
v-show="subtitle.active"
|
||||
name="tabler:keyframe-align-vertical-filled"
|
||||
/>
|
||||
</template>
|
||||
</UInput>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="flex justify-end items-center gap-2">
|
||||
<span
|
||||
v-if="modified"
|
||||
class="text-sm text-yellow-500 font-medium"
|
||||
>
|
||||
已更改但未保存
|
||||
</span>
|
||||
<UButton
|
||||
:loading="isExporting"
|
||||
variant="soft"
|
||||
icon="i-tabler-file-export"
|
||||
@click="exportVideo"
|
||||
>
|
||||
导出视频
|
||||
</UButton>
|
||||
<UButton
|
||||
:disabled="isExporting || !modified"
|
||||
:loading="isSaving"
|
||||
icon="i-tabler-device-floppy"
|
||||
@click="saveNewSubtitle"
|
||||
>
|
||||
保存{{ isSaving ? '中' : '' }}
|
||||
</UButton>
|
||||
<UInput
|
||||
v-model="subtitle.text"
|
||||
class="w-full"
|
||||
placeholder="请输入字幕内容"
|
||||
:name="'subtitle-' + index"
|
||||
:autofocus="false"
|
||||
:color="subtitle.active ? 'primary' : undefined"
|
||||
@click="onSubtitleInputClick(subtitle)"
|
||||
@input="
|
||||
() => {
|
||||
if (!modified) modified = true
|
||||
}
|
||||
"
|
||||
>
|
||||
<template #trailing>
|
||||
<UIcon
|
||||
v-show="subtitle.active"
|
||||
name="tabler:keyframe-align-vertical-filled"
|
||||
/>
|
||||
</template>
|
||||
</UInput>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
</UCard>
|
||||
|
||||
<template #footer>
|
||||
<div class="flex items-center justify-end gap-2">
|
||||
<span
|
||||
v-if="modified"
|
||||
class="text-sm font-medium text-yellow-500"
|
||||
>
|
||||
已更改但未保存
|
||||
</span>
|
||||
<UButton
|
||||
:loading="isExporting"
|
||||
variant="soft"
|
||||
icon="i-tabler-file-export"
|
||||
@click="exportVideo"
|
||||
>
|
||||
导出视频
|
||||
</UButton>
|
||||
<UButton
|
||||
:disabled="isExporting || !modified"
|
||||
:loading="isSaving"
|
||||
icon="i-tabler-device-floppy"
|
||||
@click="saveNewSubtitle"
|
||||
>
|
||||
保存{{ isSaving ? '中' : '' }}
|
||||
</UButton>
|
||||
</div>
|
||||
</template>
|
||||
</UCard>
|
||||
</template>
|
||||
</USlideover>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference '@/assets/css/main.css';
|
||||
|
||||
.overshadow {
|
||||
@apply relative;
|
||||
}
|
||||
@@ -606,7 +609,7 @@ defineExpose({
|
||||
content: '';
|
||||
inset: 80% 0 0;
|
||||
position: absolute;
|
||||
@apply bg-linear-to-b from-transparent to-white dark:to-neutral-950 pointer-events-none;
|
||||
@apply bg-linear-to-b pointer-events-none from-transparent to-white dark:to-neutral-950;
|
||||
}
|
||||
|
||||
.subtitle.stroke {
|
||||
|
||||
Reference in New Issue
Block a user