From d78c53261b838c4a3dafd2f6bb02bd3fab701938 Mon Sep 17 00:00:00 2001
From: ali <ali9696@163.com>
Date: 星期六, 08 二月 2025 14:22:23 +0800
Subject: [PATCH] 登录页面改版

---
 /dev/null                                         |    0 
 zhitan-vue/src/assets/images/font01.png           |    0 
 zhitan-vue/src/views/login.vue                    |  295 +++++++++++++++++-----------
 zhitan-vue/src/assets/images/login-background.png |    0 
 zhitan-vue/src/views/login copy.vue               |  293 +++++++++++++++++++++++++++++
 zhitan-vue/src/assets/images/img_logo.png         |    0 
 zhitan-vue/src/assets/images/logo.png             |    0 
 7 files changed, 472 insertions(+), 116 deletions(-)

diff --git a/zhitan-vue/src/assets/images/font01.png b/zhitan-vue/src/assets/images/font01.png
new file mode 100644
index 0000000..42bbca9
--- /dev/null
+++ b/zhitan-vue/src/assets/images/font01.png
Binary files differ
diff --git a/zhitan-vue/src/assets/images/img_logo.png b/zhitan-vue/src/assets/images/img_logo.png
new file mode 100644
index 0000000..593b9e6
--- /dev/null
+++ b/zhitan-vue/src/assets/images/img_logo.png
Binary files differ
diff --git a/zhitan-vue/src/assets/images/login-background.jpg b/zhitan-vue/src/assets/images/login-background.jpg
deleted file mode 100644
index 8a89eb8..0000000
--- a/zhitan-vue/src/assets/images/login-background.jpg
+++ /dev/null
Binary files differ
diff --git a/zhitan-vue/src/assets/images/login-background.png b/zhitan-vue/src/assets/images/login-background.png
new file mode 100644
index 0000000..b27391b
--- /dev/null
+++ b/zhitan-vue/src/assets/images/login-background.png
Binary files differ
diff --git a/zhitan-vue/src/assets/images/logo.png b/zhitan-vue/src/assets/images/logo.png
new file mode 100644
index 0000000..35f902b
--- /dev/null
+++ b/zhitan-vue/src/assets/images/logo.png
Binary files differ
diff --git a/zhitan-vue/src/views/login copy.vue b/zhitan-vue/src/views/login copy.vue
new file mode 100644
index 0000000..d9b0c13
--- /dev/null
+++ b/zhitan-vue/src/views/login copy.vue
@@ -0,0 +1,293 @@
+<template>
+  <div class="login">
+    <!-- <div
+      class="login-logo-bg"
+      v-if="systemInfo && systemInfo.homeLogo"
+      :style="{ backgroundImage: 'url(' + systemInfo.homeLogo + ')', backgroundSize: '100% 100%' }"
+    ></div> -->
+    <img v-if="systemInfo && systemInfo.homeLogo" :src="systemInfo.homeLogo" alt="" class="login-logo-img" />
+    <div class="login-font" v-else>{{ systemInfo.systemName || "鑳芥簮绠$悊绯荤粺" }}</div>
+    <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
+      <!-- <h3 class="title">鍏呯數妗╁悗鍙扮鐞嗙郴缁�</h3> -->
+      <el-form-item prop="username">
+        <el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="璐﹀彿">
+          <template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
+        </el-input>
+      </el-form-item>
+      <el-form-item prop="password">
+        <el-input
+          v-model="loginForm.password"
+          type="password"
+          size="large"
+          auto-complete="off"
+          placeholder="瀵嗙爜"
+          show-password
+          @keyup.enter="handleLogin"
+        >
+          <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
+        </el-input>
+      </el-form-item>
+      <el-form-item prop="code" v-if="captchaEnabled">
+        <el-input
+          v-model="loginForm.code"
+          size="large"
+          auto-complete="off"
+          placeholder="楠岃瘉鐮�"
+          style="width: 63%"
+          @keyup.enter="handleLogin"
+        >
+          <template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
+        </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="large"
+          type="primary"
+          style="width: 100%"
+          color="#626aef"
+          :dark="isDark"
+          @click.prevent="handleLogin"
+        >
+          <span v-if="!loading">鐧� 褰�</span>
+          <span v-else>鐧� 褰� 涓�...</span>
+        </el-button>
+      </el-form-item>
+    </el-form>
+    <!--  搴曢儴  -->
+    <div class="el-login-footer">
+      <!-- <span>Copyright 漏 2021-2024 ZhiTanCloud All Rights Reserved.</span> -->
+      <span>{{ systemInfo.copyRight || "Copyright 漏 2017-2024 ZhiTanCloud All Rights Reserved." }}</span>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import { getCodeImg } from "@/api/login"
+import Cookies from "js-cookie"
+import { encrypt, decrypt } from "@/utils/jsencrypt"
+import useUserStore from "@/store/modules/user"
+
+const userStore = useUserStore()
+const route = useRoute()
+const router = useRouter()
+const { proxy } = getCurrentInstance()
+const systemInfo1 = JSON.parse(Cookies.get("SystemInfo") || "{}")
+const systemInfo = {
+  ...systemInfo1,
+  homeLogo: systemInfo1.homeLogo
+    ? systemInfo1.homeLogo.includes("http")
+      ? systemInfo1.homeLogo
+      : "https://demo-ems.zhitancloud.com" + systemInfo1.homeLogo
+    : "",
+}
+console.log(systemInfo)
+
+const loginForm = ref({
+  username: "admin",
+  password: "admin123",
+  rememberMe: false,
+  code: "",
+  uuid: "",
+})
+
+const loginRules = {
+  username: [{ required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勮处鍙�" }],
+  password: [{ required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勫瘑鐮�" }],
+  code: [{ required: true, trigger: "change", message: "璇疯緭鍏ラ獙璇佺爜" }],
+}
+
+const codeUrl = ref("")
+const loading = ref(false)
+// 楠岃瘉鐮佸紑鍏�
+const captchaEnabled = ref(true)
+// 娉ㄥ唽寮�鍏�
+const register = ref(false)
+const redirect = ref(undefined)
+
+watch(
+  route,
+  (newRoute) => {
+    redirect.value = newRoute.query && newRoute.query.redirect
+  },
+  { immediate: true }
+)
+
+function handleLogin() {
+  proxy.$refs.loginRef.validate((valid) => {
+    if (valid) {
+      loading.value = true
+      // 鍕鹃�変簡闇�瑕佽浣忓瘑鐮佽缃湪 cookie 涓缃浣忕敤鎴峰悕鍜屽瘑鐮�
+      if (loginForm.value.rememberMe) {
+        Cookies.set("username", loginForm.value.username, { expires: 30 })
+        Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 })
+        Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 })
+      } else {
+        // 鍚﹀垯绉婚櫎
+        Cookies.remove("username")
+        Cookies.remove("password")
+        Cookies.remove("rememberMe")
+      }
+      // 璋冪敤action鐨勭櫥褰曟柟娉�
+      userStore
+        .login(loginForm.value)
+        .then(() => {
+          const query = route.query
+          const otherQueryParams = Object.keys(query).reduce((acc, cur) => {
+            if (cur !== "redirect") {
+              acc[cur] = query[cur]
+            }
+            return acc
+          }, {})
+          router.push({ path: redirect.value || "/", query: otherQueryParams })
+        })
+        .catch(() => {
+          loading.value = false
+          // 閲嶆柊鑾峰彇楠岃瘉鐮�
+          if (captchaEnabled.value) {
+            getCode()
+          }
+        })
+    }
+  })
+}
+
+function getCode() {
+  getCodeImg().then((res) => {
+    captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled
+    if (captchaEnabled.value) {
+      codeUrl.value = "data:image/gif;base64," + res.img
+      loginForm.value.uuid = res.uuid
+    }
+  })
+}
+
+function getCookie() {
+  const username = Cookies.get("username")
+  const password = Cookies.get("password")
+  const rememberMe = Cookies.get("rememberMe")
+  loginForm.value = {
+    username: username === undefined ? loginForm.value.username : username,
+    password: password === undefined ? loginForm.value.password : decrypt(password),
+    rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
+  }
+}
+
+getCode()
+getCookie()
+</script>
+
+<style lang="scss" scoped>
+.login {
+  display: flex;
+  align-items: center;
+  height: 100%;
+  background-image: url("@/assets/images/login-bg.jpg");
+  background-size: 100% 100%;
+  flex-direction: column;
+  position: relative;
+  min-width: 700px;
+  min-height: 700px;
+}
+
+.title {
+  margin: 0px auto 30px auto;
+  text-align: center;
+  color: #707070;
+}
+
+.login-form {
+  position: absolute;
+  left: 50%;
+  top: 60%;
+  transform: translate(-50%, -50%);
+  border-radius: 6px;
+  // background: #ffffff;
+  width: 400px;
+  padding: 25px 25px 5px 25px;
+
+  .el-input {
+    height: 40px;
+
+    input {
+      height: 40px;
+    }
+  }
+
+  .input-icon {
+    height: 39px;
+    width: 14px;
+    margin-left: 0px;
+  }
+}
+
+.login-tip {
+  font-size: 13px;
+  text-align: center;
+  color: #bfbfbf;
+}
+
+.login-code {
+  width: 33%;
+  height: 40px;
+  float: right;
+
+  img {
+    cursor: pointer;
+    vertical-align: middle;
+  }
+}
+
+.el-login-footer {
+  height: 40px;
+  line-height: 40px;
+  position: fixed;
+  bottom: 0;
+  width: 100%;
+  text-align: center;
+  color: #fff;
+  font-family: Arial;
+  font-size: 12px;
+  letter-spacing: 1px;
+}
+
+.login-code-img {
+  height: 40px;
+  padding-left: 12px;
+}
+
+.login-logo-bg {
+  width: 514px;
+  height: 177px;
+  // background-image: url('@/assets/images/login-logo.png');
+  // background-size: 100% 100%;
+  position: absolute;
+  left: 50%;
+  top: 22%;
+  transform: translate(-50%, -50%);
+}
+.login-logo-img {
+  // width: 100%;
+  // height: 100%;
+  // transform: translate(-50%, -50%);
+  max-height: 200px;
+  margin: 0 auto;
+  position: absolute;
+  top: 17%;
+}
+
+.login-font {
+  font-size: 50px;
+  color: #fff;
+  top: 32%;
+  position: absolute;
+  left: 50%;
+  width: 514px;
+  text-align: center;
+  transform: translate(-50%, -50%);
+}
+</style>
diff --git a/zhitan-vue/src/views/login.vue b/zhitan-vue/src/views/login.vue
index 86d243f..3e8b868 100644
--- a/zhitan-vue/src/views/login.vue
+++ b/zhitan-vue/src/views/login.vue
@@ -1,67 +1,83 @@
 <template>
   <div class="login">
