login.vue 958 B

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