ruoyi-plus-vben5/apps/web-antd/src/views/_essential/authentication/login.vue

39 lines
958 B
Vue
Raw Normal View History

2024-05-19 21:20:42 +08:00
<script lang="ts" setup>
import type { LoginAndRegisterParams } from '@vben/universal-ui';
2024-05-19 21:20:42 +08:00
import { AuthenticationLogin } from '@vben/universal-ui';
2024-06-01 23:15:29 +08:00
2024-06-22 00:25:13 +08:00
import { App } from 'ant-design-vue';
2024-05-19 21:20:42 +08:00
import { $t } from '#/locales';
import { useAccessStore } from '#/store';
2024-06-16 23:40:52 +08:00
2024-05-19 21:20:42 +08:00
defineOptions({ name: 'Login' });
const accessStore = useAccessStore();
2024-06-22 00:25:13 +08:00
const { notification } = App.useApp();
2024-05-19 21:20:42 +08:00
/**
* @param params 登录表单数据
2024-05-19 21:20:42 +08:00
*/
async function handleLogin(params: LoginAndRegisterParams) {
const { userInfo } = await accessStore.authLogin(params);
if (userInfo?.realName) {
2024-05-19 21:20:42 +08:00
notification.success({
description: `${$t('authentication.login-success-desc')}:${userInfo?.realName}`,
2024-05-19 21:20:42 +08:00
duration: 3,
message: $t('authentication.login-success'),
});
}
}
</script>
<template>
<AuthenticationLogin
:loading="accessStore.loading"
2024-06-09 13:31:43 +08:00
password-placeholder="123456"
username-placeholder="vben"
@submit="handleLogin"
/>
2024-05-19 21:20:42 +08:00
</template>