|
|
@@ -66,7 +66,8 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { registerCheck,registerOn } from "@/api/register"; |
|
|
|
import { registerCheck } from "@/api/register"; |
|
|
|
import { getSmsCode } from "@/api/login"; |
|
|
|
export default { |
|
|
|
name: "register", |
|
|
|
data() { |
|
|
@@ -74,9 +75,9 @@ export default { |
|
|
|
formData: { |
|
|
|
memberName: '张月旺', //姓名 |
|
|
|
idcard: '14022619700803051X', //身份证号码 |
|
|
|
// uuid: null, //识别uuid |
|
|
|
uuid: null, //识别uuid |
|
|
|
mobile: '15254587248', //手机号 |
|
|
|
// smsCode: null, //短信验证码 |
|
|
|
smsCode: null, //短信验证码 |
|
|
|
}, |
|
|
|
loading: false, |
|
|
|
computeTime: 0, |
|
|
@@ -86,36 +87,43 @@ export default { |
|
|
|
handleRegister(){ |
|
|
|
if(this.checkFun()){ |
|
|
|
let oData = this.formData; |
|
|
|
if(oData.smsCode==''){ |
|
|
|
if(oData.smsCode==''){ |
|
|
|
this.$dialog.alert({ |
|
|
|
message: '请输入短信验证码', |
|
|
|
}); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
registerOn(this.formData).then((res) => { |
|
|
|
console.log(res) |
|
|
|
this.$store |
|
|
|
.dispatch("Register", this.formData) |
|
|
|
.then(() => { |
|
|
|
this.$router.push({ path: this.redirect || "/" }).catch(() => {}); |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.catch(() => { |
|
|
|
this.loading = false; |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
getSmsCode() { |
|
|
|
if (!this.computeTime) { |
|
|
|
if(this.checkFun()){ |
|
|
|
registerCheck(this.formData).then((res) => { |
|
|
|
let oData = this.formData; |
|
|
|
registerCheck(oData.memberName,oData.idcard,oData.mobile).then((res) => { |
|
|
|
if (res.code === 200) { |
|
|
|
this.$dialog.alert({ |
|
|
|
message: '验证码已发送', |
|
|
|
getSmsCode(this.formData.mobile).then((res) => { |
|
|
|
if (res.code === 200) { |
|
|
|
this.$dialog.alert({ |
|
|
|
message: '验证码已发送', |
|
|
|
}); |
|
|
|
this.loginForm.uuid = res.uuid; |
|
|
|
this.computeTime = 60; |
|
|
|
this.timer = setInterval(() => { |
|
|
|
this.computeTime--; |
|
|
|
if (this.computeTime <= 0) { |
|
|
|
clearInterval(this.timer); |
|
|
|
} |
|
|
|
}, 1000); |
|
|
|
} |
|
|
|
}); |
|
|
|
this.loginForm.uuid = res.uuid; |
|
|
|
this.computeTime = 60; |
|
|
|
this.timer = setInterval(() => { |
|
|
|
this.computeTime--; |
|
|
|
if (this.computeTime <= 0) { |
|
|
|
clearInterval(this.timer); |
|
|
|
} |
|
|
|
}, 1000); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
@@ -126,7 +134,6 @@ export default { |
|
|
|
let memberName_Regexp=/^[\u4e00-\u9fa5]{1,6}(·[\u4e00-\u9fa5]{1,6}){0,2}$/; //校验姓名 |
|
|
|
let idcard_Regexp = /^[1-9][0-9]{5}([1][9][0-9]{2}|[2][0][0|1][0-9])([0][1-9]|[1][0|1|2])([0][1-9]|[1|2][0-9]|[3][0|1])[0-9]{3}([0-9]|[X])$/; //身份证 |
|
|
|
let mobile_Regexp=/^1[3|4|5|7|8]\d{9}$/; |
|
|
|
console.log(oData.mobile) |
|
|
|
if (!memberName_Regexp.test(oData.memberName)) { |
|
|
|
this.$dialog.alert({ |
|
|
|
message: '姓名格式不正确', |
|
|
|