yangfeng
2024-03-29 00d1a771adb136642f67ce281c09d7c32cb1f697
src/views/other/login/index.vue
@@ -148,28 +148,30 @@
      this.$refs.loginForm.validate((valid) => {
        if (valid) {
          // 登录
          // 注意 这里的演示没有传验证码
          // 具体需要传递的数据请自行修改代码
          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)
              this.$router.push({ path: "/orderManageModule/orderManage" })
              // if (Object.keys(res.data).length > 0) {
              //   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 {
          // 登录表单校验失败