🎨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>