新增注册功能
This commit is contained in:
parent
083cb40169
commit
59c5329d26
@ -12,7 +12,7 @@ VITE_DROP_CONSOLE = true
|
||||
|
||||
# 跨域代理,可以配置多个,请注意不要换行
|
||||
#VITE_PROXY = [["/appApi","http://localhost:8001"],["/upload","http://localhost:8001/upload"]]
|
||||
VITE_PROXY=[["/api","http://192.168.124.203:8081/api"]]
|
||||
VITE_PROXY=[["/api","http://127.0.0.1:8081/api"]]
|
||||
|
||||
# API 接口地址
|
||||
VITE_GLOB_API_URL =
|
||||
|
@ -4,12 +4,12 @@
|
||||
:show-label="false"
|
||||
:show-require-mark="false"
|
||||
size="large"
|
||||
:model="formInline"
|
||||
:model="formData"
|
||||
:rules="rules"
|
||||
class="register-form"
|
||||
>
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="formInline.username" placeholder="请输入用户名">
|
||||
<el-input v-model="formData.username" placeholder="请输入用户名">
|
||||
<template #prefix>
|
||||
<el-icon class="el-input__icon" size="18" color="#808695">
|
||||
<PersonOutline />
|
||||
@ -18,7 +18,7 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="mobile">
|
||||
<el-input v-model="formInline.mobile" placeholder="请输入手机号码">
|
||||
<el-input v-model="formData.mobile" placeholder="请输入手机号码">
|
||||
<template #prefix>
|
||||
<el-icon class="el-input__icon" size="18" color="#808695">
|
||||
<Iphone />
|
||||
@ -27,7 +27,7 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="code">
|
||||
<el-input v-model.trim="formInline.code" placeholder="验证码">
|
||||
<el-input v-model.trim="formData.code" placeholder="验证码">
|
||||
<template #prefix>
|
||||
<el-icon class="el-input__icon" size="18" color="#808695">
|
||||
<SafetyCertificateOutlined />
|
||||
@ -41,12 +41,7 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
v-model="formInline.password"
|
||||
type="password"
|
||||
show-password
|
||||
placeholder="请输入密码"
|
||||
>
|
||||
<el-input v-model="formData.password" type="password" show-password placeholder="请输入密码">
|
||||
<template #prefix>
|
||||
<el-icon class="el-input__icon" size="18" color="#808695">
|
||||
<Lock />
|
||||
@ -56,7 +51,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item prop="retPassword">
|
||||
<el-input
|
||||
v-model="formInline.retPassword"
|
||||
v-model="formData.retPassword"
|
||||
type="password"
|
||||
show-password
|
||||
placeholder="请再次输入密码"
|
||||
@ -83,7 +78,7 @@
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex-initial">
|
||||
<el-form-item prop="agreement">
|
||||
<el-checkbox v-model="formInline.agreement">我同意隐私协议</el-checkbox>
|
||||
<el-checkbox v-model="formData.agreement">我同意隐私协议</el-checkbox>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
@ -108,22 +103,10 @@
|
||||
const isGetCode = ref(false);
|
||||
const emit = defineEmits(['backLogin']);
|
||||
|
||||
// /**
|
||||
// * 定义表单接口
|
||||
// */
|
||||
// interface FormState {
|
||||
// username: string;
|
||||
// password: string;
|
||||
// retPassword: string;
|
||||
// mobile: string;
|
||||
// code: string;
|
||||
// agreement: boolean;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 定义表单参数
|
||||
*/
|
||||
const formInline = reactive({
|
||||
const formData = reactive({
|
||||
username: '',
|
||||
password: '',
|
||||
retPassword: '',
|
||||
@ -160,16 +143,7 @@
|
||||
loading.value = true;
|
||||
formRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
// 定义表单数据
|
||||
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);
|
||||
const { code, msg } = await register(formData);
|
||||
if (code == ResultEnum.SUCCESS) {
|
||||
ElMessage.success('注册成功,请登录');
|
||||
backLogin();
|
||||
@ -198,7 +172,7 @@
|
||||
* 获取验证码
|
||||
*/
|
||||
function getCode() {
|
||||
if (!formInline.mobile) {
|
||||
if (!formData.mobile) {
|
||||
formRef.value.validateField('mobile');
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user