diff --git a/src/lib/components/ToastContainer.svelte b/src/lib/components/ToastContainer.svelte new file mode 100644 index 0000000..b568369 --- /dev/null +++ b/src/lib/components/ToastContainer.svelte @@ -0,0 +1,34 @@ + + +
+ {#each $toast as t (t.id)} +
+ {icons[t.type]} + {t.message} +
+ {/each} +
\ No newline at end of file diff --git a/src/lib/stores/toastStore.ts b/src/lib/stores/toastStore.ts new file mode 100644 index 0000000..5502b11 --- /dev/null +++ b/src/lib/stores/toastStore.ts @@ -0,0 +1,39 @@ +import { writable } from 'svelte/store'; + +export type ToastType = 'success' | 'error' | 'warning' | 'info'; + +export interface ToastMessage { + id: string; + type: ToastType; + message: string; + duration?: number; +} + +const createToastStore = () => { + + const {subscribe, update} = writable([]); + const send = (message:string, type:ToastType = 'info',duration = 3000)=> { + const id = crypto.randomUUID(); + update((toasts) => [...toasts,{id,type,message,duration}]) + if (duration > 0){ + setTimeout(()=>{ + remove(id); + },duration) + } + } + const remove = (id:string) => { + update((toasts) => toasts.filter(toast => toast.id !== id)) + } + + return { + subscribe, + success: (msg: string, duration = 3000) => send(msg, 'success', duration), + error: (msg: string, duration = 3000) => send(msg, 'error', duration), + warning: (msg: string, duration = 3000) => send(msg, 'warning', duration), + info: (msg: string, duration = 3000) => send(msg, 'info', duration), + remove + }; +}; + + +export const toast = createToastStore(); \ No newline at end of file diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index c1f5754..86c9344 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -7,6 +7,7 @@ import { onMount } from 'svelte'; import { sidebarStore } from '$lib/stores/sidebarStore.ts'; import Sprite from '$lib/components/icon/Sprite.svelte'; + import ToastContainer from '$lib/components/ToastContainer.svelte'; const MD_BREAKPOINT = '(min-width: 768px)'; @@ -69,5 +70,6 @@
+ {@render children()}
diff --git a/src/routes/auth/forgetPassword/+page.svelte b/src/routes/auth/forgetPassword/+page.svelte new file mode 100644 index 0000000..d07b789 --- /dev/null +++ b/src/routes/auth/forgetPassword/+page.svelte @@ -0,0 +1,7 @@ + + + +
+123 +
\ No newline at end of file diff --git a/src/routes/auth/login/+page.svelte b/src/routes/auth/login/+page.svelte index e92f864..4124df8 100644 --- a/src/routes/auth/login/+page.svelte +++ b/src/routes/auth/login/+page.svelte @@ -1,43 +1,119 @@ -
-
+
- - +
+
+
+

+ + IT DTMS登录 +

+
- - + - - +
+ +
+ + + + +
+
+ +
+ +
+ + + + +
+ +
+ +
+ + +
+ +
+ +
+ + +
+
\ No newline at end of file