|
|
@@ -78,13 +78,23 @@ |
|
|
|
:rules="[{ required: true, message: '请输入身份证号' }]" |
|
|
|
/> |
|
|
|
<van-field |
|
|
|
v-model="formData.password" |
|
|
|
type="password" |
|
|
|
name="请输入密码" |
|
|
|
v-model="formData.mobile" |
|
|
|
name="请输入手机号" |
|
|
|
style="margin-top: 20px" |
|
|
|
placeholder="请输入手机号" |
|
|
|
:rules="[{ required: true, message: '请填写手机号' }]" |
|
|
|
/> |
|
|
|
<van-field |
|
|
|
v-model="formData.code" |
|
|
|
center |
|
|
|
clearable |
|
|
|
label="验证码" |
|
|
|
placeholder="图形验证码" |
|
|
|
> |
|
|
|
<template #button> |
|
|
|
<img style="width: 100px" :src="codeUrl" @click="getCode" /> |
|
|
|
</template> |
|
|
|
</van-field> |
|
|
|
<van-field |
|
|
|
v-model="formData.smsCode" |
|
|
|
name="请输入验证码" |
|
|
@@ -93,11 +103,16 @@ |
|
|
|
:rules="[{ required: true, message: '请填写验证码' }]" |
|
|
|
> |
|
|
|
<template #button> |
|
|
|
<van-button size="mini" type="info" >获取验证码</van-button> |
|
|
|
<!-- <van-button size="mini" type="info" @click="getRegisterSmsCode" >获取验证码</van-button> --> |
|
|
|
<div class="registerSmsBtn" @click="getRegisterSmsCode">{{ |
|
|
|
computeTime > 0 ? `(${computeTime}s)已发送` : "获取短信码" |
|
|
|
}}</div> |
|
|
|
|
|
|
|
|
|
|
|
</template> |
|
|
|
</van-field> |
|
|
|
<div style="margin: 50px 16px 16px;"> |
|
|
|
<van-button block type="info" native-type="submit">注册</van-button> |
|
|
|
<van-button block type="info" native-type="submit" @click="registerSubmit">注册</van-button> |
|
|
|
</div> |
|
|
|
</van-form> |
|
|
|
</van-tab> |
|
|
@@ -172,9 +187,14 @@ |
|
|
|
margin: 0 10px; |
|
|
|
border-bottom: 3px solid black; |
|
|
|
} |
|
|
|
.registerSmsBtn{ |
|
|
|
color: rgb(29, 111, 233); |
|
|
|
font-size: 0.34rem; |
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|
<script> |
|
|
|
import { getCodeImg, getSmsCode } from "../api/login"; |
|
|
|
import { getCodeImg, getSmsCode ,getRegisterSmsCode,registerCheck,registerOn} from "../api/login"; |
|
|
|
import Cookies from "js-cookie"; |
|
|
|
//引用wx sdk |
|
|
|
import wx from "weixin-js-sdk"; |
|
|
@@ -188,12 +208,12 @@ export default { |
|
|
|
formData: { |
|
|
|
username: "", //账号 |
|
|
|
password: "", //密码 |
|
|
|
// username:'', |
|
|
|
// password:'', |
|
|
|
code: null, //图片验证码 |
|
|
|
uuid: null, //识别uuid |
|
|
|
mobile: null, //手机号 |
|
|
|
smsCode: null, //短信验证码 |
|
|
|
memberName:null, //身份信息 |
|
|
|
idcard:null, //身份号码 |
|
|
|
}, |
|
|
|
loading: false, |
|
|
|
codeUrl: "", //验证码 |
|
|
@@ -205,7 +225,6 @@ export default { |
|
|
|
created() { |
|
|
|
this.getCode(); |
|
|
|
this.reset(); |
|
|
|
console.log(this.height) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
reset(){ |
|
|
@@ -310,6 +329,92 @@ export default { |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
getRegisterSmsCode(){ |
|
|
|
if (!this.computeTime) { |
|
|
|
let myreg = /^[1][3,4,5,7,8,9][0-9]{9}$/; |
|
|
|
if (!myreg.test(this.formData.mobile)) { |
|
|
|
this.$dialog.alert({ |
|
|
|
message: '手机号格式不正确', |
|
|
|
}); |
|
|
|
return false; |
|
|
|
}else if (this.formData.code == "") { |
|
|
|
this.$dialog.alert({ |
|
|
|
message: '图片验证码不能为空', |
|
|
|
}); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (this.active==2) { |
|
|
|
let formObj = { |
|
|
|
code :this.formData.code, |
|
|
|
mobile:this.formData.mobile, |
|
|
|
uuid:this.formData.uuid |
|
|
|
} |
|
|
|
getRegisterSmsCode(formObj).then((res) => { |
|
|
|
console.log(res) |
|
|
|
console.log(res.code == 200) |
|
|
|
if(res.code == 200) { |
|
|
|
this.$dialog.alert({ |
|
|
|
message: '验证码已发送', |
|
|
|
}); |
|
|
|
this.formData.uuid = res.uuid; |
|
|
|
this.computeTime = 60; |
|
|
|
this.timer = setInterval(() => { |
|
|
|
this.computeTime--; |
|
|
|
if (this.computeTime <= 0) { |
|
|
|
clearInterval(this.timer); |
|
|
|
} |
|
|
|
}, 1000); |
|
|
|
} |
|
|
|
}).catch((res)=>{ |
|
|
|
if(res=='Error: 验证码已失效'){ |
|
|
|
this.getCode() |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
registerSubmit(){ |
|
|
|
|
|
|
|
//注册 |
|
|
|
if (this.formData.memberName == "") { |
|
|
|
this.$dialog.alert({ |
|
|
|
message: '姓名不能为空', |
|
|
|
}); |
|
|
|
return false; |
|
|
|
} else if (this.formData.idcard == "") { |
|
|
|
this.$dialog.alert({ |
|
|
|
message: '身份证号不能为空', |
|
|
|
}); |
|
|
|
return false; |
|
|
|
} else if (this.formData.mobile == "") { |
|
|
|
this.$dialog.alert({ |
|
|
|
message: '手机号码不能为空', |
|
|
|
}); |
|
|
|
return false; |
|
|
|
}else if (this.formData.smsCode == "") { |
|
|
|
this.$dialog.alert({ |
|
|
|
message: '短信验证码不能为空', |
|
|
|
}); |
|
|
|
return false; |
|
|
|
} |
|
|
|
//registerCheck,registerOn |
|
|
|
console.log(this.formData) |
|
|
|
registerCheck(this.formData).then((res)=>{ |
|
|
|
if(res.code == 200){ |
|
|
|
registerOn(this.formData).then((res)=>{ |
|
|
|
if(res.code == 200){ |
|
|
|
// |
|
|
|
this.$dialog.alert({ |
|
|
|
message: '您的初始密码:'+res.password, |
|
|
|
}).then(() => { |
|
|
|
this.$router.push({ path: "/onlineHome/workbench" }).catch(() => {}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |