diff --git a/src/api/auth/index.ts b/src/api/auth/index.ts index 4177edb..bcfaaf7 100644 --- a/src/api/auth/index.ts +++ b/src/api/auth/index.ts @@ -1,4 +1,10 @@ -import type { LoginDTO, LoginVO } from './types'; +import type { EmailCodeDTO, LoginDTO, LoginVO, RegisterDTO } from './types'; import { post } from '@/utils/request'; export const login = (data: LoginDTO) => post('/auth/login', data); + +// 邮箱验证码 +export const emailCode = (data: EmailCodeDTO) => post('/resource/email/code', data); + +// 注册账号 +export const register = (data: RegisterDTO) => post('/auth/register', data); diff --git a/src/api/auth/types.ts b/src/api/auth/types.ts index a5e6035..645ee46 100644 --- a/src/api/auth/types.ts +++ b/src/api/auth/types.ts @@ -1,6 +1,9 @@ export interface LoginDTO { username: string; password: string; + code?: string; + // 二次确认密码 + confirmPassword?: string; } export interface LoginVO { @@ -116,3 +119,28 @@ export interface RoleDTO { */ roleName?: string; } + +// 邮箱验证码 +export interface EmailCodeDTO { + username?: string; +} + +// 邮箱注册 +export interface RegisterDTO { + /** + * 邮箱 + */ + username: string; + /** + * 密码 + */ + password: string; + /** + * 验证码 + */ + code: string; + /** + * 确认密码 + */ + confirmPassword?: string; +} diff --git a/src/components/LoginDialog/components/FormLogin/AccountPassword.vue b/src/components/LoginDialog/components/FormLogin/AccountPassword.vue index fb90185..5e21884 100644 --- a/src/components/LoginDialog/components/FormLogin/AccountPassword.vue +++ b/src/components/LoginDialog/components/FormLogin/AccountPassword.vue @@ -6,10 +6,12 @@ import { reactive, ref } from 'vue'; import { useRouter } from 'vue-router'; import { login } from '@/api'; import { useUserStore } from '@/stores'; +import { useLoginFromStore } from '@/stores/modules/loginFrom'; import { useSessionStore } from '@/stores/modules/session'; const userStore = useUserStore(); const sessionStore = useSessionStore(); +const loginFromStore = useLoginFromStore(); const formRef = ref(); @@ -45,9 +47,15 @@ async function handleSubmit() {