|
|
@@ -229,19 +229,8 @@ |
|
|
|
date: moment().format('yyyy-MM-dd hh:mm:ss') |
|
|
|
}; |
|
|
|
this.logininfo = logininfo |
|
|
|
// this.SET_STORAGE("token", loginResult.baseinfo.token) |
|
|
|
// this.SET_STORAGE('logininfo', logininfo); |
|
|
|
// this.SET_STORAGE('userinfo', loginResult.baseinfo); |
|
|
|
this.username = "" |
|
|
|
this.password = "" |
|
|
|
if (loginResult.pwd === true) { |
|
|
|
this.SET_STORAGE('pwd', true); |
|
|
|
this.TOAST("登录失败!您的密码不满足强度要求,请您先修改密码后再执行系统其他操作"); |
|
|
|
location.href = "http://" + window.location.host + "/#/pages/my/newpassword"; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
this.SET_STORAGE('pwd', false); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
this.TOAST(postResult[1].data.info); |
|
|
@@ -286,38 +275,31 @@ |
|
|
|
if (mpinfo && Array.isArray(mpinfo) && mpinfo.includes(type)) { |
|
|
|
user.miniProgram = true |
|
|
|
} |
|
|
|
|
|
|
|
// if (baseinfo.Description == '学生') { |
|
|
|
// 验证码验证 |
|
|
|
this.HIDE_LOADING() |
|
|
|
this.resData = { |
|
|
|
token, |
|
|
|
user |
|
|
|
} |
|
|
|
this.mobile = baseinfo.mobile |
|
|
|
this.isCode = true |
|
|
|
this.TOAST('已发送短信,请输入验证码'); |
|
|
|
|
|
|
|
this.time = 60 |
|
|
|
this.timeT = setInterval(() => { |
|
|
|
this.time-- |
|
|
|
if (this.time == 0) { |
|
|
|
clearInterval(this.timeT) |
|
|
|
this.timeT = '' |
|
|
|
return |
|
|
|
} |
|
|
|
}, 1000); |
|
|
|
this.HIDE_LOADING() |
|
|
|
|
|
|
|
// 如果没发短信直接登录 |
|
|
|
if(!this.loginResult.sendresult){ |
|
|
|
this.checkverifycode(false) |
|
|
|
return |
|
|
|
// } |
|
|
|
|
|
|
|
// this.SET_GLOBAL('token', token) |
|
|
|
// this.SET_GLOBAL('loginUser', user) |
|
|
|
// this.SET_STORAGE("logintime", user.logTime); |
|
|
|
// this.SET_STORAGE('token', token) |
|
|
|
|
|
|
|
// this.HIDE_LOADING() |
|
|
|
// this.TAB_TO('/pages/home') |
|
|
|
} |
|
|
|
// 发了短信 进入输入验证码页面 |
|
|
|
this.resData = { |
|
|
|
token, |
|
|
|
user |
|
|
|
} |
|
|
|
this.mobile = baseinfo.mobile |
|
|
|
this.isCode = true |
|
|
|
this.TOAST('已发送短信,请输入验证码'); |
|
|
|
|
|
|
|
this.time = 60 |
|
|
|
this.timeT = setInterval(() => { |
|
|
|
this.time-- |
|
|
|
if (this.time == 0) { |
|
|
|
clearInterval(this.timeT) |
|
|
|
this.timeT = '' |
|
|
|
return |
|
|
|
} |
|
|
|
}, 1000); |
|
|
|
}, |
|
|
|
|
|
|
|
// 验证用户输入 |
|
|
@@ -335,38 +317,52 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
// 验证码校验 |
|
|
|
async checkverifycode() { |
|
|
|
if (!this.verifycode) { |
|
|
|
this.TOAST('请输入验证码'); |
|
|
|
return |
|
|
|
async checkverifycode(needCheck=true) { |
|
|
|
if(needCheck){ |
|
|
|
if (!this.verifycode) { |
|
|
|
this.TOAST('请输入验证码'); |
|
|
|
return |
|
|
|
} |
|
|
|
this.LOADING('正在校验...') |
|
|
|
let codeResult = await this.POST('learun/adms/user/logincodeverify', { |
|
|
|
mobile: this.mobile, |
|
|
|
verifycode: this.verifycode |
|
|
|
}) |
|
|
|
if (!codeResult || !codeResult[1] || !codeResult[1].data) { |
|
|
|
return |
|
|
|
} |
|
|
|
if (!codeResult[1].data.code || codeResult[1].data.code != 200) { |
|
|
|
this.TOAST(codeResult[1].data.info); |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
this.LOADING('正在校验...') |
|
|
|
let codeResult = await this.POST('learun/adms/user/logincodeverify', { |
|
|
|
mobile: this.mobile, |
|
|
|
verifycode: this.verifycode |
|
|
|
}) |
|
|
|
// if (!codeResult || !codeResult[1] || !codeResult[1].data) { |
|
|
|
// return |
|
|
|
// } |
|
|
|
// if (!codeResult[1].data.code || codeResult[1].data.code != 200) { |
|
|
|
// this.TOAST(codeResult[1].data.info); |
|
|
|
// return |
|
|
|
// 设置token过期时间 |
|
|
|
// if (this.loginResult.baseinfo.Description == '学生') { |
|
|
|
// this.SET_STORAGE("tokenExpireTime", new Date().valueOf()+86400000*30) |
|
|
|
// }else{ |
|
|
|
// this.SET_STORAGE("tokenExpireTime", new Date().valueOf()+86400000*7) |
|
|
|
// } |
|
|
|
|
|
|
|
if (this.loginResult.baseinfo.Description == '学生') { |
|
|
|
this.SET_STORAGE("tokenExpireTime", new Date().valueOf()+86400000*30) |
|
|
|
}else{ |
|
|
|
this.SET_STORAGE("tokenExpireTime", new Date().valueOf()+86400000*7) |
|
|
|
} |
|
|
|
|
|
|
|
this.SET_GLOBAL('token', this.resData.token) |
|
|
|
this.SET_GLOBAL('loginUser', this.resData.user) |
|
|
|
this.SET_STORAGE("logintime", this.resData.user.logTime); |
|
|
|
this.SET_STORAGE('token', this.resData.token) |
|
|
|
this.SET_STORAGE('logininfo', this.logininfo); |
|
|
|
this.SET_STORAGE('userinfo', this.loginResult.baseinfo); |
|
|
|
this.TAB_TO('/pages/home') |
|
|
|
this.HIDE_LOADING() |
|
|
|
// 密码强度校验 |
|
|
|
if (this.loginResult.pwd === true) { |
|
|
|
this.SET_STORAGE('pwd', true); |
|
|
|
this.TOAST("您的密码不满足强度要求,请您先修改密码后再执行系统其他操作"); |
|
|
|
setTimeout(()=>{ |
|
|
|
this.NAV_TO('/pages/my/newpassword') |
|
|
|
},1000) |
|
|
|
return; |
|
|
|
} else { |
|
|
|
this.SET_STORAGE('pwd', false); |
|
|
|
this.TAB_TO('/pages/home') |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
toLogin() { |
|
|
|
this.resData = {} |
|
|
|