refactor!: 升级 @nuxt/ui@3,重构所有页面和组件,调整配置,移除不在需求中的页面
This commit is contained in:
@@ -4,8 +4,9 @@ import SlideCreateCourse from '~/components/SlideCreateCourse.vue'
|
||||
import { useFetchWrapped } from '~/composables/useFetchWrapped'
|
||||
|
||||
const toast = useToast()
|
||||
const modal = useModal()
|
||||
const slide = useSlideover()
|
||||
const overlay = useOverlay()
|
||||
const modal = overlay.create(ModalAuthentication)
|
||||
const slide = overlay.create(SlideCreateCourse)
|
||||
const loginState = useLoginState()
|
||||
|
||||
const deletePending = ref(false)
|
||||
@@ -28,12 +29,10 @@ const { data: courseList, refresh: refreshCourseList } = useAsyncData(
|
||||
}
|
||||
)
|
||||
|
||||
const onCreateCourseClick = () => {
|
||||
slide.open(SlideCreateCourse, {
|
||||
onSuccess: () => {
|
||||
refreshCourseList()
|
||||
},
|
||||
})
|
||||
const onCreateCourseClick = async () => {
|
||||
const slideInst = slide.open()
|
||||
await slideInst
|
||||
refreshCourseList()
|
||||
}
|
||||
|
||||
const onCourseDelete = (task_id: string) => {
|
||||
@@ -53,14 +52,14 @@ const onCourseDelete = (task_id: string) => {
|
||||
toast.add({
|
||||
title: '删除成功',
|
||||
description: '已删除任务记录',
|
||||
color: 'green',
|
||||
color: 'success',
|
||||
icon: 'i-tabler-check',
|
||||
})
|
||||
} else {
|
||||
toast.add({
|
||||
title: '删除失败',
|
||||
description: res.msg || '未知错误',
|
||||
color: 'red',
|
||||
color: 'error',
|
||||
icon: 'i-tabler-alert-triangle',
|
||||
})
|
||||
}
|
||||
@@ -107,7 +106,7 @@ onMounted(() => {
|
||||
@click="
|
||||
() => {
|
||||
if (!loginState.is_logged_in) {
|
||||
modal.open(ModalAuthentication)
|
||||
modal.open()
|
||||
return
|
||||
}
|
||||
onCreateCourseClick()
|
||||
@@ -121,7 +120,7 @@ onMounted(() => {
|
||||
<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"
|
||||
class="flex w-full flex-col items-center justify-center gap-2 py-20"
|
||||
>
|
||||
<Icon
|
||||
class="text-7xl text-neutral-300 dark:text-neutral-700"
|
||||
@@ -134,7 +133,7 @@ onMounted(() => {
|
||||
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"
|
||||
class="relative grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 fhd:grid-cols-5"
|
||||
>
|
||||
<TransitionGroup
|
||||
name="card"
|
||||
@@ -149,9 +148,9 @@ onMounted(() => {
|
||||
/>
|
||||
</TransitionGroup>
|
||||
</div>
|
||||
<div class="flex justify-end mt-4">
|
||||
<div class="mt-4 flex justify-end">
|
||||
<UPagination
|
||||
v-model="page"
|
||||
v-model:page="page"
|
||||
:max="9"
|
||||
:page-count="16"
|
||||
:total="courseList?.data.total || 0"
|
||||
|
||||
Reference in New Issue
Block a user