diff --git a/jshERP-web/src/views/user/Login.vue b/jshERP-web/src/views/user/Login.vue index a8464fc5..8fcd98e9 100644 --- a/jshERP-web/src/views/user/Login.vue +++ b/jshERP-web/src/views/user/Login.vue @@ -23,6 +23,25 @@ + + + + + + + + + + + + + + 记住密码 @@ -30,7 +49,7 @@ - + { + if(res.code == 200){ + this.randCode = res.data.codeNum; + this.randCodeImage = res.data.base64; + this.requestCodeSuccess=true + }else{ + this.$message.error(res.data) + this.requestCodeSuccess=false + } + }).catch(()=>{ + this.requestCodeSuccess=false + }) + }, handleSubmit () { let that = this let loginParams = {}; that.loginBtn = true; // 使用账户密码登陆 if (that.customActiveKey === 'tab1') { - that.form.validateFields([ 'loginName', 'password' ], { force: true }, (err, values) => { + that.form.validateFields([ 'loginName', 'password', 'inputCode' ], { force: true }, (err, values) => { if (!err) { - loginParams.loginName = values.loginName - loginParams.password = md5(values.password) - if(that.checked) { - //勾选的时候进行缓存 - Vue.ls.set('cache_loginName', values.loginName) - Vue.ls.set('cache_password', values.password) + if(values.inputCode === this.randCode) { + loginParams.loginName = values.loginName + loginParams.password = md5(values.password) + if(that.checked) { + //勾选的时候进行缓存 + Vue.ls.set('cache_loginName', values.loginName) + Vue.ls.set('cache_password', values.password) + } else { + //没勾选的时候清缓存 + Vue.ls.remove('cache_loginName') + Vue.ls.remove('cache_password') + } + that.Login(loginParams).then((res) => { + this.departConfirm(res, loginParams.loginName) + }).catch((err) => { + that.requestFailed(err); + }); } else { - //没勾选的时候清缓存 - Vue.ls.remove('cache_loginName') - Vue.ls.remove('cache_password') + this.$notification['error']({ + message: "提示", + description: "验证码错误", + duration: 2 + }); + this.loginBtn = false } - that.Login(loginParams).then((res) => { - this.departConfirm(res, loginParams.loginName) - }).catch((err) => { - that.requestFailed(err); - }); }else { that.loginBtn = false; } @@ -374,7 +419,7 @@ } .ant-form-item { - margin-bottom: 30px; + margin-bottom: 16px; } .getCaptcha { diff --git a/jshERP-web/src/views/user/Register.vue b/jshERP-web/src/views/user/Register.vue index 1f83a9b6..1bd3d38b 100644 --- a/jshERP-web/src/views/user/Register.vue +++ b/jshERP-web/src/views/user/Register.vue @@ -217,7 +217,7 @@ handleSubmit() { this.form.validateFields((err, values) => { if (!err) { - if(values.inputCode == this.randCode) { + if(values.inputCode === this.randCode) { let register = { loginName: values.username, password: md5(values.password) @@ -306,7 +306,7 @@ .user-layout-register { .ant-form-item { - margin-bottom: 18px; + margin-bottom: 16px; } & > h3 {