59 lines
1.8 KiB
JavaScript
59 lines
1.8 KiB
JavaScript
class Reg {
|
||
constructor() {
|
||
this.showPassword();
|
||
this.phone = document.querySelector(".userphone");
|
||
this.pass = document.querySelector(".showpas input");
|
||
this.UserReg()
|
||
}
|
||
|
||
showPassword() {
|
||
var showPassword = document.querySelector(".showPassword");
|
||
|
||
showPassword.onclick = () => {
|
||
if (showPassword.classList.contains("icon-eye1")) {
|
||
showPassword.classList.remove("icon-eye1")
|
||
showPassword.classList.add("icon-eye")
|
||
this.pass.type = "text"
|
||
} else {
|
||
this.pass.type = "password"
|
||
showPassword.classList.remove("icon-eye")
|
||
showPassword.classList.add("icon-eye1")
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
UserReg() {
|
||
document.querySelector(".reg_input button").onclick = async () => {
|
||
if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.phone.value)) {
|
||
Tips.toast("手机号格式不正确",2000)
|
||
return;
|
||
}
|
||
|
||
if (this.pass.value.length == 0) {
|
||
Tips.toast("密码不能为空",2000)
|
||
return;
|
||
}
|
||
|
||
let res = await homeService.search({
|
||
userphone: this.phone.value,
|
||
userpwd: this.pass.value,
|
||
superior: utils.GetQueryString("objectId") == null
|
||
? ''
|
||
: utils.GetQueryString("objectId")
|
||
});
|
||
|
||
Tips.dialog({
|
||
title: '温馨提示',
|
||
message: '注册成功,点击确定跳转至App下载页面,请安装App',
|
||
cancelText: '取消',
|
||
confirmText: '确定',
|
||
confirm: ()=> {
|
||
location.href = "../share/index.html";
|
||
}
|
||
})
|
||
}
|
||
|
||
}
|
||
}
|
||
new Reg() |