mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 22:57:17 +08:00 
			
		
		
		
	refactor: 优化登录和菜单加载相关提示
This commit is contained in:
		| @@ -1,6 +1,6 @@ | ||||
| import { useRouter } from 'vue-router'; | ||||
| import { useI18n } from 'vue-i18n'; | ||||
| import { Message } from '@arco-design/web-vue'; | ||||
| import { Notification } from '@arco-design/web-vue'; | ||||
|  | ||||
| import { useLoginStore } from '@/store'; | ||||
|  | ||||
| @@ -11,7 +11,7 @@ export default function useUser() { | ||||
|   const logout = async (logoutTo?: string) => { | ||||
|     await loginStore.logout(); | ||||
|     const currentRoute = router.currentRoute.value; | ||||
|     Message.success(t('login.form.logout.success')); | ||||
|     Notification.success(t('login.form.logout.success')); | ||||
|     router.push({ | ||||
|       name: logoutTo && typeof logoutTo === 'string' ? logoutTo : 'login', | ||||
|       query: { | ||||
|   | ||||
| @@ -1,6 +1,11 @@ | ||||
| import { defineStore } from 'pinia'; | ||||
| import { Notification } from '@arco-design/web-vue'; | ||||
| import type { NotificationReturn } from '@arco-design/web-vue/es/notification/interface'; | ||||
| import { h } from 'vue'; | ||||
| import { Message } from '@arco-design/web-vue'; | ||||
| import { | ||||
|   IconCheckCircleFill, | ||||
|   IconCloseCircleFill, | ||||
| } from '@arco-design/web-vue/es/icon'; | ||||
| import type { MessageReturn } from '@arco-design/web-vue/es/message/interface'; | ||||
| import type { RouteRecordNormalized } from 'vue-router'; | ||||
| import defaultSettings from '@/config/settings.json'; | ||||
| import { listRoute } from '@/api/auth/login'; | ||||
| @@ -66,26 +71,26 @@ const useAppStore = defineStore('app', { | ||||
|       this.hideMenu = value; | ||||
|     }, | ||||
|     async fetchServerMenuConfig() { | ||||
|       let notifyInstance: NotificationReturn | null = null; | ||||
|       let messageInstance: MessageReturn | null = null; | ||||
|       try { | ||||
|         notifyInstance = Notification.info({ | ||||
|         messageInstance = Message.loading({ | ||||
|           id: 'menuNotice', // Keep the instance id the same | ||||
|           content: '菜单加载中...', | ||||
|           closable: true, | ||||
|           content: '菜单加载中', | ||||
|         }); | ||||
|         const { data } = await listRoute(); | ||||
|         this.serverMenu = data; | ||||
|         notifyInstance = Notification.success({ | ||||
|         messageInstance = Message.success({ | ||||
|           id: 'menuNotice', | ||||
|           content: '菜单加载成功', | ||||
|           closable: true, | ||||
|           duration: 1000, | ||||
|           icon: () => h(IconCheckCircleFill), | ||||
|         }); | ||||
|       } catch (error) { | ||||
|         // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||||
|         notifyInstance = Notification.error({ | ||||
|         messageInstance = Message.error({ | ||||
|           id: 'menuNotice', | ||||
|           content: '菜单加载失败', | ||||
|           closable: true, | ||||
|           icon: () => h(IconCloseCircleFill), | ||||
|         }); | ||||
|       } | ||||
|     }, | ||||
|   | ||||
| @@ -160,7 +160,7 @@ | ||||
|           const { rememberMe } = loginConfig.value; | ||||
|           const { username } = values; | ||||
|           loginConfig.value.username = rememberMe ? username : ''; | ||||
|           proxy.$message.success(t('login.form.login.success')); | ||||
|           proxy.$notification.success(t('login.form.login.success')); | ||||
|         }) | ||||
|         .catch(() => { | ||||
|           getCaptcha(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user