diff --git a/src/App.vue b/src/App.vue
index 4cce815..404668d 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,16 +1,30 @@
-
+
diff --git a/src/views/login/components/pwd-login/index.vue b/src/views/login/components/pwd-login/index.vue
index d80339e..26e2e29 100644
--- a/src/views/login/components/pwd-login/index.vue
+++ b/src/views/login/components/pwd-login/index.vue
@@ -121,10 +121,9 @@ import {
import { OmsLoginType } from '@/api/rbac';
import { useRbacUserStore } from '@/store/modules/rbac-user';
import { setToken } from '@/utils/auth';
-import { useUserStore } from '@/store';
import { getDefaultHomePathByType } from '@/utils/login-portal';
-import { resolveAvatarUrl } from '@/utils/avatar';
-import { enterSystemAfterLogin } from '@/utils/enter-system';
+import { enterSystemAfterLogin, applyRbacUserToUserStore } from '@/utils/enter-system';
+import { ensureHeavyPlugins } from '@/plugins/heavy-plugins';
import { LOGIN_CHARACTERS_KEY, type LoginCharactersApi } from '../../composables/useLoginCharacters';
import { LOGIN_EXIT_KEY, type LoginExitApi } from '../../composables/useLoginExit';
import LoginLockLogo from '../LoginLockLogo.vue';
@@ -146,7 +145,6 @@ const emit = defineEmits<{
}>();
const router = useRouter();
-const userStore = useUserStore();
const rbacUserStore = useRbacUserStore();
const passwordInputRef = ref(null);
@@ -273,6 +271,7 @@ function togglePasswordVisible() {
function onAccountFocus() {
accountError.value = '';
loginCharacters.value?.onAccountFocus();
+ void ensureHeavyPlugins();
}
function onAccountBlur() {
@@ -282,6 +281,7 @@ function onAccountBlur() {
function onPasswordFocus() {
passwordError.value = '';
loginCharacters.value?.onPasswordFocus();
+ void ensureHeavyPlugins();
}
function onPasswordBlur() {
@@ -341,48 +341,31 @@ async function handleSubmit() {
setToken(rbacUserStore.token);
}
- const displayName =
- userInfoData.name || userInfoData.account || fallbackAccount || String(userInfoData.id ?? '');
- const userInfo: any = {
- account: userInfoData.account || fallbackAccount,
- name: displayName,
- avatar: resolveAvatarUrl(userInfoData.avatar),
- email: userInfoData.email,
- id: userInfoData.id,
- accountId: userInfoData.id,
- defaultModule: undefined,
- moduleList: [],
- };
-
- userStore.setInfo(userInfo);
+ applyRbacUserToUserStore(userInfoData, fallbackAccount);
const { redirect, ...othersQuery } = router.currentRoute.value.query;
const redirectStr = redirect as string | undefined;
const defaultHomePath = getDefaultHomePathByType(props.loginType);
- const defaultTarget = { path: defaultHomePath };
- const redirectParams: any = {
+ const redirectParams: Record = {
query: { ...othersQuery },
};
if (redirectStr) {
if (redirectStr.startsWith('/')) {
redirectParams.path = redirectStr;
- delete redirectParams.name;
} else {
redirectParams.name = redirectStr;
- delete redirectParams.path;
}
} else {
- redirectParams.path = defaultTarget.path;
- delete redirectParams.name;
+ redirectParams.path = defaultHomePath;
}
Message.success(t('login.form.login.success'));
await nextTick();
await enterSystemAfterLogin({
target: redirectParams,
- fallbackPath: defaultTarget.path,
+ fallbackPath: defaultHomePath,
playExit: () => loginExit?.playExitAnimation() ?? Promise.resolve(),
});
} else {
diff --git a/src/views/login/components/wechat-login.vue b/src/views/login/components/wechat-login.vue
index c904be3..0abca58 100644
--- a/src/views/login/components/wechat-login.vue
+++ b/src/views/login/components/wechat-login.vue
@@ -64,11 +64,9 @@ import { IconUser } from '@arco-design/web-vue/es/icon';
import { OmsLoginType } from '@/api/rbac';
import { getLoginQrcode, getWxLoginStatus, isWxLoginPendingError, wxLogin } from '@/api/wechat';
import { useRbacUserStore } from '@/store/modules/rbac-user';
-import { useUserStore } from '@/store';
import { setToken } from '@/utils/auth';
-import { resolveAvatarUrl } from '@/utils/avatar';
import { getDefaultHomePathByType } from '@/utils/login-portal';
-import { enterSystemAfterLogin } from '@/utils/enter-system';
+import { enterSystemAfterLogin, applyRbacUserToUserStore } from '@/utils/enter-system';
import { LOGIN_EXIT_KEY, type LoginExitApi } from '../composables/useLoginExit';
const QR_EXPIRE_MS = 600_000;
@@ -78,7 +76,6 @@ const POLL_INTERVAL_MS = 1800;
const { t } = useI18n();
const router = useRouter();
const rbacUserStore = useRbacUserStore();
-const userStore = useUserStore();
const loginExit = inject(LOGIN_EXIT_KEY, null);
const emit = defineEmits<{
@@ -145,16 +142,7 @@ async function navigateAfterLogin() {
setToken(rbacUserStore.token);
}
- userStore.setInfo({
- account: userInfoData.account,
- name: userInfoData.name || userInfoData.account || String(userInfoData.id ?? ''),
- avatar: resolveAvatarUrl(userInfoData.avatar),
- email: userInfoData.email,
- id: userInfoData.id,
- accountId: userInfoData.id,
- defaultModule: undefined,
- moduleList: [],
- });
+ applyRbacUserToUserStore(userInfoData);
const { redirect, ...othersQuery } = router.currentRoute.value.query;
const redirectStr = redirect as string | undefined;
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 31b95b2..8dfa351 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -17,7 +17,7 @@
-
+
@@ -64,15 +64,21 @@