diff --git a/apps/antd-view/src/apis/modules/user.ts b/apps/antd-view/src/apis/modules/user.ts index 3bf9d16af..c39090d1d 100644 --- a/apps/antd-view/src/apis/modules/user.ts +++ b/apps/antd-view/src/apis/modules/user.ts @@ -1,7 +1,7 @@ import type { UserApiType } from '@/apis/types'; import type { UserInfo } from '@vben/types'; -import { request } from '@/forward/request'; +import { request } from '@/forward'; /** * 登录 diff --git a/apps/antd-view/src/forward/index.ts b/apps/antd-view/src/forward/index.ts new file mode 100644 index 000000000..56e4b0555 --- /dev/null +++ b/apps/antd-view/src/forward/index.ts @@ -0,0 +1 @@ +export * from './request'; diff --git a/apps/antd-view/src/forward/request.ts b/apps/antd-view/src/forward/request/index.ts similarity index 100% rename from apps/antd-view/src/forward/request.ts rename to apps/antd-view/src/forward/request/index.ts diff --git a/apps/antd-view/src/views/_essential/authentication/login.vue b/apps/antd-view/src/views/_essential/authentication/login.vue index 2131a2fac..5f1531cda 100644 --- a/apps/antd-view/src/views/_essential/authentication/login.vue +++ b/apps/antd-view/src/views/_essential/authentication/login.vue @@ -67,5 +67,10 @@ const loginLoading = computed(() => { diff --git a/packages/business/common-ui/src/authentication/code-login.vue b/packages/business/common-ui/src/authentication/code-login.vue index 3125cea3f..837ff6c88 100644 --- a/packages/business/common-ui/src/authentication/code-login.vue +++ b/packages/business/common-ui/src/authentication/code-login.vue @@ -14,14 +14,19 @@ interface Props { * @zh_CN 是否处于加载处理状态 */ loading?: boolean; + /** + * @zh_CN 登陆路径 + */ + loginPath?: string; } defineOptions({ name: 'AuthenticationCodeLogin', }); -withDefaults(defineProps(), { +const props = withDefaults(defineProps(), { loading: false, + loginPath: '/auth/login', }); const emit = defineEmits<{ @@ -76,8 +81,8 @@ function handleSubmit() { }); } -function handleGo(path: string) { - router.push(path); +function goLogin() { + router.push(props.loginPath); } async function handleSendCode() { @@ -145,11 +150,7 @@ onBeforeUnmount(() => { {{ $t('common.login') }} - + {{ $t('common.back') }} diff --git a/packages/business/common-ui/src/authentication/forget-password.vue b/packages/business/common-ui/src/authentication/forget-password.vue index 04ee4c2b2..1832cd503 100644 --- a/packages/business/common-ui/src/authentication/forget-password.vue +++ b/packages/business/common-ui/src/authentication/forget-password.vue @@ -12,14 +12,19 @@ interface Props { * @zh_CN 是否处于加载处理状态 */ loading?: boolean; + /** + * @zh_CN 登陆路径 + */ + loginPath?: string; } defineOptions({ name: 'AuthenticationForgetPassword', }); -withDefaults(defineProps(), { +const props = withDefaults(defineProps(), { loading: false, + loginPath: '/auth/login', }); const emit = defineEmits<{ @@ -44,8 +49,8 @@ function handleSubmut() { emit('submit', formState.email); } -function handleGo(path: string) { - router.push(path); +function goLogin() { + router.push(props.loginPath); } @@ -73,11 +78,7 @@ function handleGo(path: string) { {{ $t('authentication.send-reset-link') }} - + {{ $t('common.back') }} diff --git a/packages/business/common-ui/src/authentication/index.ts b/packages/business/common-ui/src/authentication/index.ts index 1cd9f1864..3b9a9230e 100644 --- a/packages/business/common-ui/src/authentication/index.ts +++ b/packages/business/common-ui/src/authentication/index.ts @@ -1,8 +1,8 @@ export { default as AuthenticationCodeLogin } from './code-login.vue'; -export { default as AuthenticationColorToggle } from './color-toggle.vue'; export { default as AuthenticationForgetPassword } from './forget-password.vue'; -export { default as AuthenticationLayoutToggle } from './layout-toggle.vue'; export { default as AuthenticationLogin } from './login.vue'; export { default as AuthenticationQrCodeLogin } from './qrcode-login.vue'; export { default as AuthenticationRegister } from './register.vue'; export type { LoginAndRegisterParams, LoginCodeParams } from './typings'; +export { default as AuthenticationColorToggle } from './widgets/color-toggle.vue'; +export { default as AuthenticationLayoutToggle } from './widgets/layout-toggle.vue'; diff --git a/packages/business/common-ui/src/authentication/login.vue b/packages/business/common-ui/src/authentication/login.vue index c9ae74ebb..342aabb16 100644 --- a/packages/business/common-ui/src/authentication/login.vue +++ b/packages/business/common-ui/src/authentication/login.vue @@ -16,10 +16,65 @@ import ThirdPartyLogin from './third-party-login.vue'; import type { LoginEmits } from './typings'; interface Props { + /** + * @zh_CN 验证码登录路径 + */ + codeLoginPath?: string; + + /** + * @zh_CN 忘记密码路径 + */ + forgetPasswordPath?: string; + /** * @zh_CN 是否处于加载处理状态 */ loading?: boolean; + + /** + * @zh_CN 密码占位符 + */ + passwordPlaceholder?: string; + + /** + * @zh_CN 二维码登录路径 + */ + qrCodeLoginPath?: string; + + /** + * @zh_CN 注册路径 + */ + registerPath?: string; + + /** + * @zh_CN 是否显示验证码登录 + */ + showCodeLogin?: boolean; + + /** + * @zh_CN 是否显示忘记密码 + */ + showForgetPassword?: boolean; + + /** + * @zh_CN 是否显示二维码登录 + */ + showQrcodeLogin?: boolean; + + /** + * @zh_CN 是否显示注册按钮 + */ + showRegister?: boolean; + + /** + * @zh_CN 是否显示第三方登录 + */ + showThirdPartyLogin?: boolean; + + /** + * @zh_CN 用户名占位符 + */ + usernamePlaceholder?: string; } defineOptions({ @@ -27,7 +82,18 @@ defineOptions({ }); withDefaults(defineProps(), { + codeLoginPath: '/auth/code-login', + forgetPasswordPath: '/auth/forget-password', loading: false, + passwordPlaceholder: '', + qrCodeLoginPath: '/auth/qrcode-login', + registerPath: '/auth/register', + showCodeLogin: true, + showForgetPassword: true, + showQrcodeLogin: true, + showRegister: true, + showThirdPartyLogin: true, + usernamePlaceholder: '', }); const emit = defineEmits<{ @@ -39,6 +105,7 @@ const router = useRouter(); const REMEMBER_ME_KEY = 'REMEMBER_ME_USERNAME'; const localUsername = localStorage.getItem(REMEMBER_ME_KEY) || ''; + const formState = reactive({ password: '', rememberMe: !!localUsername, @@ -81,7 +148,7 @@ function handleGo(path: string) {