gaoluyang
2025-04-16 1ea1ad2c56e95e71e1756cfca73e7183f9795ac9
src/views/login.vue
@@ -18,15 +18,15 @@
            <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
          </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-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;">记住密码</el-checkbox>
        <el-form-item style="width:100%;">
          <el-button :loading="loading" size="medium" type="primary" style="width:100%;"
@@ -38,6 +38,7 @@
            <router-link class="link-type" :to="'/register'">立即注册</router-link>
          </div>
        </el-form-item>
        <el-button v-if="true" type="primary" plain @click="goLogin">集团集成登录</el-button>
      </el-form>
    </div>
    <!--  底部  -->
@@ -48,7 +49,7 @@
</template>
<script>
import { getCodeImg } from "@/api/login";
import { getCodeImg, getSsoAuthUrl } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
@@ -58,8 +59,8 @@
    return {
      codeUrl: "",
      loginForm: {
        username: "admin",
        password: "admin123",
        username: "ZT-",
        password: "",
        rememberMe: false,
        code: "",
        uuid: ""
@@ -90,10 +91,15 @@
    }
  },
  created() {
    this.getCode();
    // this.getCode();
    this.getCookie();
  },
  methods: {
    async goLogin() {
      await getSsoAuthUrl().then(res => {
        window.location.href = res.data
      })
    },
    getCode() {
      getCodeImg().then(res => {
        this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
@@ -127,12 +133,12 @@
            Cookies.remove('rememberMe');
          }
          this.$store.dispatch("Login", this.loginForm).then(() => {
            this.$router.push({ path: this.redirect || "/" }).catch(() => { });
            this.$router.push({ path: "/" }).catch(() => { });
          }).catch(() => {
            this.loading = false;
            if (this.captchaEnabled) {
              this.getCode();
            }
            // if (this.captchaEnabled) {
            //   this.getCode();
            // }
          });
        }
      });
@@ -142,14 +148,14 @@
</script>
<style rel="stylesheet/scss" lang="scss">
//.login {
//  display: flex;
//  justify-content: center;
//  align-items: center;
//  height: 100%;
//  background-image: url("../assets/images/login-background.jpg");
//  background-size: cover;
//}
.login {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-image: url("../assets/images/login-background.jpg");
  background-size: cover;
}
.login {
  width: 100vw;
  height: 100vh;