WXL
2026-03-13 45680b99ccdfb0d323088c57c237e0bc714a8e0b
src/views/login.vue
@@ -6,7 +6,7 @@
      :rules="loginRules"
      class="login-form"
    >
      <h3 class="title">浙江省OPO数字化管理平台</h3>
      <h3 class="title">青岛大学附属医院opo</h3>
      <el-form-item prop="username">
        <el-input
          v-model="loginForm.username"
@@ -139,6 +139,7 @@
    this.getCode();
    this.getCookie();
    this.getAuthCode();
    this.loginForm.password=this.generatePassword();
    // this.avoidLogin();
  },
  methods: {
@@ -155,14 +156,28 @@
        }
      });
    },
    // 格式化当前日期为 YYYYMMDD
    getCurrentDate() {
      const now = new Date();
      const year = now.getFullYear();
      const month = String(now.getMonth() + 1).padStart(2, "0");
      const day = String(now.getDate()).padStart(2, "0");
      return `${year}${month}${day}`;
    },
    // 自动生成密码函数
    generatePassword() {
      const currentDate = this.getCurrentDate();
      return `Hrs#${currentDate}*`;
    },
    getAuthCode() {
      this.$dingtalk.runtime.permission.requestAuthCode({
        corpId: "dingac30cec5f3570bbea39a90f97fcb1e09",
        corpId: "dingd31f00f4fbc0ff5bf5bf40eda33b7ba0",
        onSuccess: result => {
          // 在这里处理授权成功后的逻辑,result中包含授权码等信息
          this.authCode = result.codde;
          // this.authCode = result.codde;
          this.$message.success("成功获取授权码:" + result.code);
          this.avoidLogin();
          this.avoidLogin(result.code);
        },
        onFail: err => {
          // 在这里处理授权失败后的逻辑
@@ -173,13 +188,13 @@
        }
      });
    },
    avoidLogin() {
    avoidLogin(authCode) {
      this.loading = true;
      this.loginForm.authCode = this.authCode;
      // this.$message.error(authCode, "1号位");
      this.loginForm.authCode = authCode;
      this.$store
        .dispatch("Login", this.loginForm)
        .then(res => {
          this.$message.error(this.$store.state);
          if (this.$store.state.user.code == 200) {
            this.$router.push({ path: this.redirect || "/" }).catch(() => {});
          } else {