-    <!-- <div
-      class="login-logo-bg"
-      v-if="systemInfo && systemInfo.homeLogo"
-      :style="{ backgroundImage: 'url(' + systemInfo.homeLogo + ')', backgroundSize: '100% 100%' }"
-    ></div> -->
-    <img v-if="systemInfo && systemInfo.homeLogo" :src="systemInfo.homeLogo" alt="" class="login-logo-img" />
-    <div class="login-font" v-else>{{ systemInfo.systemName || "鑳芥簮绠$悊绯荤粺" }}</div>
-    <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
-      <!-- <h3 class="title">鍏呯數妗╁悗鍙扮鐞嗙郴缁�</h3> -->
-      <el-form-item prop="username">
-        <el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="璐﹀彿">
-          <template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
-        </el-input>
-      </el-form-item>
-      <el-form-item prop="password">
-        <el-input
-          v-model="loginForm.password"
-          type="password"
-          size="large"
-          auto-complete="off"
-          placeholder="瀵嗙爜"
-          show-password
-          @keyup.enter="handleLogin"
-        >
-          <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
-        </el-input>
-      </el-form-item>
-      <el-form-item prop="code" v-if="captchaEnabled">
-        <el-input
-          v-model="loginForm.code"
-          size="large"
-          auto-complete="off"
-          placeholder="楠岃瘉鐮�"
-          style="width: 63%"
-          @keyup.enter="handleLogin"
-        >
-          <template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
-        </el-input>
-        <div class="login-code">
-          <img :src="codeUrl" @click="getCode" class="login-code-img" />
+    <!-- <img v-if="systemInfo && systemInfo.homeLogo" :src="systemInfo.homeLogo" alt="" class="login-logo-img" />
+    <div class="login-font" v-else>{{ systemInfo.systemName || "鑳芥簮绠$悊绯荤粺" }}</div> -->
+    <!-- 宸︿笂瑙抣ogo -->
+    <div>
+      <img v-if="systemInfo && systemInfo.homeLogo" :src="systemInfo.homeLogo" alt="" class="login-logo-img" />
+    </div>
+
+    <!-- 涓棿閮ㄥ垎form -->
+    <div class="middle-view">
+      <div class="left-wrapper">
+        <div class="login-font">{{ systemInfo.systemName || "" }}</div>
+        <img src="@/assets/images/font01.png" alt="" style="width: 406px" />
+        <img src="@/assets/images/img_logo.png" alt="" style="width: 200px; margin-top: 20px" />
+      </div>
+      <div class="right-wrapper">
+        <div class="header">
+          <span>璐﹀彿鐧诲綍</span>
         </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="large"
