🎨chore: 使用 oxlint, oxfmt&格式化代码

This commit is contained in:
2026-02-08 21:16:25 +08:00
parent 9d35c6a9d8
commit 3a801ba016
78 changed files with 3367 additions and 1468 deletions

View File

@@ -106,13 +106,13 @@ const isProcessing = ref(false)
// 处理训练素材:录入系统数字人并分配给用户
const handleProcessTrain = (item: DigitalHumanTrainItem) => {
currentTrainItem.value = item
// 预填充表单数据
processFormState.name = item.dh_name
processFormState.model_id = undefined
processFormState.description = `基于${item.organization}提交的训练素材创建`
processFormState.type = 2
isProcessModalOpen.value = true
}
@@ -147,9 +147,11 @@ const handleAvatarUpload = (files: FileList) => {
}
// 提交录入表单
const onProcessSubmit = async (event: FormSubmitEvent<typeof processFormState>) => {
const onProcessSubmit = async (
event: FormSubmitEvent<typeof processFormState>
) => {
if (!currentTrainItem.value) return
if (!avatarFile.value) {
toast.add({
title: '请上传数字人预览图',
@@ -187,7 +189,10 @@ const onProcessSubmit = async (event: FormSubmitEvent<typeof processFormState>)
avatar: avatarUrl,
})
if (createSystemResult.ret !== 200 || !createSystemResult.data.digital_human_id) {
if (
createSystemResult.ret !== 200 ||
!createSystemResult.data.digital_human_id
) {
throw new Error(createSystemResult.msg || '创建系统数字人失败')
}
@@ -216,7 +221,9 @@ const onProcessSubmit = async (event: FormSubmitEvent<typeof processFormState>)
toast.add({
title: '录入成功',
description: `数字人"${event.data.name}"已成功录入并分配给用户 ${currentTrainItem.value.user_id}${
createUserResult.data.failed ? `,失败 ${createUserResult.data.failed}` : ''
createUserResult.data.failed
? `,失败 ${createUserResult.data.failed}`
: ''
}`,
color: 'green',
icon: 'i-tabler-check',
@@ -238,7 +245,8 @@ const onProcessSubmit = async (event: FormSubmitEvent<typeof processFormState>)
await refreshTrainList()
} catch (error) {
console.error('录入数字人失败:', error)
const errorMessage = error instanceof Error ? error.message : '录入失败,请重试'
const errorMessage =
error instanceof Error ? error.message : '录入失败,请重试'
toast.add({
title: '录入失败',
description: errorMessage,
@@ -275,7 +283,8 @@ const handleDeleteTrain = async (item: DigitalHumanTrainItem) => {
}
} catch (error) {
console.error('删除定制记录失败:', error)
const errorMessage = error instanceof Error ? error.message : '删除失败,请重试'
const errorMessage =
error instanceof Error ? error.message : '删除失败,请重试'
toast.add({
title: '删除失败',
description: errorMessage,
@@ -294,38 +303,42 @@ const formatTime = (timestamp: number) => {
const previewVideo = (videoUrl: string, title: string) => {
// 创建一个简单的视频预览弹窗
const videoModal = document.createElement('div')
videoModal.className = 'fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50'
videoModal.className =
'fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50'
const videoContainer = document.createElement('div')
videoContainer.className = 'bg-white dark:bg-gray-800 rounded-lg p-4 max-w-4xl max-h-[80vh] overflow-auto'
videoContainer.className =
'bg-white dark:bg-gray-800 rounded-lg p-4 max-w-4xl max-h-[80vh] overflow-auto'
const titleElement = document.createElement('h3')
titleElement.textContent = title
titleElement.className = 'text-lg font-semibold mb-4 text-gray-900 dark:text-white'
titleElement.className =
'text-lg font-semibold mb-4 text-gray-900 dark:text-white'
const video = document.createElement('video')
video.src = videoUrl
video.controls = true
video.className = 'w-full max-h-[60vh]'
const closeButton = document.createElement('button')
closeButton.textContent = '关闭'
closeButton.className = 'mt-4 px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600'
closeButton.className =
'mt-4 px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600'
closeButton.onclick = () => {
document.body.removeChild(videoModal)
}
videoContainer.appendChild(titleElement)
videoContainer.appendChild(video)
videoContainer.appendChild(closeButton)
videoModal.appendChild(videoContainer)
videoModal.onclick = (e) => {
if (e.target === videoModal) {
document.body.removeChild(videoModal)
}
}
document.body.appendChild(videoModal)
}
</script>
@@ -472,7 +485,8 @@ const previewVideo = (videoUrl: string, title: string) => {
<div>
<h3 class="text-lg font-semibold">录入数字人</h3>
<p class="text-sm text-gray-500 mt-1">
"{{ currentTrainItem?.dh_name }}"创建系统数字人并分配给用户 {{ currentTrainItem?.user_id }}
"{{ currentTrainItem?.dh_name }}"创建系统数字人并分配给用户
{{ currentTrainItem?.user_id }}
</p>
</div>
</template>
@@ -571,4 +585,4 @@ const previewVideo = (videoUrl: string, title: string) => {
</div>
</template>
<style scoped></style>
<style scoped></style>

View File

@@ -81,23 +81,34 @@ const navigateToPage = (path: string) => {
class="w-8 h-8"
:class="{
'text-blue-600 dark:text-blue-400': page.color === 'blue',
'text-amber-600 dark:text-amber-400': page.color === 'amber',
'text-green-600 dark:text-green-400': page.color === 'green',
'text-amber-600 dark:text-amber-400':
page.color === 'amber',
'text-green-600 dark:text-green-400':
page.color === 'green',
}"
/>
</div>
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">
<h3
class="text-lg font-semibold text-gray-900 dark:text-white mb-2"
>
{{ page.title }}
</h3>
<p class="text-sm text-gray-600 dark:text-gray-400 leading-relaxed">
<p
class="text-sm text-gray-600 dark:text-gray-400 leading-relaxed"
>
{{ page.description }}
</p>
<div class="mt-4 flex items-center text-sm text-gray-500 dark:text-gray-400 group-hover:text-gray-700 dark:group-hover:text-gray-300 transition-colors">
<div
class="mt-4 flex items-center text-sm text-gray-500 dark:text-gray-400 group-hover:text-gray-700 dark:group-hover:text-gray-300 transition-colors"
>
<span>进入管理</span>
<UIcon name="i-heroicons-arrow-right" class="ml-1 w-4 h-4" />
<UIcon
name="i-heroicons-arrow-right"
class="ml-1 w-4 h-4"
/>
</div>
</div>
</UCard>
@@ -107,4 +118,4 @@ const navigateToPage = (path: string) => {
</div>
</template>
<style scoped></style>
<style scoped></style>

View File

@@ -147,7 +147,13 @@ const isUploadingEndingVideo = ref(false)
const isUploadingEndingCover = ref(false)
// 处理片头片尾请求
const handleProcessTitles = (item: TitlesTemplate & { user_id?: number; to_user_id?: number; remark?: string }) => {
const handleProcessTitles = (
item: TitlesTemplate & {
user_id?: number
to_user_id?: number
remark?: string
}
) => {
currentTitlesItem.value = item
// 预填充表单数据
@@ -157,7 +163,7 @@ const handleProcessTitles = (item: TitlesTemplate & { user_id?: number; to_user_
processFormState.opening_file = item.opening_file || ''
processFormState.ending_url = item.ending_url || ''
processFormState.ending_file = item.ending_file || ''
openingVideoFile.value = null
openingCoverFile.value = null
endingVideoFile.value = null
@@ -196,10 +202,10 @@ const handleOpeningVideoUpload = async (files: FileList) => {
try {
isUploadingOpeningVideo.value = true
openingVideoFile.value = file
const uploadUrl = await useFileGo(file, 'material')
processFormState.opening_file = uploadUrl
toast.add({
title: '片头视频上传成功',
color: 'green',
@@ -248,10 +254,10 @@ const handleOpeningCoverUpload = async (files: FileList) => {
try {
isUploadingOpeningCover.value = true
openingCoverFile.value = file
const uploadUrl = await useFileGo(file, 'material')
processFormState.opening_url = uploadUrl
toast.add({
title: '片头封面上传成功',
color: 'green',
@@ -300,10 +306,10 @@ const handleEndingVideoUpload = async (files: FileList) => {
try {
isUploadingEndingVideo.value = true
endingVideoFile.value = file
const uploadUrl = await useFileGo(file, 'material')
processFormState.ending_file = uploadUrl
toast.add({
title: '片尾视频上传成功',
color: 'green',
@@ -352,10 +358,10 @@ const handleEndingCoverUpload = async (files: FileList) => {
try {
isUploadingEndingCover.value = true
endingCoverFile.value = file
const uploadUrl = await useFileGo(file, 'material')
processFormState.ending_url = uploadUrl
toast.add({
title: '片尾封面上传成功',
color: 'green',
@@ -375,7 +381,9 @@ const handleEndingCoverUpload = async (files: FileList) => {
}
// 提交处理表单
const onProcessSubmit = async (event: FormSubmitEvent<typeof processFormState>) => {
const onProcessSubmit = async (
event: FormSubmitEvent<typeof processFormState>
) => {
if (!currentTitlesItem.value) return
if (isProcessing.value) return
@@ -399,7 +407,10 @@ const onProcessSubmit = async (event: FormSubmitEvent<typeof processFormState>)
>('App.User_UserTitles.updateStatus', {
token: loginState.token!,
user_id: loginState.user.id,
to_user_id: currentTitlesItem.value.to_user_id || currentTitlesItem.value.user_id || 0,
to_user_id:
currentTitlesItem.value.to_user_id ||
currentTitlesItem.value.user_id ||
0,
user_title_id: currentTitlesItem.value.id,
process_status: 1, // 标记为已完成
opening_url: event.data.opening_url,
@@ -439,7 +450,8 @@ const onProcessSubmit = async (event: FormSubmitEvent<typeof processFormState>)
}
} catch (error) {
console.error('处理片头片尾失败:', error)
const errorMessage = error instanceof Error ? error.message : '处理失败,请重试'
const errorMessage =
error instanceof Error ? error.message : '处理失败,请重试'
toast.add({
title: '处理失败',
description: errorMessage,
@@ -452,12 +464,14 @@ const onProcessSubmit = async (event: FormSubmitEvent<typeof processFormState>)
}
// 删除请求
const handleDeleteTitles = async (item: TitlesTemplate & { user_id?: number; to_user_id?: number }) => {
const handleDeleteTitles = async (
item: TitlesTemplate & { user_id?: number; to_user_id?: number }
) => {
try {
const result = await useFetchWrapped<
{
{
to_user_id: number
user_title_id: number
user_title_id: number
} & AuthedRequest,
BaseResponse<{ code: 0 | 1 }>
>('App.User_UserTitles.DeleteConn', {
@@ -480,7 +494,8 @@ const handleDeleteTitles = async (item: TitlesTemplate & { user_id?: number; to_
}
} catch (error) {
console.error('删除片头片尾请求失败:', error)
const errorMessage = error instanceof Error ? error.message : '删除失败,请重试'
const errorMessage =
error instanceof Error ? error.message : '删除失败,请重试'
toast.add({
title: '删除失败',
description: errorMessage,
@@ -575,12 +590,22 @@ const handleCreateOpeningVideoUpload = async (files: FileList) => {
if (!file) return
if (!file.type.startsWith('video/')) {
toast.add({ title: '文件格式错误', description: '请上传视频文件', color: 'red', icon: 'i-tabler-alert-triangle' })
toast.add({
title: '文件格式错误',
description: '请上传视频文件',
color: 'red',
icon: 'i-tabler-alert-triangle',
})
return
}
if (file.size > 100 * 1024 * 1024) {
toast.add({ title: '文件过大', description: '视频文件大小不能超过100MB', color: 'red', icon: 'i-tabler-alert-triangle' })
toast.add({
title: '文件过大',
description: '视频文件大小不能超过100MB',
color: 'red',
icon: 'i-tabler-alert-triangle',
})
return
}
@@ -589,10 +614,19 @@ const handleCreateOpeningVideoUpload = async (files: FileList) => {
createOpeningVideoFile.value = file
const uploadUrl = await useFileGo(file, 'material')
createFormState.opening_file = uploadUrl
toast.add({ title: '片头视频上传成功', color: 'green', icon: 'i-tabler-check' })
toast.add({
title: '片头视频上传成功',
color: 'green',
icon: 'i-tabler-check',
})
} catch (error) {
console.error('片头视频上传失败:', error)
toast.add({ title: '上传失败', description: error instanceof Error ? error.message : '请重试', color: 'red', icon: 'i-tabler-alert-triangle' })
toast.add({
title: '上传失败',
description: error instanceof Error ? error.message : '请重试',
color: 'red',
icon: 'i-tabler-alert-triangle',
})
} finally {
isUploadingCreateOpeningVideo.value = false
}
@@ -603,12 +637,22 @@ const handleCreateOpeningCoverUpload = async (files: FileList) => {
if (!file) return
if (!file.type.startsWith('image/')) {
toast.add({ title: '文件格式错误', description: '请上传图片文件', color: 'red', icon: 'i-tabler-alert-triangle' })
toast.add({
title: '文件格式错误',
description: '请上传图片文件',
color: 'red',
icon: 'i-tabler-alert-triangle',
})
return
}
if (file.size > 10 * 1024 * 1024) {
toast.add({ title: '文件过大', description: '图片文件大小不能超过10MB', color: 'red', icon: 'i-tabler-alert-triangle' })
toast.add({
title: '文件过大',
description: '图片文件大小不能超过10MB',
color: 'red',
icon: 'i-tabler-alert-triangle',
})
return
}
@@ -617,10 +661,19 @@ const handleCreateOpeningCoverUpload = async (files: FileList) => {
createOpeningCoverFile.value = file
const uploadUrl = await useFileGo(file, 'material')
createFormState.opening_url = uploadUrl
toast.add({ title: '片头封面上传成功', color: 'green', icon: 'i-tabler-check' })
toast.add({
title: '片头封面上传成功',
color: 'green',
icon: 'i-tabler-check',
})
} catch (error) {
console.error('片头封面上传失败:', error)
toast.add({ title: '上传失败', description: error instanceof Error ? error.message : '请重试', color: 'red', icon: 'i-tabler-alert-triangle' })
toast.add({
title: '上传失败',
description: error instanceof Error ? error.message : '请重试',
color: 'red',
icon: 'i-tabler-alert-triangle',
})
} finally {
isUploadingCreateOpeningCover.value = false
}
@@ -631,12 +684,22 @@ const handleCreateEndingVideoUpload = async (files: FileList) => {
if (!file) return
if (!file.type.startsWith('video/')) {
toast.add({ title: '文件格式错误', description: '请上传视频文件', color: 'red', icon: 'i-tabler-alert-triangle' })
toast.add({
title: '文件格式错误',
description: '请上传视频文件',
color: 'red',
icon: 'i-tabler-alert-triangle',
})
return
}
if (file.size > 100 * 1024 * 1024) {
toast.add({ title: '文件过大', description: '视频文件大小不能超过100MB', color: 'red', icon: 'i-tabler-alert-triangle' })
toast.add({
title: '文件过大',
description: '视频文件大小不能超过100MB',
color: 'red',
icon: 'i-tabler-alert-triangle',
})
return
}
@@ -645,10 +708,19 @@ const handleCreateEndingVideoUpload = async (files: FileList) => {
createEndingVideoFile.value = file
const uploadUrl = await useFileGo(file, 'material')
createFormState.ending_file = uploadUrl
toast.add({ title: '片尾视频上传成功', color: 'green', icon: 'i-tabler-check' })
toast.add({
title: '片尾视频上传成功',
color: 'green',
icon: 'i-tabler-check',
})
} catch (error) {
console.error('片尾视频上传失败:', error)
toast.add({ title: '上传失败', description: error instanceof Error ? error.message : '请重试', color: 'red', icon: 'i-tabler-alert-triangle' })
toast.add({
title: '上传失败',
description: error instanceof Error ? error.message : '请重试',
color: 'red',
icon: 'i-tabler-alert-triangle',
})
} finally {
isUploadingCreateEndingVideo.value = false
}
@@ -659,12 +731,22 @@ const handleCreateEndingCoverUpload = async (files: FileList) => {
if (!file) return
if (!file.type.startsWith('image/')) {
toast.add({ title: '文件格式错误', description: '请上传图片文件', color: 'red', icon: 'i-tabler-alert-triangle' })
toast.add({
title: '文件格式错误',
description: '请上传图片文件',
color: 'red',
icon: 'i-tabler-alert-triangle',
})
return
}
if (file.size > 10 * 1024 * 1024) {
toast.add({ title: '文件过大', description: '图片文件大小不能超过10MB', color: 'red', icon: 'i-tabler-alert-triangle' })
toast.add({
title: '文件过大',
description: '图片文件大小不能超过10MB',
color: 'red',
icon: 'i-tabler-alert-triangle',
})
return
}
@@ -673,17 +755,28 @@ const handleCreateEndingCoverUpload = async (files: FileList) => {
createEndingCoverFile.value = file
const uploadUrl = await useFileGo(file, 'material')
createFormState.ending_url = uploadUrl
toast.add({ title: '片尾封面上传成功', color: 'green', icon: 'i-tabler-check' })
toast.add({
title: '片尾封面上传成功',
color: 'green',
icon: 'i-tabler-check',
})
} catch (error) {
console.error('片尾封面上传失败:', error)
toast.add({ title: '上传失败', description: error instanceof Error ? error.message : '请重试', color: 'red', icon: 'i-tabler-alert-triangle' })
toast.add({
title: '上传失败',
description: error instanceof Error ? error.message : '请重试',
color: 'red',
icon: 'i-tabler-alert-triangle',
})
} finally {
isUploadingCreateEndingCover.value = false
}
}
// 提交创建表单
const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) => {
const onCreateSubmit = async (
event: FormSubmitEvent<typeof createFormState>
) => {
if (isCreating.value) return
try {
@@ -738,7 +831,8 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
}
} catch (error) {
console.error('创建片头片尾模板失败:', error)
const errorMessage = error instanceof Error ? error.message : '创建失败,请重试'
const errorMessage =
error instanceof Error ? error.message : '创建失败,请重试'
toast.add({
title: '创建失败',
description: errorMessage,
@@ -797,14 +891,24 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
:variant="statusFilter === 0 ? 'solid' : 'ghost'"
label="待处理"
icon="i-tabler-clock"
@click="statusFilter = 0; pagination.page = 1"
@click="
() => {
statusFilter = 0
pagination.page = 1
}
"
/>
<UButton
:color="statusFilter === 1 ? 'primary' : 'gray'"
:variant="statusFilter === 1 ? 'solid' : 'ghost'"
label="已完成"
icon="i-tabler-check"
@click="statusFilter = 1; pagination.page = 1"
@click="
() => {
statusFilter = 1
pagination.page = 1
}
"
/>
</UButtonGroup>
<UBadge
@@ -835,16 +939,27 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
</template>
<template #info-data="{ row }">
<div v-if="row.info" class="flex items-center gap-2">
<div
v-if="row.info"
class="flex items-center gap-2"
>
<img
v-if="row.info.opening_url"
:src="row.info.opening_url"
:alt="row.info.title"
class="w-16 h-9 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity"
@click="previewVideo(row.info.opening_file, `原始模板: ${row.info.title}`)"
@click="
previewVideo(
row.info.opening_file,
`原始模板: ${row.info.title}`
)
"
/>
<div class="flex flex-col min-w-0">
<span class="text-xs font-medium text-gray-700 dark:text-gray-300 truncate" :title="row.info.title">
<span
class="text-xs font-medium text-gray-700 dark:text-gray-300 truncate"
:title="row.info.title"
>
{{ row.info.title }}
</span>
<span class="text-2xs text-gray-500 dark:text-gray-400">
@@ -852,13 +967,24 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
</span>
</div>
</div>
<span v-else class="text-sm text-gray-400">-</span>
<span
v-else
class="text-sm text-gray-400"
>
-
</span>
</template>
<template #preview-data="{ row }">
<div class="flex items-center gap-3" v-if="row.opening_file || row.ending_file">
<div
class="flex items-center gap-3"
v-if="row.opening_file || row.ending_file"
>
<!-- 片头 -->
<div v-if="row.opening_file" class="flex flex-col items-center gap-0.5">
<div
v-if="row.opening_file"
class="flex flex-col items-center gap-0.5"
>
<img
v-if="row.opening_url"
:src="row.opening_url"
@@ -871,12 +997,20 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
class="w-14 h-8 bg-blue-100 dark:bg-blue-900/30 rounded flex items-center justify-center cursor-pointer hover:opacity-80 transition-opacity"
@click="previewVideo(row.opening_file, '制作片头预览')"
>
<UIcon name="i-tabler-player-play" class="text-blue-500" />
<UIcon
name="i-tabler-player-play"
class="text-blue-500"
/>
</div>
<span class="text-2xs text-blue-600 dark:text-blue-400">片头</span>
<span class="text-2xs text-blue-600 dark:text-blue-400">
片头
</span>
</div>
<!-- 片尾 -->
<div v-if="row.ending_file" class="flex flex-col items-center gap-0.5">
<div
v-if="row.ending_file"
class="flex flex-col items-center gap-0.5"
>
<img
v-if="row.ending_url"
:src="row.ending_url"
@@ -889,12 +1023,22 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
class="w-14 h-8 bg-green-100 dark:bg-green-900/30 rounded flex items-center justify-center cursor-pointer hover:opacity-80 transition-opacity"
@click="previewVideo(row.ending_file, '制作片尾预览')"
>
<UIcon name="i-tabler-player-play" class="text-green-500" />
<UIcon
name="i-tabler-player-play"
class="text-green-500"
/>
</div>
<span class="text-2xs text-green-600 dark:text-green-400">片尾</span>
<span class="text-2xs text-green-600 dark:text-green-400">
片尾
</span>
</div>
</div>
<span v-else class="text-sm text-gray-400">未上传</span>
<span
v-else
class="text-sm text-gray-400"
>
未上传
</span>
</template>
<template #actions-data="{ row }">
@@ -964,7 +1108,9 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
<div>
<h3 class="text-lg font-semibold">处理片头片尾请求</h3>
<p class="text-sm text-gray-500 mt-1">
为用户 {{ currentTitlesItem?.to_user_id || currentTitlesItem?.user_id }} 上传制作好的片头片尾视频
为用户
{{ currentTitlesItem?.to_user_id || currentTitlesItem?.user_id }}
上传制作好的片头片尾视频
</p>
</div>
</template>
@@ -1014,10 +1160,19 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
/>
<div class="mt-2">
<span class="text-sm text-gray-600 dark:text-gray-400">
{{ isUploadingOpeningVideo ? '上传中...' : (openingVideoFile ? openingVideoFile.name : '点击或拖拽上传片头视频') }}
{{
isUploadingOpeningVideo
? '上传中...'
: openingVideoFile
? openingVideoFile.name
: '点击或拖拽上传片头视频'
}}
</span>
</div>
<p v-if="processFormState.opening_file" class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto">
<p
v-if="processFormState.opening_file"
class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto"
>
{{ processFormState.opening_file }}
</p>
</div>
@@ -1048,10 +1203,19 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
/>
<div class="mt-2">
<span class="text-sm text-gray-600 dark:text-gray-400">
{{ isUploadingOpeningCover ? '上传中...' : (openingCoverFile ? openingCoverFile.name : '点击或拖拽上传片头封面') }}
{{
isUploadingOpeningCover
? '上传中...'
: openingCoverFile
? openingCoverFile.name
: '点击或拖拽上传片头封面'
}}
</span>
</div>
<p v-if="processFormState.opening_url" class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto">
<p
v-if="processFormState.opening_url"
class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto"
>
{{ processFormState.opening_url }}
</p>
</div>
@@ -1084,10 +1248,19 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
/>
<div class="mt-2">
<span class="text-sm text-gray-600 dark:text-gray-400">
{{ isUploadingEndingVideo ? '上传中...' : (endingVideoFile ? endingVideoFile.name : '点击或拖拽上传片尾视频') }}
{{
isUploadingEndingVideo
? '上传中...'
: endingVideoFile
? endingVideoFile.name
: '点击或拖拽上传片尾视频'
}}
</span>
</div>
<p v-if="processFormState.ending_file" class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto">
<p
v-if="processFormState.ending_file"
class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto"
>
{{ processFormState.ending_file }}
</p>
</div>
@@ -1118,10 +1291,19 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
/>
<div class="mt-2">
<span class="text-sm text-gray-600 dark:text-gray-400">
{{ isUploadingEndingCover ? '上传中...' : (endingCoverFile ? endingCoverFile.name : '点击或拖拽上传片尾封面') }}
{{
isUploadingEndingCover
? '上传中...'
: endingCoverFile
? endingCoverFile.name
: '点击或拖拽上传片尾封面'
}}
</span>
</div>
<p v-if="processFormState.ending_url" class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto">
<p
v-if="processFormState.ending_url"
class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto"
>
{{ processFormState.ending_url }}
</p>
</div>
@@ -1142,7 +1324,13 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
type="submit"
color="primary"
:loading="isProcessing"
:disabled="isProcessing || isUploadingOpeningVideo || isUploadingOpeningCover || isUploadingEndingVideo || isUploadingEndingCover"
:disabled="
isProcessing ||
isUploadingOpeningVideo ||
isUploadingOpeningCover ||
isUploadingEndingVideo ||
isUploadingEndingCover
"
>
{{ isProcessing ? '提交中...' : '提交并分配' }}
</UButton>
@@ -1255,7 +1443,10 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
name="title"
required
>
<UInput v-model="createFormState.title" placeholder="请输入模板标题" />
<UInput
v-model="createFormState.title"
placeholder="请输入模板标题"
/>
</UFormGroup>
<UFormGroup
@@ -1263,7 +1454,10 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
name="description"
required
>
<UTextarea v-model="createFormState.description" placeholder="请输入模板描述" />
<UTextarea
v-model="createFormState.description"
placeholder="请输入模板描述"
/>
</UFormGroup>
<UDivider label="片头" />
@@ -1291,10 +1485,19 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
/>
<div class="mt-2">
<span class="text-sm text-gray-600 dark:text-gray-400">
{{ isUploadingCreateOpeningVideo ? '上传中...' : (createOpeningVideoFile ? createOpeningVideoFile.name : '点击或拖拽上传片头视频') }}
{{
isUploadingCreateOpeningVideo
? '上传中...'
: createOpeningVideoFile
? createOpeningVideoFile.name
: '点击或拖拽上传片头视频'
}}
</span>
</div>
<p v-if="createFormState.opening_file" class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto">
<p
v-if="createFormState.opening_file"
class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto"
>
{{ createFormState.opening_file }}
</p>
</div>
@@ -1325,10 +1528,19 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
/>
<div class="mt-2">
<span class="text-sm text-gray-600 dark:text-gray-400">
{{ isUploadingCreateOpeningCover ? '上传中...' : (createOpeningCoverFile ? createOpeningCoverFile.name : '点击或拖拽上传片头封面') }}
{{
isUploadingCreateOpeningCover
? '上传中...'
: createOpeningCoverFile
? createOpeningCoverFile.name
: '点击或拖拽上传片头封面'
}}
</span>
</div>
<p v-if="createFormState.opening_url" class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto">
<p
v-if="createFormState.opening_url"
class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto"
>
{{ createFormState.opening_url }}
</p>
</div>
@@ -1361,10 +1573,19 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
/>
<div class="mt-2">
<span class="text-sm text-gray-600 dark:text-gray-400">
{{ isUploadingCreateEndingVideo ? '上传中...' : (createEndingVideoFile ? createEndingVideoFile.name : '点击或拖拽上传片尾视频') }}
{{
isUploadingCreateEndingVideo
? '上传中...'
: createEndingVideoFile
? createEndingVideoFile.name
: '点击或拖拽上传片尾视频'
}}
</span>
</div>
<p v-if="createFormState.ending_file" class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto">
<p
v-if="createFormState.ending_file"
class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto"
>
{{ createFormState.ending_file }}
</p>
</div>
@@ -1395,10 +1616,19 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
/>
<div class="mt-2">
<span class="text-sm text-gray-600 dark:text-gray-400">
{{ isUploadingCreateEndingCover ? '上传中...' : (createEndingCoverFile ? createEndingCoverFile.name : '点击或拖拽上传片尾封面') }}
{{
isUploadingCreateEndingCover
? '上传中...'
: createEndingCoverFile
? createEndingCoverFile.name
: '点击或拖拽上传片尾封面'
}}
</span>
</div>
<p v-if="createFormState.ending_url" class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto">
<p
v-if="createFormState.ending_url"
class="mt-1 text-xs text-green-600 truncate max-w-xs mx-auto"
>
{{ createFormState.ending_url }}
</p>
</div>
@@ -1422,7 +1652,13 @@ const onCreateSubmit = async (event: FormSubmitEvent<typeof createFormState>) =>
form="createForm"
color="primary"
:loading="isCreating"
:disabled="isCreating || isUploadingCreateOpeningVideo || isUploadingCreateOpeningCover || isUploadingCreateEndingVideo || isUploadingCreateEndingCover"
:disabled="
isCreating ||
isUploadingCreateOpeningVideo ||
isUploadingCreateOpeningCover ||
isUploadingCreateEndingVideo ||
isUploadingCreateEndingCover
"
>
{{ isCreating ? '创建中...' : '创建模板' }}
</UButton>

View File

@@ -596,8 +596,8 @@ const udpateBalance = (tag: ServiceTag, isActivate: boolean = false) => {
</UBadge>
<UBadge
v-else-if="
getBalanceByTag(row.tag)!.expire_time < dayjs().unix()
"
getBalanceByTag(row.tag)!.expire_time < dayjs().unix()
"
color="red"
variant="subtle"
size="xs"
@@ -662,7 +662,9 @@ const udpateBalance = (tag: ServiceTag, isActivate: boolean = false) => {
开通
</UButton>
<UButton
v-else-if="getBalanceByTag(row.tag)!.expire_time < dayjs().unix()"
v-else-if="
getBalanceByTag(row.tag)!.expire_time < dayjs().unix()
"
color="teal"
icon="tabler:clock-plus"
size="xs"
@@ -684,15 +686,17 @@ const udpateBalance = (tag: ServiceTag, isActivate: boolean = false) => {
size="xs"
variant="soft"
@click="
() => {
isActivateBalance = false
userBalanceEditing = true
userBalanceState.request_type = row.tag
userBalanceState.expire_time =
getBalanceByTag(row.tag)!.expire_time * 1000
userBalanceState.remain_count = getBalanceByTag(row.tag)!.remain_count
}
"
() => {
isActivateBalance = false
userBalanceEditing = true
userBalanceState.request_type = row.tag
userBalanceState.expire_time =
getBalanceByTag(row.tag)!.expire_time * 1000
userBalanceState.remain_count = getBalanceByTag(
row.tag
)!.remain_count
}
"
>
更新
</UButton>
@@ -867,7 +871,10 @@ const udpateBalance = (tag: ServiceTag, isActivate: boolean = false) => {
default-tab="system"
multiple
@close="isDigitalSelectorOpen = false"
@select="digitalHumans => onDigitalHumansSelected(digitalHumans as DigitalHumanItem[])"
@select="
(digitalHumans) =>
onDigitalHumansSelected(digitalHumans as DigitalHumanItem[])
"
/>
</USlideover>
</LoginNeededContent>

View File

@@ -11,22 +11,21 @@ const loginState = useLoginState()
const deletePending = ref(false)
const page = ref(1)
const {
data: courseList,
refresh: refreshCourseList,
} = useAsyncData(
() => useFetchWrapped<
req.gen.CourseGenList & AuthedRequest,
BaseResponse<PagedData<resp.gen.CourseGenItem>>
>('App.Digital_Convert.GetList', {
token: loginState.token!,
user_id: loginState.user.id,
to_user_id: loginState.user.id,
page: page.value,
perpage: 15,
}), {
const { data: courseList, refresh: refreshCourseList } = useAsyncData(
() =>
useFetchWrapped<
req.gen.CourseGenList & AuthedRequest,
BaseResponse<PagedData<resp.gen.CourseGenItem>>
>('App.Digital_Convert.GetList', {
token: loginState.token!,
user_id: loginState.user.id,
to_user_id: loginState.user.id,
page: page.value,
perpage: 15,
}),
{
watch: [page],
},
}
)
const onCreateCourseClick = () => {
@@ -48,31 +47,33 @@ const onCourseDelete = (task_id: string) => {
user_id: loginState.user.id,
to_user_id: loginState.user.id,
task_id,
}).then(res => {
if (res.ret === 200) {
toast.add({
title: '删除成功',
description: '已删除任务记录',
color: 'green',
icon: 'i-tabler-check',
})
} else {
toast.add({
title: '删除失败',
description: res.msg || '未知错误',
color: 'red',
icon: 'i-tabler-alert-triangle',
})
}
}).finally(() => {
deletePending.value = false
refreshCourseList()
})
.then((res) => {
if (res.ret === 200) {
toast.add({
title: '删除成功',
description: '已删除任务记录',
color: 'green',
icon: 'i-tabler-check',
})
} else {
toast.add({
title: '删除失败',
description: res.msg || '未知错误',
color: 'red',
icon: 'i-tabler-alert-triangle',
})
}
})
.finally(() => {
deletePending.value = false
refreshCourseList()
})
}
const beforeLeave = (el: any) => {
el.style.width = `${ el.offsetWidth }px`
el.style.height = `${ el.offsetHeight }px`
el.style.width = `${el.offsetWidth}px`
el.style.height = `${el.offsetHeight}px`
}
const leave = (el: any, done: Function) => {
@@ -91,7 +92,10 @@ onMounted(() => {
<template>
<div>
<div class="p-4 pb-0">
<BubbleTitle subtitle="VIDEOS" title="我的微课视频">
<BubbleTitle
subtitle="VIDEOS"
title="我的微课视频"
>
<template #action>
<UButton
:trailing="false"
@@ -100,30 +104,38 @@ onMounted(() => {
label="新建微课"
size="md"
variant="solid"
@click="() => {
if (!loginState.is_logged_in) {
modal.open(ModalAuthentication)
return
@click="
() => {
if (!loginState.is_logged_in) {
modal.open(ModalAuthentication)
return
}
onCreateCourseClick()
}
onCreateCourseClick()
}"
"
/>
</template>
</BubbleTitle>
<GradientDivider/>
<GradientDivider />
</div>
<Transition name="loading-screen">
<div
v-if="courseList?.data.items.length === 0"
class="w-full py-20 flex flex-col justify-center items-center gap-2"
>
<Icon class="text-7xl text-neutral-300 dark:text-neutral-700" name="i-tabler-photo-hexagon"/>
<p class="text-sm text-neutral-500 dark:text-neutral-400">
没有记录
</p>
<Icon
class="text-7xl text-neutral-300 dark:text-neutral-700"
name="i-tabler-photo-hexagon"
/>
<p class="text-sm text-neutral-500 dark:text-neutral-400">没有记录</p>
</div>
<div v-else class="p-4">
<div class="relative grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 fhd:grid-cols-5 gap-4">
<div
v-else
class="p-4"
>
<div
class="relative grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 fhd:grid-cols-5 gap-4"
>
<TransitionGroup
name="card"
@beforeLeave="beforeLeave"
@@ -138,13 +150,16 @@ onMounted(() => {
</TransitionGroup>
</div>
<div class="flex justify-end mt-4">
<UPagination v-model="page" :max="9" :page-count="16" :total="courseList?.data.total || 0"/>
<UPagination
v-model="page"
:max="9"
:page-count="16"
:total="courseList?.data.total || 0"
/>
</div>
</div>
</Transition>
</div>
</template>
<style scoped>
</style>
<style scoped></style>

View File

@@ -15,25 +15,24 @@ const pageCount = ref(15)
const searchInput = ref('')
const debounceSearch = refDebounced(searchInput, 1000)
watch(debounceSearch, () => page.value = 1)
watch(debounceSearch, () => (page.value = 1))
const {
data: videoList,
refresh: refreshVideoList,
} = useAsyncData(
() => useFetchWrapped<
req.gen.GBVideoList & AuthedRequest,
BaseResponse<PagedData<GBVideoItem>>
>('App.Digital_VideoTask.GetList', {
token: loginState.token!,
user_id: loginState.user.id,
to_user_id: loginState.user.id,
page: page.value,
perpage: pageCount.value,
title: debounceSearch.value,
}), {
const { data: videoList, refresh: refreshVideoList } = useAsyncData(
() =>
useFetchWrapped<
req.gen.GBVideoList & AuthedRequest,
BaseResponse<PagedData<GBVideoItem>>
>('App.Digital_VideoTask.GetList', {
token: loginState.token!,
user_id: loginState.user.id,
to_user_id: loginState.user.id,
page: page.value,
perpage: pageCount.value,
title: debounceSearch.value,
}),
{
watch: [page, pageCount, debounceSearch],
},
}
)
const onCreateCourseGreenClick = () => {
@@ -53,7 +52,7 @@ const onCourseGreenDelete = (task: GBVideoItem) => {
token: loginState.token!,
user_id: loginState.user.id,
task_id: task.task_id,
}).then(res => {
}).then((res) => {
if (res.data.code === 1) {
refreshVideoList()
toast.add({
@@ -74,8 +73,8 @@ const onCourseGreenDelete = (task: GBVideoItem) => {
}
const beforeLeave = (el: any) => {
el.style.width = `${ el.offsetWidth }px`
el.style.height = `${ el.offsetHeight }px`
el.style.width = `${el.offsetWidth}px`
el.style.height = `${el.offsetHeight}px`
}
const leave = (el: any, done: Function) => {
@@ -126,7 +125,11 @@ onMounted(() => {
<div class="p-4 pb-0">
<BubbleTitle
:subtitle="!debounceSearch ? 'GB VIDEOS' : 'SEARCH...'"
:title="!debounceSearch ? '我的绿幕视频' : `标题搜索:${debounceSearch.toLocaleUpperCase()}`"
:title="
!debounceSearch
? '我的绿幕视频'
: `标题搜索:${debounceSearch.toLocaleUpperCase()}`
"
>
<template #action>
<UButtonGroup size="md">
@@ -163,7 +166,7 @@ onMounted(() => {
/>
</template>
</BubbleTitle>
<GradientDivider/>
<GradientDivider />
</div>
<Transition name="loading-screen">
@@ -171,14 +174,17 @@ onMounted(() => {
v-if="videoList?.data.items.length === 0"
class="w-full py-20 flex flex-col justify-center items-center gap-2"
>
<Icon class="text-7xl text-neutral-300 dark:text-neutral-700" name="i-tabler-photo-hexagon"/>
<p class="text-sm text-neutral-500 dark:text-neutral-400">
没有记录
</p>
<Icon
class="text-7xl text-neutral-300 dark:text-neutral-700"
name="i-tabler-photo-hexagon"
/>
<p class="text-sm text-neutral-500 dark:text-neutral-400">没有记录</p>
</div>
<div v-else>
<div class="p-4">
<div class="relative grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-3 fhd:grid-cols-5 gap-4">
<div
class="relative grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-3 fhd:grid-cols-5 gap-4"
>
<TransitionGroup
name="card"
@beforeLeave="beforeLeave"
@@ -188,20 +194,22 @@ onMounted(() => {
v-for="(v, i) in videoList?.data.items"
:key="v.task_id"
:video="v"
@delete="v => onCourseGreenDelete(v)"
@delete="(v) => onCourseGreenDelete(v)"
/>
</TransitionGroup>
</div>
<div class="flex justify-end mt-4">
<UPagination v-model="page" :max="9" :page-count="pageCount" :total="videoList?.data.total || 0"/>
<UPagination
v-model="page"
:max="9"
:page-count="pageCount"
:total="videoList?.data.total || 0"
/>
</div>
</div>
</div>
</Transition>
</div>
</template>
<style scoped>
</style>
<style scoped></style>

View File

@@ -23,21 +23,21 @@ const {
status: systemTitlesTemplateStatus,
refresh: refreshSystemTitlesTemplate,
} = useAsyncData(
'systemTitlesTemplate',
() =>
useFetchWrapped<
PagedDataRequest & AuthedRequest,
BaseResponse<PagedData<TitlesTemplate>>
>('App.Digital_Titles.GetList', {
token: loginState.token!,
user_id: loginState.user.id,
page: systemPagination.page,
perpage: systemPagination.pageSize,
}),
{
watch: [systemPagination],
}
)
'systemTitlesTemplate',
() =>
useFetchWrapped<
PagedDataRequest & AuthedRequest,
BaseResponse<PagedData<TitlesTemplate>>
>('App.Digital_Titles.GetList', {
token: loginState.token!,
user_id: loginState.user.id,
page: systemPagination.page,
perpage: systemPagination.pageSize,
}),
{
watch: [systemPagination],
}
)
const {
data: userTitlesTemplate,
@@ -88,7 +88,7 @@ const userTitlesState = reactive({
title_id: 0,
title: '',
description: '',
remark: ''
remark: '',
})
const onUserTitlesRequest = (titles: TitlesTemplate) => {
@@ -215,18 +215,18 @@ const onUserTitlesSubmit = (event: FormSubmitEvent<UserTitlesSchema>) => {
title="片头片尾模版"
subtitle="Materials"
>
<template #action>
<UButton
color="amber"
icon="tabler:plus"
variant="soft"
v-if="loginState.user.auth_code === 2"
@click="isCreateSystemTitlesSlideActive = true"
>
创建模板
</UButton>
</template>
</BubbleTitle>
<template #action>
<UButton
color="amber"
icon="tabler:plus"
variant="soft"
v-if="loginState.user.auth_code === 2"
@click="isCreateSystemTitlesSlideActive = true"
>
创建模板
</UButton>
</template>
</BubbleTitle>
<GradientDivider />
</div>
<div class="p-4">
@@ -248,7 +248,9 @@ const onUserTitlesSubmit = (event: FormSubmitEvent<UserTitlesSchema>) => {
class="text-7xl text-neutral-300 dark:text-neutral-700"
name="i-tabler-photo-hexagon"
/>
<p class="text-sm text-neutral-500 dark:text-neutral-400">暂时没有可用模板</p>
<p class="text-sm text-neutral-500 dark:text-neutral-400">
暂时没有可用模板
</p>
</div>
<div
class="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-5 gap-4"