From 07cfe16049ada779c8c820b809c6531e69e84bc1 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 15 九月 2026 13:03:03 +0800
Subject: [PATCH] feat(home): 重构首页工作台界面并新增全息牙齿组件
---
src/views/login.vue | 564 +++++++++++++++++++++++++++++++++-----------------------
1 files changed, 332 insertions(+), 232 deletions(-)
diff --git a/src/views/login.vue b/src/views/login.vue
index 6217877..d6c9ef3 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -1,232 +1,332 @@
-<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">
+ <LoginBrand />
+
+ <main class="login-panel">
+ <div class="login-card">
+ <div class="login-card__header">
+ <img :src="logo" alt="鍋ラ娇榻跨鍣ㄦ潗" class="login-card__logo" />
+ <h2 class="login-card__title">娆㈣繋鐧诲綍</h2>
+ <p class="login-card__subtitle">寮�鍚偍鐨勬暟瀛楀寲宸ヤ綔鍙�</p>
+ </div>
+
+ <el-form ref="loginRef" :model="loginForm" :rules="loginRules">
+ <el-form-item prop="username">
+ <el-input
+ v-model="loginForm.username"
+ type="text"
+ size="large"
+ maxlength="30"
+ auto-complete="off"
+ placeholder="璇疯緭鍏ョ敤鎴峰悕"
+ @keyup.enter="handleLogin"
+ >
+ <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"
+ maxlength="20"
+ auto-complete="off"
+ placeholder="璇疯緭鍏ュ瘑鐮�"
+ show-password
+ @keyup.enter="handleLogin"
+ >
+ <template #prefix><el-icon><Lock /></el-icon></template>
+ </el-input>
+ </el-form-item>
+
+ <div class="login-card__options">
+ <el-checkbox v-model="loginForm.rememberMe">璁颁綇璐﹀彿</el-checkbox>
+ <span class="login-card__link" @click="handleForgot">蹇樿瀵嗙爜锛�</span>
+ </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 class="login-card__others">
+ <div class="login-card__divider">
+ <span>鍏朵粬鐧诲綍鏂瑰紡</span>
+ </div>
+ <div class="login-card__wecom" @click="handleWecom">
+ <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true">
+ <path fill="#2C51D9" d="M12 3C7.6 3 4 5.9 4 9.5c0 2 1.1 3.8 2.9 5l-.7 2.1 2.4-1.2c1 .3 2.1.5 3.4.5 4.4 0 8-2.9 8-6.4S16.4 3 12 3z"/>
+ <circle cx="9" cy="9.5" r="1" fill="#fff"/>
+ <circle cx="15" cy="9.5" r="1" fill="#fff"/>
+ </svg>
+ <span>浼佷笟寰俊鐧诲綍</span>
+ </div>
+ </div>
+
+ <p class="login-card__foot">鍋ラ娇绉戞妧 路 鏈嶅姟鍏ㄧ悆</p>
+ </div>
+ </main>
+ </div>
+</template>
+
+<script setup>
+import Cookies from "js-cookie"
+import { encrypt, decrypt } from "@/utils/jsencrypt"
+import useUserStore from '@/store/modules/user'
+import LoginBrand from './login/components/LoginBrand.vue'
+import logo from '@/assets/login/JCCKLogo.png'
+
+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 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
+ })
+ }
+ })
+}
+
+function handleForgot() {
+ proxy.$modal.msg("璇疯仈绯荤郴缁熺鐞嗗憳閲嶇疆瀵嗙爜")
+}
+
+function handleWecom() {
+ proxy.$modal.msg("浼佷笟寰俊鐧诲綍鏆傛湭寮�鏀�")
+}
+
+function getCookie() {
+ const username = Cookies.get("username")
+ const password = Cookies.get("password")
+ const rememberMe = Cookies.get("rememberMe")
+ loginForm.value = {
+ ...loginForm.value,
+ username: username === undefined ? loginForm.value.username : username,
+ password: password === undefined ? loginForm.value.password : decrypt(password),
+ rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
+ }
+}
+
+getCookie()
+</script>
+
+<style lang='scss' scoped>
+.login {
+ display: flex;
+ height: 100%;
+ min-height: 100vh;
+ background: var(--app-bg, #f4f6f9);
+}
+
+.login-panel {
+ flex: 1;
+ min-width: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 24px;
+ background: linear-gradient(180deg, #f6f8fd 0%, #eef2f9 100%);
+}
+
+.login-card {
+ width: 100%;
+ max-width: 400px;
+ padding: 40px 44px 28px;
+ box-sizing: border-box;
+ background: #fff;
+ border-radius: var(--app-radius-lg, 14px);
+ box-shadow: 0 12px 40px rgba(16, 42, 96, 0.08);
+
+ .el-form-item {
+ margin-bottom: 22px;
+ }
+}
+
+.login-card__header {
+ text-align: center;
+ margin-bottom: 30px;
+}
+
+.login-card__logo {
+ height: 40px;
+ object-fit: contain;
+}
+
+.login-card__title {
+ margin: 18px 0 0;
+ font-size: 22px;
+ font-weight: 700;
+ color: var(--app-text, #1d2129);
+ letter-spacing: 2px;
+}
+
+.login-card__subtitle {
+ margin: 8px 0 0;
+ font-size: 13px;
+ color: var(--app-text-tertiary, #86909c);
+}
+
+.login-card__options {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin: -4px 0 20px;
+ font-size: 14px;
+}
+
+.login-card__link {
+ color: var(--app-primary, #2c51d9);
+ font-size: 14px;
+ cursor: pointer;
+ transition: color var(--app-transition, 0.2s);
+
+ &:hover {
+ color: var(--app-primary-hover, #4a6cf0);
+ }
+}
+
+.login-btn {
+ width: 100%;
+ height: 46px;
+ border: none;
+ border-radius: 10px;
+ font-size: 16px;
+ font-weight: 600;
+ letter-spacing: 6px;
+ background: linear-gradient(90deg, #2c51d9 0%, #4a6cf0 100%);
+ box-shadow: 0 8px 20px rgba(44, 81, 217, 0.28);
+ transition: filter var(--app-transition, 0.2s), transform var(--app-transition, 0.2s);
+
+ &:hover,
+ &:focus {
+ filter: brightness(1.08);
+ }
+
+ &:active {
+ transform: translateY(1px);
+ }
+}
+
+.login-card__others {
+ margin-top: 26px;
+}
+
+.login-card__divider {
+ position: relative;
+ text-align: center;
+ font-size: 12px;
+ color: var(--app-text-tertiary, #86909c);
+
+ &::before {
+ content: '';
+ position: absolute;
+ left: 0;
+ right: 0;
+ top: 50%;
+ height: 1px;
+ background: var(--app-border, #e8ecf1);
+ }
+
+ span {
+ position: relative;
+ padding: 0 12px;
+ background: #fff;
+ }
+}
+
+.login-card__wecom {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 8px;
+ margin-top: 18px;
+ font-size: 14px;
+ color: var(--app-text-secondary, #4e5969);
+ cursor: pointer;
+ transition: color var(--app-transition, 0.2s);
+
+ &:hover {
+ color: var(--app-primary, #2c51d9);
+ }
+}
+
+.login-card__foot {
+ margin: 26px 0 0;
+ text-align: center;
+ font-size: 12px;
+ letter-spacing: 4px;
+ color: #b6c0cf;
+}
+
+// 杈撳叆妗嗙粺涓�鏍峰紡
+:deep(.el-input__wrapper) {
+ border-radius: 10px;
+ padding: 5px 14px;
+ box-shadow: 0 0 0 1px var(--app-border, #e8ecf1) inset;
+ transition: box-shadow var(--app-transition, 0.2s);
+
+ &:hover {
+ box-shadow: 0 0 0 1px var(--app-text-tertiary, #86909c) inset;
+ }
+
+ &.is-focus {
+ box-shadow: 0 0 0 1.5px var(--app-primary, #2c51d9) inset;
+ }
+}
+
+@media (max-width: 480px) {
+ .login-panel {
+ padding: 20px 16px;
+ background: #fff;
+ }
+
+ .login-card {
+ padding: 28px 24px 20px;
+ box-shadow: none;
+ }
+}
+</style>
--
Gitblit v1.9.3