-          type="primary"
-          style="width: 100%"
-          color="#626aef"
-          :dark="isDark"
-          @click.prevent="handleLogin"
-        >
-          <span v-if="!loading">鐧� 褰�</span>
-          <span v-else>鐧� 褰� 涓�...</span>
-        </el-button>
-      </el-form-item>
-    </el-form>
+        <div class="bottom-block"></div>
+        <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form" :label-position="'top'">
+          <el-form-item prop="username" label="璐﹀彿">
+            <el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="璐﹀彿">
+              <!-- <template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template> -->
+            </el-input>
+          </el-form-item>
+          <el-form-item prop="password" label="瀵嗙爜">
+            <el-input
+              v-model="loginForm.password"
+              type="password"
+              size="large"
+              auto-complete="off"
+              placeholder="瀵嗙爜"
+              show-password
+              @keyup.enter="handleLogin"
+            >
+              <!-- <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template> -->
+            </el-input>
+          </el-form-item>
+          <el-form-item prop="code" v-if="captchaEnabled" label="楠岃瘉鐮�">
+            <el-input
+              v-model="loginForm.code"
+              size="large"
+              auto-complete="off"
+              placeholder="楠岃瘉鐮�"
+              style="width: 266px"
+              @keyup.enter="handleLogin"
+            >
+              <!-- <template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template> -->
+            </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="large"
+              type="primary"
+              style="width: 100%"
+              color="#626aef"
+              :dark="isDark"
+              @click.prevent="handleLogin"
+              class="submit-btn"
+            >
+              <span v-if="!loading">鐧� 褰�</span>
+              <span v-else>鐧� 褰� 涓�...</span>
+            </el-button>
+          </el-form-item>
+        </el-form>
+      </div>
+    </div>
+
     <!--  搴曢儴  -->
     <div class="el-login-footer">
