|
@ -2,11 +2,11 @@
|
|
|
Vue.component('login-form', {
|
|
|
template: `<div><div class="container-fluid">
|
|
|
<div class="container" id="head">
|
|
|
<div class="ptb15 top-banner">
|
|
|
<img src="../../images/LOGO.png" class="hlogo" />
|
|
|
<div class="ptb30 top-banner">
|
|
|
<img src="../../../images/LOGO.png"/>
|
|
|
<span class="qr-container">
|
|
|
<img src="../../images/qr_code.png" class="qr_code" />
|
|
|
<p class="c-f12 text-center">下载APP</p>
|
|
|
<img src="../../../images/qr_code.png" class="qr_code" />
|
|
|
<p class="c-f12 text-center c-909090" style="padding-top:5px">下载APP</p>
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
@ -61,37 +61,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="registerForm fr" :class="{'registerForm-active':registerFlag}">
|
|
|
<div class="ptb10 plr30 c-border-b c-f26">注册<span class="fr c-909090 c-f14 fhdl" @click="toggleRegister">返回登录</span></div>
|
|
|
<form id="form" class="m-t plr30" role="form" onsubmit="return false;">
|
|
|
<div class="form-group">
|
|
|
<select class="form-control codeType" v-model="codeType">
|
|
|
<option value="1">身份证</option>
|
|
|
<option value="2">手机</option>
|
|
|
</select>
|
|
|
</div>
|
|
|
<div class="form-group">
|
|
|
<input class="form-control" type="text" :maxlength="maxLength" placeholder="请输入身份证号" v-model="idCardNo" id="IDCard">
|
|
|
</div>
|
|
|
<div class="form-group">
|
|
|
<input class="form-control" placeholder="请输入登录密码" v-model="rPassword" type="password" minlength="6" maxlength="16">
|
|
|
</div>
|
|
|
<div class="form-group">
|
|
|
<input class="form-control" placeholder="请确认登录密码" v-model="confirmPassword" type="password" minlength="6" maxlength="16">
|
|
|
</div>
|
|
|
<p class="c-909090" style="margin-top:-10px;">密码格式为6-16位,不允许有空格</p>
|
|
|
<div class="checkbox">
|
|
|
<label><input type="checkbox"
|
|
|
v-model="toggle"> 阅读并接受<a href="#" target="_blank">《健康之路用户协议》</a>及<a href="#" target="_blank">《健康之路隐私保护声明》</a></label>
|
|
|
</div>
|
|
|
<button type="submit" class="btn btn-theme block full-width m-b" :class="{'disabled':!toggle}" @click="register">完成注册并登录</button>
|
|
|
</form>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div id="foot">
|
|
|
<p>主办方:上饶市卫生与计划生育委员会 技术支持:健康之路(中国)信息技术有限公司 备案号登记号:赣ICP98273877号-1</p>
|
|
|
<p>上饶市卫生信息中心 Copyright <span class="glyphicon glyphicon-copyright-mark"></span> 2009-2017 All Rights Reserved</p>
|
|
|
</div></div>`,
|
|
|
props: [],
|
|
|
data: function() {
|
|
@ -103,14 +73,14 @@
|
|
|
imgcaptcha: '',
|
|
|
captcha: '',
|
|
|
infoText: '获取验证码',
|
|
|
countdown: false ,//是否在倒计时
|
|
|
countdown: false, //是否在倒计时
|
|
|
codeType: 1,
|
|
|
idCardNo: "350526199501142015",
|
|
|
rPassword: 'a123123',
|
|
|
confirmPassword: "a123123",
|
|
|
toggle: true,
|
|
|
registerFlag:false,
|
|
|
maxLength:18,
|
|
|
registerFlag: false,
|
|
|
maxLength: 18,
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@ -140,7 +110,7 @@
|
|
|
return false;
|
|
|
}
|
|
|
console.log(httpRequest)
|
|
|
var data={
|
|
|
var data = {
|
|
|
grant_type: httpRequest.grant_type,
|
|
|
client_id: httpRequest.client_id,
|
|
|
username: vm.account,
|
|
@ -149,21 +119,22 @@
|
|
|
console.log(data)
|
|
|
loginAPI.accessToken(data).then(function(oauthInfo) {
|
|
|
storage.setItem("oauthInfo", JSON.stringify(oauthInfo));
|
|
|
var data1={
|
|
|
userName:oauthInfo.user,
|
|
|
var data1 = {
|
|
|
userName: oauthInfo.user,
|
|
|
accessToken: oauthInfo.accessToken
|
|
|
}
|
|
|
loginAPI.getUserInfo(data1).then(function(res) {
|
|
|
console.log("登录成功");
|
|
|
loginedList = [res.telephone]
|
|
|
storage.setItem("loginedList", JSON.stringify(loginedList));
|
|
|
storage.setItem("userAgent", JSON.stringify(res));
|
|
|
vm.getJueSeData(res);
|
|
|
}), function error(xhr, type, errorThrown) {
|
|
|
if(type == "timeout" || type == "abort" || type == "error") {
|
|
|
console.log("账号或密码错误");
|
|
|
console.log("登录成功");
|
|
|
loginedList = [res.telephone]
|
|
|
storage.setItem("loginedList", JSON.stringify(loginedList));
|
|
|
storage.setItem("userAgent", JSON.stringify(res));
|
|
|
vm.getJueSeData(res);
|
|
|
}),
|
|
|
function error(xhr, type, errorThrown) {
|
|
|
if(type == "timeout" || type == "abort" || type == "error") {
|
|
|
console.log("账号或密码错误");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}).catch(function(e) {
|
|
|
console.log("账号或密码错误")
|
|
|
})
|
|
@ -188,67 +159,13 @@
|
|
|
loginAPI.findByUserId({
|
|
|
userId: userAgent.id
|
|
|
}).then(function(data) {
|
|
|
storage.setItem("roleList",JSON.stringify(data.detailModelList));//缓存角色列表
|
|
|
// app.openWebviewExtras("../../home/html/home.html");//跳转到主页面
|
|
|
storage.setItem("roleList", JSON.stringify(data.detailModelList)); //缓存角色列表
|
|
|
// app.openWebviewExtras("../../home/html/home.html");//跳转到主页面
|
|
|
})
|
|
|
},
|
|
|
register: function() {
|
|
|
var vm = this
|
|
|
if(!isCardNo(vm.idCardNo, vm.codeType)) {
|
|
|
return
|
|
|
}
|
|
|
if(!vm.rPassword) {
|
|
|
alert("登录密码不能为空!");
|
|
|
return false;
|
|
|
}
|
|
|
if(!vm.confirmPassword) {
|
|
|
alert("确认密码不能为空!");
|
|
|
return false;
|
|
|
}
|
|
|
if(vm.rPassword.length < 6 && vm.rPassword.length > 16) {
|
|
|
alert("登录密码需6-16位");
|
|
|
return false;
|
|
|
}
|
|
|
if(vm.confirmPassword.length < 6 && vm.confirmPassword.length > 16) {
|
|
|
alert("确认密码需6-16位");
|
|
|
return false;
|
|
|
}
|
|
|
if(vm.rPassword != vm.confirmPassword) {
|
|
|
alert("新密码和确认密码必须一致");
|
|
|
return false;
|
|
|
}
|
|
|
if(!vm.toggle) {
|
|
|
alert("未确认是否阅读并接受条款");
|
|
|
return false;
|
|
|
}
|
|
|
// location.href = "../login/login.html"
|
|
|
//连接注册后台接口
|
|
|
var data={
|
|
|
demographicId: vm.idCardNo,
|
|
|
codeType:vm.codeType,
|
|
|
telephone: vm.tel,
|
|
|
password: vm.password,
|
|
|
}
|
|
|
var params = {
|
|
|
userJsonData:JSON.stringify(data),
|
|
|
appId: httpRequest.client_id
|
|
|
}
|
|
|
loginAPI.registe(params).then(function (res) {
|
|
|
if (res.successFlg) {
|
|
|
alert("注册成功");
|
|
|
vm.login();
|
|
|
} else {
|
|
|
alert(res.errorMsg);
|
|
|
}
|
|
|
|
|
|
}).catch(function (err) {
|
|
|
alert(err.errorMsg);
|
|
|
})
|
|
|
|
|
|
},
|
|
|
toggleRegister:function(){
|
|
|
var vm=this;
|
|
|
vm.registerFlag=!vm.registerFlag
|
|
|
|
|
|
toggleRegister: function() {
|
|
|
location.href = "../../register/html/register.html"
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@ -267,14 +184,14 @@
|
|
|
}
|
|
|
},
|
|
|
codeType: function(newVal) {
|
|
|
var vm=this;
|
|
|
var vm = this;
|
|
|
var val = newVal.toString();
|
|
|
if(val == 1) {
|
|
|
$("#IDCard").attr("placeholder", "请输入身份证号")
|
|
|
vm.maxLength=18
|
|
|
vm.maxLength = 18
|
|
|
} else if(val == 2) {
|
|
|
$("#IDCard").attr("placeholder", "请输入手机号码")
|
|
|
vm.maxLength=11
|
|
|
vm.maxLength = 11
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -297,6 +214,7 @@
|
|
|
vm.infoText = seconds + "s后重新获取";
|
|
|
}, 1000)
|
|
|
}
|
|
|
|
|
|
function isCardNo(card, codeType) {
|
|
|
var isidcard = false
|
|
|
if(codeType == 1) { // 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
|
|
@ -306,7 +224,7 @@
|
|
|
} else {
|
|
|
isidcard = true
|
|
|
}
|
|
|
}else{
|
|
|
} else {
|
|
|
var reg = /0?(13|14|15|18|17)[0-9]{9}/;
|
|
|
if(!reg.test(card)) {
|
|
|
alert("手机号码输入不合法");
|
|
@ -316,6 +234,7 @@
|
|
|
}
|
|
|
return isidcard
|
|
|
}
|
|
|
|
|
|
function sendToGetCaptcha(vm) {
|
|
|
var url = "common/captcha",
|
|
|
params = {
|
|
@ -380,4 +299,4 @@
|
|
|
});
|
|
|
}
|
|
|
|
|
|
})()
|
|
|
})()
|