liusheng
2 天以前 bbbc478129f72b26e2ec4a2e981ed8698a96880c
src/views/login.vue
@@ -13,6 +13,7 @@
          type="text"
          auto-complete="off"
          placeholder="账号"
          @blur="handleUsernameBlur"
        >
          <svg-icon
            slot="prefix"
@@ -154,6 +155,7 @@
      immediate: true,
    },
  },
  created() {
    this.getorganization();
    this.getCode();
@@ -161,6 +163,12 @@
    // if (localStorage.getItem('orgid')) {
    //   this.loginForm.orgid = localStorage.getItem('orgid');
    // }
  },
    computed: {
    isAdmin() {
      const roles = this.$store.getters.roles || [];
      return roles.includes("mydstaff");
    }
  },
  methods: {
    getCode() {
@@ -183,6 +191,17 @@
          }));
        }
      });
    },
    // 输入完账号后,检索可选机构是否包含“南华附一”,若有则自动填充密码
    handleUsernameBlur() {
      if (!this.loginForm.username) return;
      const hasNanhua = this.options.some((item) => {
        const label = item.label || "";
        return label.includes("南华") && label.includes("附一");
      });
      if (hasNanhua) {
        this.loginForm.password = "nhfy@0230";
      }
    },
    getCookie() {
      const username = Cookies.get("username");
@@ -237,13 +256,23 @@
            .then((res) => {
              if (this.loginForm.username == "admin") {
                this.$router.push({ path: "/index" }).catch(() => {});
              } else if (this.isAdmin) {
                console.log(1);
                 this.$router
                  .push({ path: "/Intelligentcenter/dispose" })
                  .catch(() => {});
              } else {
                console.log(2);
                this.$router
                  .push({ path: "/followvisit/discharge" })
                  .catch(() => {});
              }
            })
            .catch(() => {
              console.log(3);
              this.loading = false;
              if (this.captchaEnabled) {
                this.getCode();
@@ -252,6 +281,7 @@
        }
      });
    },
  },
};
</script>
@@ -321,7 +351,7 @@
  width: 100%;
  text-align: center;
  font-size: 13px;
  color: #3664D9;
  color: #3664d9;
  z-index: 10;
}
@@ -349,18 +379,18 @@
.tech-label,
.tech-name,
.hotline {
  color: #3664D9;;
  color: #3664d9;
  font-size: 13px;
}
.tech-name {
  color: #3664D9;;
  color: #3664d9;
  font-weight: 500;
}
.hotline {
  font-size: 12px;
  color: #3664D9;;
  color: #3664d9;
}
.login-code-img {
  height: 38px;