-      <!-- <span>Copyright 漏 2021-2024 ZhiTanCloud All Rights Reserved.</span> -->
-      <span>{{ systemInfo.copyRight || "Copyright 漏 2017-2024 ZhiTanCloud All Rights Reserved." }}</span>
+      <span>{{
+        systemInfo.copyRight || "Copyright 漏 2017-" + new Date().getFullYear() + " ZhiTanCloud All Rights Reserved."
+      }}</span>
     </div>
   </div>
 </template>
@@ -76,12 +92,20 @@
 const route = useRoute()
 const router = useRouter()
 const { proxy } = getCurrentInstance()
-const systemInfo = JSON.parse(Cookies.get("SystemInfo") || "{}")
+const systemInfo1 = JSON.parse(Cookies.get("SystemInfo") || "{}")
+const systemInfo = {
+  ...systemInfo1,
+  homeLogo: systemInfo1.homeLogo
+    ? systemInfo1.homeLogo.includes("http")
+      ? systemInfo1.homeLogo
+      : "https://demo-ems.zhitancloud.com" + systemInfo1.homeLogo
+    : "",
+}
 console.log(systemInfo)
 
 const loginForm = ref({
-  username: "admin",
-  password: "admin123",
+  username: "guestUser",
+  password: "guest@123456",
   rememberMe: false,
   code: "",
   uuid: "",
@@ -178,29 +202,93 @@
   display: flex;
   align-items: center;
   height: 100%;
-  background-image: url("@/assets/images/login-bg.jpg");
-  background-size: 100% 100%;
+  background-image: url("@/assets/images/login-background.png");
+  background-repeat: no-repeat;
+  background-size: cover;
   flex-direction: column;
   position: relative;
   min-width: 700px;
   min-height: 700px;
 }
 
-.title {
-  margin: 0px auto 30px auto;
-  text-align: center;
-  color: #707070;
+.middle-view {
+  display: flex;
+  align-items: center;
+  justify-content: space-around;
+  height: 100%;
+  width: 1200px;
+  .left-wrapper {
+    width: 420px;
+    display: flex;
+    flex-direction: column;
+  }
+  .login-font {
+    font-size: 34px;
+    font-weight: 700;
+    color: #d5f8ff;
+    margin-bottom: 12px;
+  }
+}
+
+.right-wrapper {
+  border-radius: 23px;
+  background: #ffffff;
+  width: 480px;
+  position: relative;
+  .header {
+    height: 70px;
+    line-height: 70px;
+    border-bottom: 1px solid #f1f1f1;
+    color: #3b3b3b;
+    font-size: 22px;
+    margin-bottom: 22px;
+    span {
+      display: inline-block;
+      height: 70px;
+      line-height: 70px;
+      border-bottom: 6px solid #3a83fc;
+      margin-left: 50px;
+    }
+  }
+}
+
+:deep(.el-input__wrapper) {
+  background-color: #f7f8fa !important;
+  border: none;
+}
+:deep(.el-input__inner) {
+  color: #3b3b3b;
+}
+:deep(.el-form-item__label) {
+  color: #3b3b3b !important;
+}
+:deep(.el-checkbox__label) {
+  color: #2e2e2e;
+}
+
+.bottom-block {
+  height: 140px;
+  width: 90%;
+  background-color: rgba(255, 255, 255, 0.3);
+  position: absolute;
+  left: 5%;
+  bottom: -20px;
+  border-radius: 20px;
 }
 
 .login-form {
-  position: absolute;
-  left: 50%;
-  top: 60%;
-  transform: translate(-50%, -50%);
-  border-radius: 6px;
-  // background: #ffffff;
-  width: 400px;
-  padding: 25px 25px 5px 25px;
+  padding: 0 50px 30px;
+
+  .submit-btn {
+    width: 382px;
+    height: 54px;
+    background: #3a83fc;
+    border-radius: 3px;
+    font-size: 20px;
+    box-shadow: 1px 2px 5px #3a83fc;
+    border: none;
+    border-radius: 6px;
+  }
 
   .el-input {
     height: 40px;
@@ -224,7 +312,7 @@
 }
 
 .login-code {
-  width: 33%;
+  // width: 120px;
   height: 40px;
   float: right;
 
@@ -232,54 +320,29 @@
     cursor: pointer;
     vertical-align: middle;
   }
+  .login-code-img {
+    height: 40px;
+    // padding-left: 12px;
+  }
 }
 
+.login-logo-img {
+  max-height: 100px;
+  margin: 0 auto;
+  position: absolute;
+  top: 35px;
+  left: 65px;
+}
 .el-login-footer {
-  height: 40px;
-  line-height: 40px;
+  height: 60px;
+  line-height: 60px;
   position: fixed;
   bottom: 0;
   width: 100%;
   text-align: center;
   color: #fff;
   font-family: Arial;
-  font-size: 12px;
+  font-size: 16px;
   letter-spacing: 1px;
-}
-
-.login-code-img {
-  height: 40px;
-  padding-left: 12px;
-}
-
-.login-logo-bg {
-  width: 514px;
-  height: 177px;
-  // background-image: url('@/assets/images/login-logo.png');
-  // background-size: 100% 100%;
-  position: absolute;
-  left: 50%;
-  top: 22%;
-  transform: translate(-50%, -50%);
-}
-.login-logo-img {
-  // width: 100%;
-  // height: 100%;
-  // transform: translate(-50%, -50%);
-  max-height: 200px;
-  margin: 0 auto;
-  position: absolute;
-  top: 17%;
-}
-
-.login-font {
-  font-size: 50px;
-  color: #fff;
-  top: 32%;
-  position: absolute;
-  left: 50%;
-  width: 514px;
-  text-align: center;
-  transform: translate(-50%, -50%);
 }
 </style>

--
Gitblit v1.9.3