From da57fbd8e7fa021614fb32502fb1520ea4e34e1e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 18 五月 2026 11:35:16 +0800
Subject: [PATCH] 浪潮 1.样式修改
---
src/views/login.vue | 748 +++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 493 insertions(+), 255 deletions(-)
diff --git a/src/views/login.vue b/src/views/login.vue
index 960f097..be1024e 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -1,255 +1,493 @@
-<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="璐﹀彿"
- @input="getUserLoginFacotryList"
- >
- <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="currentFatoryId">
- <el-select v-model="loginForm.currentFatoryId" placeholder="璇烽�夋嫨鍏徃" >
- <el-option v-for="item in factoryList" :key="item.deptId" :label="item.deptName" :value="item.deptId" />
- </el-select>
- </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'
-import {userLoginFacotryList} from "@/api/system/user.js"
-
-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,
- currentFatoryId:'',
-})
-
-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)
-
-const factoryList = ref([])
-const currentFatoryId = ref('')
-
-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)
- }
-}
-
-function getUserLoginFacotryList() {
- if(loginForm.value.username){
- userLoginFacotryList({userName:loginForm.value.username}).then(res => {
- console.log('res', res)
- factoryList.value = res.data
- })
- }else {
- factoryList.value = []
- }
-}
-
-getCode()
-getCookie()
-getUserLoginFacotryList()
-</script>
-
-<style lang='scss' scoped>
-.login {
- height: 100%;
- background-image: url("../assets/indexViews/JZYJView.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-container">
+ <!-- 宸︿晶鍝佺墝鍖哄煙 -->
+ <div class="brand-section">
+ <div class="brand-content">
+ <div class="brand-icon">
+ <el-icon :size="48" color="#fff"><Box /></el-icon>
+ </div>
+ <h1 class="brand-title">浠撳偍鐗╂祦绠$悊绯荤粺</h1>
+ <p class="brand-desc">鏅鸿兘鍖栦粨鍌ㄧ鐞� 路 楂樻晥鐗╂祦閰嶉�� 路 鍏ㄧ▼鍙杩借釜</p>
+ <div class="brand-features">
+ <div class="feature-item">
+ <div class="feature-icon">
+ <el-icon :size="28" color="#fff"><Goods /></el-icon>
+ </div>
+ <span>搴撳瓨绮惧噯绠$悊</span>
+ </div>
+ <div class="feature-item">
+ <div class="feature-icon">
+ <el-icon :size="28" color="#fff"><Van /></el-icon>
+ </div>
+ <span>鐗╂祦瀹炴椂杩借釜</span>
+ </div>
+ <div class="feature-item">
+ <div class="feature-icon">
+ <el-icon :size="28" color="#fff"><TrendCharts /></el-icon>
+ </div>
+ <span>鏁版嵁鏅鸿兘鍒嗘瀽</span>
+ </div>
+ </div>
+ </div>
+ <div class="brand-decoration">
+ <div class="deco-circle"></div>
+ <div class="deco-line"></div>
+ <div class="deco-box"></div>
+ </div>
+ </div>
+
+ <!-- 鍙充晶鐧诲綍鍖哄煙 -->
+ <div class="login-section">
+ <div class="login-box">
+ <div class="login-header">
+ <h2>娆㈣繋鐧诲綍</h2>
+ <p>璇蜂娇鐢ㄦ偍鐨勮处鍙峰瘑鐮佺櫥褰曠郴缁�</p>
+ </div>
+
+ <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
+ <el-form-item prop="username">
+ <div class="input-label">璐﹀彿</div>
+ <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">
+ <div class="input-label">瀵嗙爜</div>
+ <el-input
+ v-model="loginForm.password"
+ type="password"
+ size="large"
+ auto-complete="off"
+ placeholder="璇疯緭鍏ュ瘑鐮�"
+ show-password
+ @keyup.enter="handleLogin"
+ >
+ <template #prefix>
+ <el-icon><Lock /></el-icon>
+ </template>
+ </el-input>
+ </el-form-item>
+
+ <div class="form-options">
+ <el-checkbox v-model="loginForm.rememberMe">璁颁綇瀵嗙爜</el-checkbox>
+ <router-link v-if="register" :to="'/register'">娉ㄥ唽璐﹀彿</router-link>
+ </div>
+
+ <el-button
+ :loading="loading"
+ size="large"
+ type="primary"
+ class="login-btn"
+ @click.prevent="handleLogin"
+ >
+ <span v-if="!loading">鐧� 褰�</span>
+ <span v-else>鐧诲綍涓�...</span>
+ </el-button>
+ </el-form>
+ </div>
+ </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 loginForm = ref({
+ username: "",
+ password: "",
+ rememberMe: false,
+})
+
+const loginRules = {
+ username: [{ required: true, trigger: "blur", message: "璇疯緭鍏ヨ处鍙�" }],
+ password: [{ required: true, trigger: "blur", message: "璇疯緭鍏ュ瘑鐮�" }],
+}
+
+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) {
+ 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-container {
+ min-height: 100vh;
+ display: flex;
+ background: #f8fafc;
+}
+
+// 宸︿晶鍝佺墝鍖哄煙
+.brand-section {
+ flex: 1;
+ background: linear-gradient(145deg, var(--el-color-primary-dark-2) 0%, var(--el-color-primary) 50%, var(--el-color-primary-dark-2) 100%);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ position: relative;
+ overflow: hidden;
+
+ &::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background:
+ radial-gradient(circle at 20% 80%, var(--el-color-primary-light-5) 0%, transparent 50%),
+ radial-gradient(circle at 80% 20%, var(--el-color-primary-light-7) 0%, transparent 50%);
+ }
+}
+
+.brand-content {
+ text-align: center;
+ color: #fff;
+ z-index: 1;
+ padding: 40px;
+}
+
+.brand-icon {
+ width: 100px;
+ height: 100px;
+ margin: 0 auto 32px;
+ background: rgba(255, 255, 255, 0.1);
+ border-radius: 24px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ backdrop-filter: blur(10px);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+
+ :deep(svg) {
+ width: 48px;
+ height: 48px;
+ color: #fff;
+ }
+}
+
+.brand-title {
+ font-size: 36px;
+ font-weight: 700;
+ margin: 0 0 16px;
+ letter-spacing: 2px;
+}
+
+.brand-desc {
+ font-size: 16px;
+ color: rgba(255, 255, 255, 0.7);
+ margin: 0 0 48px;
+ letter-spacing: 1px;
+}
+
+.brand-features {
+ display: flex;
+ justify-content: center;
+ gap: 48px;
+}
+
+.feature-item {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 12px;
+
+ .feature-icon {
+ width: 56px;
+ height: 56px;
+ background: rgba(255, 255, 255, 0.1);
+ border-radius: 16px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ backdrop-filter: blur(10px);
+ border: 1px solid rgba(255, 255, 255, 0.15);
+
+ :deep(svg) {
+ width: 28px;
+ height: 28px;
+ color: #fff;
+ }
+ }
+
+ span {
+ font-size: 14px;
+ color: rgba(255, 255, 255, 0.8);
+ }
+}
+
+.brand-decoration {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ pointer-events: none;
+
+ .deco-circle {
+ position: absolute;
+ width: 400px;
+ height: 400px;
+ border: 1px solid rgba(255, 255, 255, 0.05);
+ border-radius: 50%;
+ top: -100px;
+ right: -100px;
+ }
+
+ .deco-line {
+ position: absolute;
+ width: 2px;
+ height: 200px;
+ background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.1), transparent);
+ bottom: 10%;
+ left: 20%;
+ }
+
+ .deco-box {
+ position: absolute;
+ width: 60px;
+ height: 60px;
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ bottom: 20%;
+ right: 15%;
+ transform: rotate(15deg);
+ }
+}
+
+// 鍙充晶鐧诲綍鍖哄煙
+.login-section {
+ width: 480px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: #fff;
+ box-shadow: -10px 0 40px rgba(0, 0, 0, 0.05);
+}
+
+.login-box {
+ width: 360px;
+ padding: 40px 0;
+}
+
+.login-header {
+ margin-bottom: 40px;
+
+ h2 {
+ font-size: 28px;
+ font-weight: 600;
+ color: #1e293b;
+ margin: 0 0 8px;
+ }
+
+ p {
+ font-size: 14px;
+ color: #64748b;
+ margin: 0;
+ }
+}
+
+.login-form {
+ .input-label {
+ font-size: 14px;
+ color: #374151;
+ margin-bottom: 8px;
+ font-weight: 500;
+ }
+
+ :deep(.el-form-item) {
+ margin-bottom: 24px;
+ }
+
+ :deep(.el-input__wrapper) {
+ border-radius: 10px;
+ box-shadow: 0 0 0 1px #e2e8f0;
+ padding: 0 16px;
+ height: 48px;
+ transition: all 0.3s;
+ background: #f8fafc;
+
+ &:hover {
+ box-shadow: 0 0 0 1px #cbd5e1;
+ }
+
+ &:focus-within {
+ box-shadow: 0 0 0 2px var(--el-color-primary);
+ background: #fff;
+ }
+ }
+
+ :deep(.el-input__inner) {
+ height: 48px;
+ font-size: 15px;
+ color: #1e293b;
+
+ &::placeholder {
+ color: #94a3b8;
+ }
+ }
+
+ :deep(.el-input__prefix) {
+ color: #64748b;
+ font-size: 18px;
+ margin-right: 10px;
+ }
+}
+
+.form-options {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin: 8px 0 32px;
+
+ :deep(.el-checkbox__label) {
+ color: #64748b;
+ font-size: 14px;
+ }
+
+ :deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
+ background-color: var(--el-color-primary);
+ border-color: var(--el-color-primary);
+ }
+
+ a {
+ color: var(--el-color-primary);
+ font-size: 14px;
+ font-weight: 500;
+ text-decoration: none;
+
+ &:hover {
+ color: var(--el-color-primary-dark-2);
+ }
+ }
+}
+
+.login-btn {
+ width: 100%;
+ height: 48px;
+ border-radius: 10px;
+ font-size: 16px;
+ font-weight: 600;
+ letter-spacing: 2px;
+ background: linear-gradient(135deg, var(--el-color-primary) 0%, var(--el-color-primary-dark-2) 100%);
+ border: none;
+ box-shadow: 0 4px 16px var(--el-color-primary-light-5);
+ transition: all 0.3s;
+
+ &:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 6px 20px var(--el-color-primary-light-3);
+ }
+}
+
+.login-footer {
+ margin-top: 48px;
+ text-align: center;
+
+ p {
+ color: #94a3b8;
+ font-size: 13px;
+ margin: 0;
+ }
+}
+
+// 鍝嶅簲寮�
+@media (max-width: 992px) {
+ .brand-section {
+ display: none;
+ }
+
+ .login-section {
+ width: 100%;
+ box-shadow: none;
+ }
+}
+
+@media (max-width: 480px) {
+ .login-box {
+ width: 90%;
+ padding: 20px 0;
+ }
+
+ .login-header {
+ h2 {
+ font-size: 24px;
+ }
+ }
+}
+</style>
--
Gitblit v1.9.3