| | |
| | | */ |
| | | // 提交登录信息 |
| | | submit() { |
| | | this.$refs.loginForm.validate((valid) => { |
| | | this.$refs.loginForm.validate(async (valid) => { |
| | | if (valid) { |
| | | // 登录 |
| | | // 注意 这里的演示没有传验证码 |
| | | // 具体需要传递的数据请自行修改代码 |
| | | login({ |
| | | await login({ |
| | | username: this.formLogin.username, |
| | | password: this.formLogin.password, |
| | | captcha: this.formLogin.code, |
| | | captchaId: this.captchaId |
| | | }).then((rsp) => { |
| | | // 重定向对象不存在则返回顶层路径 |
| | | if (rsp != "") { |
| | | // this.$message.warning(rsp); |
| | | this.error = "填入信息错误,请检查!" |
| | | let _this = this |
| | | setTimeout(function () { |
| | | _this.error = "" |
| | | }, 3000) |
| | | if (rsp.indexOf("验证码错误") > -1) { |
| | | }).then((res) => { |
| | | if (res.code == 200) { |
| | | this.$message.success("登录成功") |
| | | localStorage.setItem("token", res.data.token) |
| | | localStorage.setItem("username", res.data.user.username) |
| | | localStorage.setItem("uuid", res.data.user.id) |
| | | setTimeout(() => { |
| | | this.$router.push({ path: "/orderManageModule/orderManage" }) |
| | | }, 1000) |
| | | } else { |
| | | this.$message.warning(res.msg) |
| | | if (res.msg == "验证码错误") { |
| | | this.getCaptchaData() |
| | | } |
| | | return |
| | | } |
| | | this.$router.push({ path: "/commonWeb" }) |
| | | }) |
| | | } else { |
| | | // 登录表单校验失败 |