WXL
3 天以前 c8e9849cb5f24848df0174c13bfbbff37bb08a5a
src/views/login.vue
@@ -6,7 +6,14 @@
      :rules="loginRules"
      class="login-form"
    >
      <h3 class="title">浙江省OPO数字化管理平台</h3>
      <div class="login-header">
        <img
          src="@/assets/logo/OPO_Logo.png"
          class="hospital-logo"
          alt="医院logo"
        />
        <h3 class="title">青岛大学附属医院opo</h3>
      </div>
      <el-form-item prop="username">
        <el-input
          v-model="loginForm.username"
@@ -25,6 +32,7 @@
        <el-input
          v-model="loginForm.password"
          type="password"
          show-password
          auto-complete="off"
          @focus="tip"
          placeholder="密码"
@@ -79,9 +87,18 @@
        </div>
      </el-form-item>
    </el-form>
    <!--  底部  -->
    <!-- 底部信息 -->
    <div class="el-login-footer">
      <span>Copyright © 浙江省OPO管理中心</span>
      <div class="footer-content">
        <div class="footer-row">
          <span class="tech-label">技术支持:</span>
          <img src="@/assets/logo/Hrs.png" class="tech-logo" alt="logo" />
          <span class="tech-name">浙江亥尔时科技有限公司</span>
        </div>
        <div class="footer-row">
          <span class="hotline">服务热线:17778760073</span>
        </div>
      </div>
    </div>
  </div>
</template>
@@ -90,7 +107,7 @@
import { getCodeImg } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from "@/utils/jsencrypt";
import { encrypts } from "@/utils/crypto";
export default {
  name: "Login",
  data() {
@@ -139,6 +156,8 @@
    this.getCode();
    this.getCookie();
    this.getAuthCode();
    this.loginForm.password = "";
    // this.loginForm.password=this.generatePassword();
    // this.avoidLogin();
  },
  methods: {
@@ -155,14 +174,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 +206,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 {
@@ -224,8 +257,12 @@
            Cookies.remove("password");
            Cookies.remove("rememberMe");
          }
          let loginobj = { username: null, password: null };
          loginobj.username = encrypts(this.loginForm.username);
          loginobj.password = encrypts(this.loginForm.password);
          this.$store
            .dispatch("Login", this.loginForm)
            .dispatch("Login", loginobj)
            .then(res => {
              console.log(this.$store.state.user.code, "44");
              console.log(this.$store.state.user.msg, "22");
@@ -308,17 +345,78 @@
    vertical-align: middle;
  }
}
.login-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 30px; /* 与原来 title 的 margin-bottom 一致 */
}
.hospital-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin-right: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  background: #fff; /* 防止透明背景 */
}
.title {
  margin: 0;
  text-align: center;
  color: #707070;
  font-size: 22px;
  font-weight: bold;
}
.el-login-footer {
  height: 40px;
  line-height: 40px;
  position: fixed;
  bottom: 0;
  bottom: 20px;
  left: 0;
  right: 0;
  width: 100%;
  text-align: center;
  color: #fff;
  font-family: Arial;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  z-index: 10;
}
.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.footer-row {
  display: flex;
  align-items: center;
  justify-content: center;
}
.tech-logo {
  width: 28px;
  height: 28px;
  margin: 0 6px;
  vertical-align: middle;
}
.tech-label,
.tech-name,
.hotline {
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
}
.tech-name {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}
.hotline {
  font-size: 12px;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.55);
}
.login-code-img {
  height: 38px;