🎨chore: 使用 oxlint, oxfmt&格式化代码
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user