login.vue
962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<script lang="ts" setup>
import type { LoginAndRegisterParams } from '@vben/universal-ui';
import { $t } from '@vben/locales';
import { AuthenticationLogin } from '@vben/universal-ui';
import { App } from 'ant-design-vue';
import { useAccessStore } from '#/store';
defineOptions({ name: 'Login' });
const accessStore = useAccessStore();
const { notification } = App.useApp();
/**
* @param params 登录表单数据
*/
async function handleLogin(params: LoginAndRegisterParams) {
const { userInfo } = await accessStore.authLogin(params);
if (userInfo?.realName) {
notification.success({
description: `${$t('authentication.login-success-desc')}:${userInfo?.realName}`,
duration: 3,
message: $t('authentication.login-success'),
});
}
}
</script>
<template>
<AuthenticationLogin
:loading="accessStore.loading"
password-placeholder="123456"
username-placeholder="vben"
@submit="handleLogin"
/>
</template>