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
+31
View File
@@ -0,0 +1,31 @@
// 全域 HTTP Toast 事件(Playground 專用)
//
// 目的:
// - 讓 axios interceptor 能用「事件」通知 UI 顯示錯誤提示,不需直接依賴 Pinia
// - 預設只用於「非阻斷」錯誤(例如 500 / 網路中斷),避免導頁打斷使用者
export const HTTP_TOAST_EVENT = 'sk-playground:http-toast'
export type HttpToastLevel = 'info' | 'warning' | 'error'
export type HttpToastDetail = {
level: HttpToastLevel
message: string
dedupeKey?: string
}
let lastKey = ''
let lastAt = 0
export function emitHttpToast (detail: HttpToastDetail) {
const now = Date.now()
const key = detail.dedupeKey ?? `${detail.level}:${detail.message}`
// 500ms 內同樣訊息不重複噴(避免同頁多支 API 一起爆)
if (key === lastKey && now - lastAt < 500) return
lastKey = key
lastAt = now
window.dispatchEvent(new CustomEvent<HttpToastDetail>(HTTP_TOAST_EVENT, { detail }))
}