feat: add SingleRecordMnt component for student record maintenance with search, add, edit, view, and delete functionalities

This commit is contained in:
skytek_xinliang
2026-03-26 11:24:37 +08:00
parent 507afcc99c
commit 069141794e
116 changed files with 15247 additions and 107 deletions
+45 -7
View File
@@ -6,16 +6,54 @@
// Composables
import { createRouter, createWebHistory } from 'vue-router'
import Index from '@/pages/index.vue'
import { HTTP_ERROR_EVENT, type HttpErrorDetail } from '@/services/http-error'
import { registerGuards } from './guards'
import { routes } from './routes'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
component: Index,
},
],
routes,
scrollBehavior(to, _from, savedPosition) {
// Back/Forward 恢復滾動位置(Restore scroll position
if (savedPosition) return savedPosition
// hash anchor
if (to.hash) return { el: to.hash, behavior: 'smooth' }
return { top: 0 }
},
})
registerGuards(router)
function getErrorRouteName (status?: number) {
switch (status) {
case 403: {
return 'forbidden'
}
case 404: {
return 'not-found'
}
case 500: {
return 'server-error'
}
case 503: {
return 'maintenance'
}
default: {
return 'network-error'
}
}
}
window.addEventListener(HTTP_ERROR_EVENT, (event: Event) => {
const detail = (event as CustomEvent<HttpErrorDetail>).detail
const name = getErrorRouteName(detail?.status)
if (router.currentRoute.value.name === name) return
const message = detail?.message?.trim()
void router.replace({
name,
query: message ? { message } : undefined,
})
})
export default router