|
@ -26,7 +26,7 @@
|
|
|
<input class="form-control idCardType" type="text" maxlength="18" placeholder="请输入身份证号码" v-model="IDCard" id="IDCard">\
|
|
|
</div>\
|
|
|
<div class="form-group">\
|
|
|
<input class="form-control" placeholder="请输入手机号码" v-model="phone" type="text" length="11">\
|
|
|
<input class="form-control" placeholder="请输入手机号码" v-model="phone" type="text" maxlength="11">\
|
|
|
</div>\
|
|
|
<div class="form-group">\
|
|
|
<input class="form-control" placeholder="请确认验证码" v-model="captcha">\
|
|
@ -40,7 +40,7 @@
|
|
|
<input class="form-control form-password" type="password" placeholder="请再次输入登录密码" v-model="rePassword" min-length="6" max-length="16">\
|
|
|
<span class="type-change-icon" @click="changePwdType(event)"></span>\
|
|
|
</div>\
|
|
|
<p class="c-909090" style="margin-top:-10px;">密码格式为6-16位,不允许有空格</p>\
|
|
|
<p class="c-909090" style="margin-top:-10px;">密码格式为8-16位,不允许有空格</p>\
|
|
|
<div class="checkbox">\
|
|
|
<label><input type="checkbox" v-model="toggle"> 阅读并接受<a href="#" target="_blank">《健康之路用户协议》</a>及<a href="#" target="_blank">《健康之路隐私保护声明》</a></label>\
|
|
|
</div>\
|
|
@ -72,27 +72,36 @@
|
|
|
methods: {
|
|
|
register: function() {
|
|
|
var vm = this
|
|
|
var regTrim =/\s/;
|
|
|
if(!isCardNo(vm.IDCard)) {
|
|
|
return false;
|
|
|
}
|
|
|
if(!vm.phone) {
|
|
|
console.log("手机号码不能为空!");
|
|
|
toastr.error("手机号码不能为空!");
|
|
|
return false;
|
|
|
}
|
|
|
if(!vm.captcha) {
|
|
|
console.log("验证码不能为空!");
|
|
|
toastr.error("验证码不能为空!");
|
|
|
return false;
|
|
|
}
|
|
|
if(!vm.password) {
|
|
|
console.log("登录密码不能为空!");
|
|
|
toastr.error("登录密码不能为空!");
|
|
|
return false;
|
|
|
}
|
|
|
if(vm.password.length<8||vm.password.length>16) {
|
|
|
toastr.error("密码必须是8-16位!");
|
|
|
return false;
|
|
|
}
|
|
|
if(regTrim.test(vm.password)){
|
|
|
toastr.error("密码中不能含有空格!");
|
|
|
return false;
|
|
|
}
|
|
|
if(vm.password!==vm.rePassword) {
|
|
|
console.log("两次密码输入不一致!");
|
|
|
toastr.error("两次密码输入不一致!");
|
|
|
return false;
|
|
|
}
|
|
|
if(!vm.toggle) {
|
|
|
console.log("未确认是否阅读并接受条款");
|
|
|
toastr.error("未确认是否阅读并接受条款");
|
|
|
return false;
|
|
|
}
|
|
|
//连接注册后台接口
|
|
@ -107,7 +116,7 @@
|
|
|
}
|
|
|
loginAPI.registe(params).then(function(res) {
|
|
|
if(res.successFlg) {
|
|
|
console.log("注册成功");
|
|
|
toastr.success("注册成功");
|
|
|
sessionStorage.setItem("userAgent", JSON.stringify(res.obj));
|
|
|
var data1 = {
|
|
|
grant_type: httpRequest.grant_type,
|
|
@ -119,14 +128,14 @@
|
|
|
sessionStorage.setItem("oauthInfo", JSON.stringify(oauthInfo));
|
|
|
vm.getJueSeData(res.obj);
|
|
|
}).catch(function(e) {
|
|
|
console.log("获取accessToken失败")
|
|
|
toastr.error("获取accessToken失败")
|
|
|
})
|
|
|
} else {
|
|
|
console.log(res.errorMsg);
|
|
|
toastr.error(res.errorMsg);
|
|
|
}
|
|
|
|
|
|
}).catch(function(err) {
|
|
|
console.log(err);
|
|
|
toastr.error(err);
|
|
|
})
|
|
|
},
|
|
|
gologin: function() {
|
|
@ -146,13 +155,13 @@
|
|
|
},
|
|
|
sendMsg:function(){
|
|
|
var vm=this;
|
|
|
var isMobile = isMobilePhone(this.mobile);
|
|
|
var isMobile = isMobilePhone(vm.phone);
|
|
|
if(!isMobile) {
|
|
|
alert('请输入正确的手机号码!');
|
|
|
toastr.error('请输入正确的手机号码!');
|
|
|
return false;
|
|
|
}
|
|
|
if(vm.codeMsg!=="获取验证码"){
|
|
|
console.log(vm.codeMsg || (vm.spaceTime+"秒内只能获取一次验证码"));
|
|
|
toastr.error(vm.codeMsg || (vm.spaceTime+"秒内只能获取一次验证码"));
|
|
|
vm.codeMsg="正在获取验证码";
|
|
|
return ;
|
|
|
}
|
|
@ -167,7 +176,7 @@
|
|
|
if(res.successFlg) vm.getCode(vm.spaceTime);
|
|
|
else{
|
|
|
vm.codeMsg="获取验证码";
|
|
|
console.log(res.errorMsg);
|
|
|
toastr.error(res.errorMsg);
|
|
|
}
|
|
|
|
|
|
}).catch(function(err) {
|
|
@ -183,14 +192,13 @@
|
|
|
verificationCode:vm.captcha
|
|
|
}
|
|
|
loginAPI.validate(data).then(function(res) {
|
|
|
console.log(res)
|
|
|
if(res.successFlg){
|
|
|
vm.register();
|
|
|
}else{
|
|
|
console.log(res.errorMsg);
|
|
|
toastr.error(res.errorMsg);
|
|
|
}
|
|
|
}).catch(function(err) {
|
|
|
console.log(err.errorMsg);
|
|
|
toastr.error(err.errorMsg);
|
|
|
})
|
|
|
},
|
|
|
changePwdType:function(ev){
|
|
@ -210,8 +218,8 @@
|
|
|
userId: userAgent.id
|
|
|
}).then(function(data) {
|
|
|
sessionStorage.setItem("roleList", JSON.stringify(data.detailModelList)); //缓存角色列表
|
|
|
// location.href = "../../../home/html/home.html"//跳转到主页面
|
|
|
location.href = "../../../page/mine/html/personal-info.html"
|
|
|
//location.href = "../../../home/html/home.html"//跳转到主页面
|
|
|
location.back();
|
|
|
})
|
|
|
},
|
|
|
},
|
|
@ -236,7 +244,7 @@
|
|
|
});
|
|
|
function isMobilePhone(phone) {
|
|
|
var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
|
|
|
if (!myreg.test(phone.val())) {
|
|
|
if (!myreg.test(phone)) {
|
|
|
return false;
|
|
|
} else {
|
|
|
return true;
|
|
@ -247,7 +255,7 @@
|
|
|
var iscard = false;
|
|
|
var reg1 = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
|
|
|
if(reg1.test(card) === false) {
|
|
|
console.log("身份证号输入不合法");
|
|
|
toastr.error("身份证号输入不合法");
|
|
|
} else {
|
|
|
iscard = true
|
|
|
}
|