新增注册功能
This commit is contained in:
parent
5ce48fcdd2
commit
4d769a8dfb
@ -22,6 +22,17 @@ export function getUserInfo() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 用户注册
|
||||
*/
|
||||
export function register(params) {
|
||||
return http.request({
|
||||
url: `/register`,
|
||||
method: 'POST',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 用户登录
|
||||
*/
|
||||
|
@ -107,7 +107,7 @@
|
||||
// 动态加载滑块验证码组件
|
||||
|
||||
/**
|
||||
* 定义表单参数
|
||||
* 定义表单接口
|
||||
*/
|
||||
interface FormState {
|
||||
username: string;
|
||||
|
@ -96,6 +96,8 @@
|
||||
import { rule } from '@/utils/validate';
|
||||
import { PersonOutline } from '@vicons/ionicons5';
|
||||
import { SafetyCertificateOutlined } from '@vicons/antd';
|
||||
import { ResultEnum } from '@/enums/httpEnum';
|
||||
import { register } from '@/api/system/user';
|
||||
|
||||
/**
|
||||
* 定义参数
|
||||
@ -106,6 +108,18 @@
|
||||
const isGetCode = ref(false);
|
||||
const emit = defineEmits(['backLogin']);
|
||||
|
||||
// /**
|
||||
// * 定义表单接口
|
||||
// */
|
||||
// interface FormState {
|
||||
// username: string;
|
||||
// password: string;
|
||||
// retPassword: string;
|
||||
// mobile: string;
|
||||
// code: string;
|
||||
// agreement: boolean;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 定义表单参数
|
||||
*/
|
||||
@ -146,7 +160,22 @@
|
||||
loading.value = true;
|
||||
formRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
backLogin();
|
||||
// 定义表单数据
|
||||
const params = {
|
||||
username: formInline.username,
|
||||
password: formInline.password,
|
||||
retPassword: formInline.retPassword,
|
||||
mobile: formInline.mobile,
|
||||
code: formInline.code,
|
||||
agreement: formInline.agreement,
|
||||
};
|
||||
const { code, msg } = await register(params);
|
||||
if (code == ResultEnum.SUCCESS) {
|
||||
ElMessage.success('注册成功,请登录');
|
||||
backLogin();
|
||||
} else {
|
||||
ElMessage.error(msg || '登录失败');
|
||||
}
|
||||
loading.value = false;
|
||||
} else {
|
||||
loading.value = false;
|
||||
|
Loading…
Reference in New Issue
Block a user