This commit is contained in:
hanchaobo
2024-02-20 17:20:48 +08:00
parent 58b1d23738
commit cfcdd5c92b
10 changed files with 350 additions and 61 deletions
+71 -10
View File
@@ -29,6 +29,39 @@
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="identityNo">
<el-input v-model="registerForm.identityNo" type="text" auto-complete="off" placeholder="身份证号码">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="email">
<el-input v-model="registerForm.email" type="text" auto-complete="off" placeholder="邮箱">
<svg-icon slot="prefix" icon-class="email" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="name">
<el-input v-model="registerForm.name" type="text" auto-complete="off" placeholder="用户名">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="phone">
<el-input
v-model="registerForm.phone"
auto-complete="off"
placeholder="手机号"
style="width: 63%"
>
<svg-icon slot="prefix" icon-class="phone" class="el-input__icon input-icon" />
</el-input>
<div class="register-code">
<el-button type="primary" :disabled="codeDisabled" @click="getCodeNumber(registerForm.phone)">{{codeText}}</el-button>
</div>
</el-form-item>
<el-form-item prop="verifyCode">
<el-input v-model="registerForm.verifyCode" type="text" auto-complete="off" placeholder="手机验证码">
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnabled">
<el-input
v-model="registerForm.code"
@@ -67,7 +100,7 @@
</template>
<script>
import { getCodeImg, register } from "@/api/login";
import { getCodeImg, register, sendCode, wxregister } from "@/api/login";
export default {
name: "Register",
@@ -80,13 +113,16 @@ export default {
}
};
return {
codeText: "发送验证码",
codeDisabled:false,
codeUrl: "",
registerForm: {
username: "",
password: "",
phone:"",
confirmPassword: "",
code: "",
uuid: ""
uuid: "",
},
registerRules: {
username: [
@@ -124,7 +160,7 @@ export default {
this.$refs.registerForm.validate(valid => {
if (valid) {
this.loading = true;
register(this.registerForm).then(res => {
wxregister(this.registerForm).then(res => {
const username = this.registerForm.username;
this.$alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", '系统提示', {
dangerouslyUseHTMLString: true,
@@ -140,7 +176,31 @@ export default {
})
}
});
}
},
getCodeNumber(data) {
sendCode({
phone: data
}).then(res => {
if (res.code != 200) {
this.$modal.msgError(res.msg);
return
} else {
this.$modal.msgSuccess('发送成功');
let time = 60;
let timer = setInterval(() => {
time--;
this.codeDisabled = true;
this.codeText = time + 's重试'
if (time == 0) {
clearInterval(timer)
this.codeText = '发送验证码'
this.codeDisabled = false;
}
}, 1000)
}
})
},
}
};
</script>
@@ -164,13 +224,14 @@ export default {
border-radius: 6px;
background: #ffffff;
width: 400px;
height: 90%;
padding: 25px 25px 5px 25px;
.el-input {
height: 38px;
input {
height: 38px;
}
}
// .el-input {
// height: 38px;
// input {
// height: 38px;
// }
// }
.input-icon {
height: 39px;
width: 14px;