From 31bc616ad716daf2ba0ec7fa38352644b6293dfc Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 07 四月 2026 11:36:16 +0800
Subject: [PATCH] 1.整体样式修改
---
src/views/login.vue | 633 ++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 401 insertions(+), 232 deletions(-)
diff --git a/src/views/login.vue b/src/views/login.vue
index 6217877..872537b 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -1,232 +1,401 @@
-<template>
- <div class="login">
- <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
- <h3 class="title">{{ title }}</h3>
- <el-divider />
- <el-form-item prop="username">
- <el-input
- v-model="loginForm.username"
- type="text"
- size="large"
- auto-complete="off"
- placeholder="璐﹀彿"
- >
- <template #prefix><el-icon><User /></el-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-form-item style="width:100%;">
- <el-button
- :loading="loading"
- size="large"
- type="primary"
- style="width:100%;"
- @click.prevent="handleLogin"
- >
- <span v-if="!loading">鐧� 褰�</span>
- <span v-else>鐧� 褰� 涓�...</span>
- </el-button>
- <div style="float: right;" v-if="register">
- <router-link class="link-type" :to="'/register'">绔嬪嵆娉ㄥ唽</router-link>
- </div>
- </el-form-item>
- <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">璁颁綇瀵嗙爜</el-checkbox>
- </el-form>
- <!-- 搴曢儴 -->
-<!-- <div class="el-login-footer">-->
-<!-- <span>Copyright 漏 2018-2025 ruoyi.vip 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 title = import.meta.env.VITE_APP_TITLE
-const userStore = useUserStore()
-const route = useRoute()
-const router = useRouter()
-const { proxy } = getCurrentInstance()
-
-const loginForm = ref({
- username: "",
- password: "",
- rememberMe: false,
-})
-
-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 涓缃浣忕敤鎴峰悕鍜屽瘑鐮�
- 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 })
- userStore.loginCheckFactory(loginForm.value).then(res => {
- 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 {
- height: 100%;
- background-image: url("../assets/images/login-background.png");
- background-size: cover;
- position: relative;
-}
-.title {
- margin: 20px auto 14px auto;
- text-align: center;
- color: #2C51D9;
- font-size: 28px;
- font-weight: 700;
-}
-
-.login-form {
- position: absolute;
- top: 50%;
- right: 15%;
- transform: translate(0, -50%);
- border-radius: 6px;
- background: #ffffff;
- width: 420px;
- height: 500px;
- padding: 40px;
- z-index: 1;
- box-shadow: 0 0 5px 1px #ccc;
- .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;
-}
-:deep() {
- .el-form-item--default {
- margin-bottom: 36px;
- }
-}
-</style>
+<template>
+ <div class="login-page">
+ <div class="login-shell">
+ <section class="login-brand">
+ <div class="brand-badge">PRODUCT INVENTORY</div>
+ <img :src="brandLogo" alt="brand logo" class="brand-logo" />
+ <h1 class="brand-title">{{ title }}</h1>
+ <p class="brand-copy">
+ 缁熶竴绠$悊搴撳瓨銆佹祦绋嬩笌涓氬姟鏁版嵁锛岃绯荤粺鍏ュ彛鍜屽悗鍙颁富鐣岄潰淇濇寔鍚屼竴濂楃畝绾﹁瑙夎瑷�銆�
+ </p>
+ <div class="brand-points">
+ <div class="brand-point">
+ <span class="point-dot"></span>
+ <span>娓呮櫚鐨勬暟鎹叆鍙�</span>
+ </div>
+ <div class="brand-point">
+ <span class="point-dot"></span>
+ <span>鏇磋交鐨勭晫闈㈠眰娆�</span>
+ </div>
+ <div class="brand-point">
+ <span class="point-dot"></span>
+ <span>绋冲畾鐨勪笟鍔″崗鍚屼綋楠�</span>
+ </div>
+ </div>
+ </section>
+
+ <section class="login-panel">
+ <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
+ <div class="panel-head">
+ <p class="panel-kicker">WELCOME BACK</p>
+ <h2 class="panel-title">鐧诲綍绯荤粺</h2>
+ <p class="panel-subtitle">杈撳叆璐﹀彿鍜屽瘑鐮佽繘鍏ュ伐浣滃彴銆�</p>
+ </div>
+
+ <el-form-item prop="username">
+ <el-input
+ v-model="loginForm.username"
+ type="text"
+ size="large"
+ auto-complete="off"
+ placeholder="璐﹀彿"
+ >
+ <template #prefix><el-icon><User /></el-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>
+
+ <div class="login-options">
+ <el-checkbox v-model="loginForm.rememberMe">璁颁綇瀵嗙爜</el-checkbox>
+ <router-link v-if="register" class="register-link" :to="'/register'">绔嬪嵆娉ㄥ唽</router-link>
+ </div>
+
+ <el-button
+ :loading="loading"
+ size="large"
+ type="primary"
+ class="login-submit"
+ @click.prevent="handleLogin"
+ >
+ <span v-if="!loading">鐧诲綍</span>
+ <span v-else>鐧诲綍涓�...</span>
+ </el-button>
+ </el-form>
+ </section>
+ </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"
+import brandLogo from "@/assets/logo/logo.png"
+
+const title = import.meta.env.VITE_APP_TITLE
+const userStore = useUserStore()
+const route = useRoute()
+const router = useRouter()
+const { proxy } = getCurrentInstance()
+
+const loginForm = ref({
+ username: "",
+ password: "",
+ rememberMe: false,
+})
+
+const loginRules = {
+ username: [{ required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勮处鍙�" }],
+ password: [{ required: true, trigger: "blur", 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
+ 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 })
+ userStore
+ .loginCheckFactory(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-page {
+ min-height: 100vh;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 32px;
+ background:
+ radial-gradient(circle at top left, rgba(207, 223, 214, 0.95), transparent 30%),
+ radial-gradient(circle at bottom right, rgba(222, 232, 227, 0.9), transparent 28%),
+ linear-gradient(180deg, #f7faf8 0%, #eef2ee 100%);
+}
+
+.login-shell {
+ width: min(1120px, 100%);
+ min-height: 680px;
+ display: grid;
+ grid-template-columns: 1.1fr 0.9fr;
+ border: 1px solid rgba(216, 225, 219, 0.9);
+ border-radius: 32px;
+ overflow: hidden;
+ background: rgba(255, 255, 255, 0.76);
+ box-shadow: 0 26px 80px rgba(31, 49, 38, 0.12);
+ backdrop-filter: blur(24px);
+}
+
+.login-brand {
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ padding: 56px 64px;
+ background:
+ linear-gradient(180deg, rgba(244, 248, 245, 0.9), rgba(233, 240, 236, 0.9)),
+ linear-gradient(135deg, rgba(31, 122, 114, 0.05), rgba(255, 255, 255, 0));
+
+ &::after {
+ content: "";
+ position: absolute;
+ inset: 28px;
+ border: 1px solid rgba(31, 122, 114, 0.08);
+ border-radius: 28px;
+ pointer-events: none;
+ }
+}
+
+.brand-badge {
+ width: fit-content;
+ padding: 8px 14px;
+ border-radius: 999px;
+ background: rgba(31, 122, 114, 0.1);
+ color: #1f7a72;
+ font-size: 12px;
+ font-weight: 700;
+ letter-spacing: 0.14em;
+}
+
+.brand-logo {
+ width: 160px;
+ height: auto;
+ margin: 30px 0 24px;
+ object-fit: contain;
+}
+
+.brand-title {
+ margin: 0;
+ font-size: 42px;
+ line-height: 1.12;
+ color: #21313f;
+ letter-spacing: -0.03em;
+}
+
+.brand-copy {
+ max-width: 460px;
+ margin: 18px 0 0;
+ font-size: 16px;
+ line-height: 1.75;
+ color: #5f6d7e;
+}
+
+.brand-points {
+ margin-top: 34px;
+ display: flex;
+ flex-direction: column;
+ gap: 14px;
+}
+
+.brand-point {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ color: #3d4b59;
+ font-size: 15px;
+ font-weight: 500;
+}
+
+.point-dot {
+ width: 10px;
+ height: 10px;
+ border-radius: 50%;
+ background: linear-gradient(135deg, #1f7a72, #5ca39c);
+ box-shadow: 0 0 0 6px rgba(31, 122, 114, 0.08);
+}
+
+.login-panel {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 40px;
+ background: rgba(255, 255, 255, 0.7);
+}
+
+.login-form {
+ width: min(420px, 100%);
+ padding: 38px 34px 34px;
+ border: 1px solid rgba(216, 225, 219, 0.92);
+ border-radius: 28px;
+ background: rgba(255, 255, 255, 0.88);
+ box-shadow: 0 18px 52px rgba(31, 49, 38, 0.1);
+}
+
+.panel-head {
+ margin-bottom: 28px;
+}
+
+.panel-kicker {
+ margin: 0 0 10px;
+ color: #8a98a8;
+ font-size: 12px;
+ font-weight: 700;
+ letter-spacing: 0.16em;
+}
+
+.panel-title {
+ margin: 0;
+ color: #21313f;
+ font-size: 30px;
+ font-weight: 700;
+}
+
+.panel-subtitle {
+ margin: 10px 0 0;
+ color: #6b7888;
+ font-size: 14px;
+}
+
+.login-options {
+ margin: -4px 0 22px;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ color: #5f6d7e;
+}
+
+.register-link {
+ color: var(--el-color-primary);
+ font-weight: 600;
+}
+
+.login-submit {
+ width: 100%;
+ height: 48px;
+}
+
+.input-icon {
+ width: 14px;
+}
+
+:deep(.el-form-item) {
+ margin-bottom: 22px;
+}
+
+:deep(.el-input__wrapper) {
+ min-height: 42px;
+ height: 42px;
+ padding-top: 0;
+ padding-bottom: 0;
+}
+
+:deep(.el-input__inner) {
+ height: 42px;
+ line-height: 42px;
+}
+
+:deep(.el-checkbox) {
+ color: #5f6d7e;
+}
+
+@media (max-width: 960px) {
+ .login-page {
+ padding: 18px;
+ }
+
+ .login-shell {
+ min-height: auto;
+ grid-template-columns: 1fr;
+ }
+
+ .login-brand {
+ padding: 40px 28px 22px;
+ }
+
+ .login-brand::after {
+ inset: 16px;
+ }
+
+ .brand-title {
+ font-size: 32px;
+ }
+
+ .brand-copy {
+ font-size: 14px;
+ }
+
+ .brand-points {
+ margin-top: 24px;
+ }
+
+ .login-panel {
+ padding: 12px 18px 24px;
+ }
+
+ .login-form {
+ width: 100%;
+ padding: 28px 22px 24px;
+ }
+}
+</style>
--
Gitblit v1.9.3