feat(toast): 使用SVG图标替换字符图标并优化样式
- 新增四种SVG图标:info、success、warning、error - 修改Toast组件使用SVG图标替代字符图标 - 更新图标映射逻辑,使用IconId类型定义图标标识 - 调整Toast样式类,使用更具体的Tailwind类名 - 移除旧的alertStyles对象和字符图标映射 - 登录页面增加错误处理和Toast提示 - 布局文件微调菜单样式,增加顶部内边距
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
// await new Promise(r => setTimeout(r, 500));
|
||||
|
||||
await authService.login(loginPayload);
|
||||
|
||||
if (get(authStore).isAuthenticated) {
|
||||
toast.success('登录成功,正在跳转到首页')
|
||||
setTimeout( async () => {
|
||||
@@ -34,9 +35,14 @@
|
||||
}, 1000)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
// 这里建议加上一个 Toast 提示错误,比如 daisyUI 的 alert
|
||||
} catch (e:unknown) {
|
||||
if (e instanceof Error) {
|
||||
console.error(e);
|
||||
toast.error(e.message);
|
||||
} else {
|
||||
console.error(e);
|
||||
toast.error('登录失败,请重试');
|
||||
}
|
||||
} finally {
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user