|
|
@@ -2,7 +2,7 @@
|
|
|
<div class="page-container login-container">
|
|
|
<el-card class="login-card">
|
|
|
<h2 class="login-card__title login-card__item">注 册</h2>
|
|
|
- <el-input ref="name" v-model="name" placeholder="请输入昵称, 长度为1-10个字符" maxlength="10" class="login-card__item" oninput="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\ ]/g,'')" autofocus></el-input>
|
|
|
+ <el-input ref="name" v-model="name" placeholder="请输入昵称, 长度为1-10个字符" maxlength="10" class="login-card__item" compositionend="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\ ]/g,'')" autofocus></el-input>
|
|
|
<el-input ref="password" v-model="password" type="password" placeholder="请输入密码, 长度为6-20个字符" maxlength="20" class="login-card__item"></el-input>
|
|
|
<el-input ref="passwordConfirm" v-model="passwordConfirm" type="password" placeholder="请再次输入密码" maxlength="20" class="login-card__item"></el-input>
|
|
|
<el-input ref="email" v-model="email" placeholder="请输入邮箱" maxlength="320" class="login-card__item" autofocus></el-input>
|
|
|
@@ -94,6 +94,15 @@
|
|
|
this.$refs.name.focus();
|
|
|
return false;
|
|
|
}
|
|
|
+ if(this.name.length > 10){
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '昵称过长',
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ this.$refs.name.focus();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
if(this.password.length < 6){
|
|
|
if(this.password.length === 0){
|
|
|
@@ -112,6 +121,15 @@
|
|
|
this.$refs.password.focus();
|
|
|
return false;
|
|
|
}
|
|
|
+ if(this.password.length > 10){
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '密码过长',
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ this.$refs.password.focus();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
if(this.passwordConfirm !== this.password){
|
|
|
this.$message({
|
|
|
@@ -132,6 +150,15 @@
|
|
|
this.$refs.email.focus();
|
|
|
return false;
|
|
|
}
|
|
|
+ if(this.email.length > 255){
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '邮箱过长',
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ this.$refs.email.focus();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
const myReg=/^[a-zA-Z0-9_-]+@([a-zA-Z0-9]+\.)+(com|cn|net|org)$/;
|
|
|
|
|
|
@@ -141,10 +168,11 @@
|
|
|
message: '邮箱格式有误',
|
|
|
type: 'error'
|
|
|
});
|
|
|
+ this.$refs.email.focus();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if(this.phone.length < 11){
|
|
|
+ if(this.phone.length !== 11){
|
|
|
if(this.phone.length === 0){
|
|
|
this.$message({
|
|
|
showClose: true,
|
|
|
@@ -172,6 +200,15 @@
|
|
|
this.$refs.identifyCode.focus();
|
|
|
return false;
|
|
|
}
|
|
|
+ if(this.identifyCode.length !== 4){
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '验证码长度错误',
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ this.$refs.identifyCode.focus();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
return true;
|
|
|
|