| | |
| | | :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" |
| | |
| | | <el-input |
| | | v-model="loginForm.password" |
| | | type="password" |
| | | show-password |
| | | auto-complete="off" |
| | | @focus="tip" |
| | | placeholder="密码" |
| | |
| | | </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> |
| | |
| | | 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() { |
| | | return { |
| | | codeUrl: "", |
| | | authCode: "", |
| | | cookiePassword: "", |
| | | loginForm: { |
| | | username: "", |
| | |
| | | created() { |
| | | this.getCode(); |
| | | this.getCookie(); |
| | | this.getAuthCode(); |
| | | this.loginForm.password = ""; |
| | | // this.loginForm.password=this.generatePassword(); |
| | | // this.avoidLogin(); |
| | | }, |
| | | methods: { |
| | | tip() { |
| | |
| | | this.loginForm.uuid = res.uuid; |
| | | } |
| | | }); |
| | | }, |
| | | // 格式化当前日期为 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: "dingd31f00f4fbc0ff5bf5bf40eda33b7ba0", |
| | | onSuccess: result => { |
| | | // 在这里处理授权成功后的逻辑,result中包含授权码等信息 |
| | | // this.authCode = result.codde; |
| | | this.$message.success("成功获取授权码:" + result.code); |
| | | this.avoidLogin(result.code); |
| | | }, |
| | | onFail: err => { |
| | | // 在这里处理授权失败后的逻辑 |
| | | this.$message({ |
| | | type: "error", |
| | | message: err |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | avoidLogin(authCode) { |
| | | this.loading = true; |
| | | // this.$message.error(authCode, "1号位"); |
| | | this.loginForm.authCode = authCode; |
| | | this.$store |
| | | .dispatch("Login", this.loginForm) |
| | | .then(res => { |
| | | if (this.$store.state.user.code == 200) { |
| | | this.$router.push({ path: this.redirect || "/" }).catch(() => {}); |
| | | } else { |
| | | this.loading = false; |
| | | // this.$message.error(this.$store.state.user.msg); |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | console.log(err); |
| | | this.loading = false; |
| | | this.$message.error("免登陆失败请手动操作。"); |
| | | if (this.captchaOnOff) { |
| | | this.getCode(); |
| | | } |
| | | }); |
| | | }, |
| | | getCookie() { |
| | | const username = Cookies.get("username"); |
| | |
| | | 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"); |
| | |
| | | .push({ path: this.redirect || "/" }) |
| | | .catch(() => {}); |
| | | } else { |
| | | this.loading = false; |
| | | this.loading = false; |
| | | this.$message.error(this.$store.state.user.msg); |
| | | } |
| | | }) |
| | |
| | | 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; |