mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
perf: 已登录状态访问登录页面自动跳转到首页
This commit is contained in:
@@ -101,6 +101,14 @@ function setupAccessGuard(router: Router) {
|
|||||||
return r.meta?.auth || r.meta?.permission;
|
return r.meta?.auth || r.meta?.permission;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (to.path === LOGIN_PATH && accessStore.accessToken) {
|
||||||
|
return {
|
||||||
|
path: DEFAULT_HOME_PATH,
|
||||||
|
// 携带当前跳转的页面,登录后重新跳转该页面
|
||||||
|
replace: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (!needAuth) {
|
if (!needAuth) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,12 +113,7 @@ export default defineComponent({
|
|||||||
setup() {
|
setup() {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
if (userStore.getToken) {
|
|
||||||
router.push("/");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const queryBindCode = ref(route.query.bindCode as string | undefined);
|
const queryBindCode = ref(route.query.bindCode as string | undefined);
|
||||||
|
|
||||||
@@ -256,6 +251,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
return sysPublicSettings.oauthOnly && settingStore.isPlus && sysPublicSettings.oauthEnabled;
|
return sysPublicSettings.oauthOnly && settingStore.isPlus && sysPublicSettings.oauthEnabled;
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
t,
|
t,
|
||||||
loading,
|
loading,
|
||||||
|
|||||||
Reference in New Issue
Block a user