feat(系统设置): 认证登陆调试跳转加判断

This commit is contained in:
guoyuqi 2024-07-09 17:42:24 +08:00 committed by 刘瑞斌
parent 3c39d61554
commit 7724e7939f
5 changed files with 21 additions and 14 deletions

View File

@ -198,4 +198,5 @@ export default {
'common.advancedSettings': 'Advanced settings', 'common.advancedSettings': 'Advanced settings',
'common.auth_redirect_tip': 'You will be redirected to the certification source page for certification', 'common.auth_redirect_tip': 'You will be redirected to the certification source page for certification',
'common.default': 'Default', 'common.default': 'Default',
'common.jump': 'Jump',
}; };

View File

@ -197,4 +197,5 @@ export default {
'common.advancedSettings': '高级设置', 'common.advancedSettings': '高级设置',
'common.auth_redirect_tip': '即将跳转至认证源页面进行认证', 'common.auth_redirect_tip': '即将跳转至认证源页面进行认证',
'common.default': '默认', 'common.default': '默认',
'common.jump': '跳转',
}; };

View File

@ -21,6 +21,7 @@ import { removeRouteListener } from '@/utils/route-listener';
import type { LoginData } from '@/models/user'; import type { LoginData } from '@/models/user';
import { LoginRes } from '@/models/user'; import { LoginRes } from '@/models/user';
import { ProjectManagementRouteEnum } from '@/enums/routeEnum';
import useAppStore from '../app'; import useAppStore from '../app';
import { UserState } from './types'; import { UserState } from './types';
@ -240,7 +241,9 @@ const useUserStore = defineStore('user', {
const { isLoginPage } = useUser(); const { isLoginPage } = useUser();
if (isLoginPage()) { if (isLoginPage()) {
// 当前页面为登录页面,且已经登录,跳转到首页 // 当前页面为登录页面,且已经登录,跳转到首页
const currentRouteName = getFirstRouteNameByPermission(router.getRoutes()); const currentRouteName = router.getRoutes()
? getFirstRouteNameByPermission(router.getRoutes())
: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_PERMISSION_BASIC_INFO;
router.push({ name: currentRouteName }); router.push({ name: currentRouteName });
} }
}, },
@ -305,7 +308,9 @@ const useUserStore = defineStore('user', {
} }
if (isLoginPage() && isLogin) { if (isLoginPage() && isLogin) {
// 当前页面为登录页面,且已经登录,跳转到首页 // 当前页面为登录页面,且已经登录,跳转到首页
const currentRouteName = getFirstRouteNameByPermission(router.getRoutes()); const currentRouteName = router.getRoutes()
? getFirstRouteNameByPermission(router.getRoutes())
: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_PERMISSION_BASIC_INFO;
router.push({ name: currentRouteName }); router.push({ name: currentRouteName });
} }
}, },

View File

@ -118,13 +118,12 @@
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useStorage } from '@vueuse/core'; import { useStorage } from '@vueuse/core';
import { Message, SelectOptionData } from '@arco-design/web-vue'; import { Message, SelectOptionData } from '@arco-design/web-vue';
import { partial } from 'lodash-es';
import TabQrCode from '@/views/login/components/tabQrCode.vue'; import TabQrCode from '@/views/login/components/tabQrCode.vue';
import { getProjectInfo } from '@/api/modules/project-management/basicInfo'; import { getProjectInfo } from '@/api/modules/project-management/basicInfo';
import { getAuthDetail, getAuthDetailByType } from '@/api/modules/setting/config'; import { getAuthDetailByType } from '@/api/modules/setting/config';
import { getPlatformParamUrl, isLogin as userIsLogin } from '@/api/modules/user'; import { getPlatformParamUrl } from '@/api/modules/user';
import { GetLoginLogoUrl } from '@/api/requrls/setting/config'; import { GetLoginLogoUrl } from '@/api/requrls/setting/config';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useLoading from '@/hooks/useLoading'; import useLoading from '@/hooks/useLoading';
@ -132,13 +131,12 @@
import { NO_PROJECT_ROUTE_NAME, NO_RESOURCE_ROUTE_NAME } from '@/router/constants'; import { NO_PROJECT_ROUTE_NAME, NO_RESOURCE_ROUTE_NAME } from '@/router/constants';
import { useAppStore, useUserStore } from '@/store'; import { useAppStore, useUserStore } from '@/store';
import useLicenseStore from '@/store/modules/setting/license'; import useLicenseStore from '@/store/modules/setting/license';
import { UserState } from '@/store/modules/user/types';
import { encrypted } from '@/utils'; import { encrypted } from '@/utils';
import { setLoginExpires, setToken } from '@/utils/auth'; import { setLoginExpires, setToken } from '@/utils/auth';
import { getFirstRouteNameByPermission, routerNameHasPermission } from '@/utils/permission'; import { getFirstRouteNameByPermission, routerNameHasPermission } from '@/utils/permission';
import type { LoginData } from '@/models/user'; import type { LoginData } from '@/models/user';
import { ProjectManagementRouteEnum, SettingRouteEnum } from '@/enums/routeEnum'; import { SettingRouteEnum } from '@/enums/routeEnum';
import { ValidatedError } from '@arco-design/web-vue/es/form/interface'; import { ValidatedError } from '@arco-design/web-vue/es/form/interface';
@ -320,13 +318,15 @@
const authId = res.id; const authId = res.id;
openModal({ openModal({
type: 'info', type: 'info',
content: t('common.auth_redirect_tip'), title: t('common.auth_redirect_tip'),
okText: t('common.confirm'), content: '',
okText: t('common.jump'),
cancelText: t('common.cancel'), cancelText: t('common.cancel'),
okButtonProps: { okButtonProps: {
status: 'normal', status: 'normal',
}, },
closable: false, mask: true,
maskStyle: { color: '#323233' },
onBeforeOk: async () => { onBeforeOk: async () => {
const config = JSON.parse(res.configuration); const config = JSON.parse(res.configuration);
// eslint-disable-next-line no-eval // eslint-disable-next-line no-eval

View File

@ -270,12 +270,12 @@
:rules="[{ required: true, message: t('system.config.auth.clientSecretRequired') }]" :rules="[{ required: true, message: t('system.config.auth.clientSecretRequired') }]"
required required
> >
<a-input <a-input-password
v-model:model-value="activeAuthForm.configuration.secret" v-model:model-value="activeAuthForm.configuration.secret"
:max-length="255" :max-length="255"
:placeholder="t('system.config.auth.clientSecretPlaceholder')" :placeholder="t('system.config.auth.clientSecretPlaceholder')"
allow-clear allow-clear
></a-input> ></a-input-password>
</a-form-item> </a-form-item>
<a-form-item <a-form-item
:label="t('system.config.auth.logoutSessionUrl')" :label="t('system.config.auth.logoutSessionUrl')"
@ -399,12 +399,12 @@
:rules="[{ required: true, message: t('system.config.auth.clientSecretRequired') }]" :rules="[{ required: true, message: t('system.config.auth.clientSecretRequired') }]"
required required
> >
<a-input <a-input-password
v-model:model-value="activeAuthForm.configuration.secret" v-model:model-value="activeAuthForm.configuration.secret"
:max-length="255" :max-length="255"
:placeholder="t('system.config.auth.clientSecretPlaceholder')" :placeholder="t('system.config.auth.clientSecretPlaceholder')"
allow-clear allow-clear
></a-input> ></a-input-password>
</a-form-item> </a-form-item>
<a-form-item <a-form-item
:label="t('system.config.auth.propertyMap')" :label="t('system.config.auth.propertyMap')"