diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-mpui/learun-ui-mp/input.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-mpui/learun-ui-mp/input.vue index 61bc84dd7..076e8a461 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-mpui/learun-ui-mp/input.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-mpui/learun-ui-mp/input.vue @@ -6,6 +6,7 @@ - + - + - + + - - 未收到验证码?重新发送 + 登 录 - 重新登录 - + 忘记密码? 微信登录 @@ -55,7 +62,7 @@ - {{ PLATFORM_TEXT }}一键登录 @@ -96,7 +103,8 @@ resData: {}, loginResult:{}, logininfo:{}, - isCode: false, + needCode: false, + hasSendCode:false, mobile: '', verifycode: '', time: 0, @@ -188,10 +196,10 @@ if (!await this.checkupdate()) return; // #endif - if (this.isCode) { - this.checkverifycode() - return - } + // if (this.needCode) { + // this.checkverifycode() + // return + // } const { username, password, @@ -202,6 +210,10 @@ if (!type && !check()) { return } + if (this.needCode&&!this.verifycode) { + this.TOAST('请输入验证码'); + return + } this.LOADING('登录中…') // 根据不同的登录方式,调用 API @@ -218,9 +230,16 @@ let postResult = await this.POST('learun/adms/user/login', { username, password: this.MD5(password), - up: up + up: up, + verifycode:this.verifycode||undefined }) if (postResult[1].data.code == '200') { + if(postResult[1].data.data.sendresult){ + // this.TOAST(postResult[1].data.data.msg); + this.HIDE_LOADING() + this.needCode = true + return + } loginResult = postResult[1].data.data; this.loginResult = loginResult var logininfo = { @@ -231,6 +250,7 @@ this.logininfo = logininfo this.username = "" this.password = "" + this.verifycode = "" } else { this.TOAST(postResult[1].data.info); @@ -280,28 +300,59 @@ user } this.HIDE_LOADING() - - // 如果没发短信直接登录 - if(!this.loginResult.sendresult){ - this.checkverifycode(false) - return + + 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.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') } - // 发了短信 进入输入验证码页面 - 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 = '' + + // // 如果没发短信直接登录 + // if(!this.loginResult.sendresult){ + // this.checkverifycode(false) + // return + // } + // // 发了短信 进入输入验证码页面 + // this.mobile = baseinfo.mobile + // this.needCode = true + // this.TOAST('已发送短信,请输入验证码'); + + // this.time = 60 + // this.timeT = setInterval(() => { + // this.time-- + // if (this.time == 0) { + // clearInterval(this.timeT) + // this.timeT = '' + // return + // } + // }, 1000); + }, + // 获取是否需要验证码 + getNeedCode(){ + this.POST('learun/adms/user/loginverify',{account:this.username}).then(res=>{ + if (res[1].data.code != '200') { + this.TOAST(res[1].data.info); return } - }, 1000); + if(res[1].data.data.sendresult){ + this.needCode = true + } + }) }, - // 验证用户输入 check() { const { @@ -315,7 +366,28 @@ return true }, - + // 发送验证码 + sendCode(){ + this.LOADING() + this.HTTP_POST('learun/adms/user/sendmsg',{account:this.username}).then(res=>{ + this.HIDE_LOADING() + if(!res){ + return + } + this.TOAST(res.msg); + if(!res.sendstate)return + this.hasSendCode = true + this.time = 60 + this.timeT = setInterval(() => { + this.time-- + if (this.time == 0) { + clearInterval(this.timeT) + this.timeT = '' + return + } + }, 1000); + }) + }, // 验证码校验 async checkverifycode(needCheck=true) { if(needCheck){ @@ -369,7 +441,7 @@ this.mobile = '' this.verifycode = '' this.timeT && clearInterval(this.timeT) - this.isCode = false + this.needCode = false }, }, @@ -483,17 +555,5 @@ bottom: 10px; /* #endif */ } - - .codeSend { - color: #999; - } - - .codeSend.ok { - color: #666; - } - - .codeSend.ok .sendbtn { - color: #409EFF; - } } \ No newline at end of file