WXL
3 天以前 31cbe57809438eb27c4ee8e6b432efef706c7bd8
src/views/login.vue
@@ -6,7 +6,7 @@
      :rules="loginRules"
      class="login-form"
    >
      <h3 class="title">智慧随访管理系统</h3>
      <h3 class="title">无锡儿童医院智慧随访平台</h3>
      <el-form-item prop="username">
        <el-input
          v-model="loginForm.username"
@@ -36,24 +36,7 @@
          />
        </el-input>
      </el-form-item>
      <!-- <el-form-item prop="code" v-if="captchaEnabled">
        <el-input
          v-model="loginForm.code"
          auto-complete="off"
          placeholder="验证码"
          style="width: 63%"
          @keyup.enter.native="handleLogin"
        >
          <svg-icon
            slot="prefix"
            icon-class="validCode"
            class="el-input__icon input-icon"
          />
        </el-input>
        <div class="login-code">
          <img :src="codeUrl" @click="getCode" class="login-code-img" />
        </div>
      </el-form-item> -->
      <el-checkbox
        v-model="loginForm.rememberMe"
        style="margin: 0px 0px 25px 0px"
@@ -77,11 +60,15 @@
        </div>
      </el-form-item>
    </el-form>
    <!--  底部  -->
    <div class="el-login-footer">
      <span>Copyright © 2018-2022 ruoyi.vip All Rights Reserved.</span>
    </div>
  </div>
  <!-- <div class="block">
    <div class="smerry">
      <el-image >
        <div slot="error" class="image-slot">无权限访问</div>
      </el-image>
    </div>
  </div> -->
</template>
<script>
@@ -95,12 +82,16 @@
    return {
      codeUrl: "",
      loginForm: {
        username: "admin",
        password: "admin123",
        username: "",
        password: "",
        rememberMe: false,
        code: "",
        uuid: "",
        orgid: "1",
      },
      options: [
        { value: "1", label: "景宁畲族自治县人民医院" },
        { value: "2", label: "丽水市中医院" },
      ],
      loginRules: {
        username: [
          { required: true, trigger: "blur", message: "请输入您的账号" },
@@ -108,7 +99,7 @@
        password: [
          { required: true, trigger: "blur", message: "请输入您的密码" },
        ],
        // code: [{ required: true, trigger: "change", message: "请输入验证码" }],
        // orgid: [{ required: true, trigger: "blur", message: "请选择院区" }],
      },
      loading: false,
      // 验证码开关
@@ -129,6 +120,9 @@
  created() {
    this.getCode();
    this.getCookie();
    // if (localStorage.getItem('orgid')) {
    //   this.loginForm.orgid = localStorage.getItem('orgid');
    // }
  },
  methods: {
    getCode() {
@@ -170,17 +164,19 @@
            Cookies.remove("password");
            Cookies.remove("rememberMe");
          }
          this.$store
            .dispatch("Login", this.loginForm)
            .then(() => {
              this.$router.push({ path: this.redirect || "/" }).catch(() => {});
            })
            .catch(() => {
              this.loading = false;
              if (this.captchaEnabled) {
                this.getCode();
              }
            });
          (this.loginForm.orgid = "1"),
            this.$store
              .dispatch("Login", this.loginForm)
              .then(() => {
                // this.$router.push({ path: this.redirect || "/" }).catch(() => {});
                // this.$router.push({ path:"/patient/patient" }).catch(() => {});
              })
              .catch(() => {
                this.loading = false;
                if (this.captchaEnabled) {
                  this.getCode();
                }
              });
        }
      });
    },
@@ -194,6 +190,17 @@
  justify-content: center;
  align-items: center;
  height: 100%;
  overflow: hidden !important;
  background-position: center center;
  /* 背景图不平铺 */
  background-repeat: no-repeat;
  /* 当内容高度大于图片高度时,背景图像的位置相对于viewport固定 */
  background-attachment: fixed;
  /* 让背景图基于容器大小伸缩 */
  background-size: cover;
  /* 设置背景颜色,背景图加载过程中会显示背景色 */
  background-color: #464646;
  background-image: url("../assets/images/login-background.jpg");
  background-size: cover;
}
@@ -246,7 +253,22 @@
  font-size: 12px;
  letter-spacing: 1px;
}
.login-code-img {
  height: 38px;
}
.smerry {
  text-align: center;
  align-items: center;
  .el-image {
    width: 95vw;
    height: 94vh;
    line-height: 94vh;
    font-size: 50px;
    justify-content: center;
    align-items: center;
    color: #c0c4cc;
    vertical-align: middle;
  }
}
</style>