更新,登录页功能完善

This commit is contained in:
2026-01-26 09:16:34 +08:00
parent 1134ecb732
commit 42be40ee9f
14 changed files with 1361 additions and 615 deletions

View File

@@ -1,23 +0,0 @@
import request from '../utils/request'
/**
* 获取用户菜单
* @returns {Promise} 菜单数据
*/
export function getUserMenu() {
return request({
url: '/menu',
method: 'get'
})
}
/**
* 获取用户权限
* @returns {Promise} 权限数据
*/
export function getUserPermissions() {
return request({
url: '/permissions',
method: 'get'
})
}

View File

@@ -1,570 +0,0 @@
// 认证页面统一样式文件
// 使用明亮暖色调配色方案
// ===== 颜色变量 =====
$primary-color: #ff6b35; // 橙红色
$primary-light: #ff8a5b; // 浅橙红色
$primary-dark: #e55a2b; // 深橙红色
$secondary-color: #ffd93d; // 金黄色
$accent-color: #ffb84d; // 橙黄色
$bg-dark: #1a1a2e; // 深色背景
$bg-light: #16213e; // 浅色背景
$bg-gradient-start: #0f0f23; // 渐变开始
$bg-gradient-end: #1a1a2e; // 渐变结束
$text-primary: #ffffff;
$text-secondary: rgba(255, 255, 255, 0.7);
$text-muted: rgba(255, 255, 255, 0.5);
$border-color: rgba(255, 255, 255, 0.08);
$border-hover: rgba(255, 107, 53, 0.3);
$border-focus: rgba(255, 107, 53, 0.6);
// ===== 基础容器 =====
.auth-container {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
position: relative;
background: linear-gradient(135deg, $bg-gradient-start 0%, $bg-gradient-end 100%);
overflow: hidden;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
// ===== 科技感背景 =====
.tech-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
pointer-events: none;
// 网格线
.grid-line {
position: absolute;
width: 100%;
height: 1px;
background: linear-gradient(90deg, transparent, rgba(255, 107, 53, 0.08), transparent);
animation: gridMove 8s linear infinite;
&:nth-child(1) { top: 20%; animation-delay: 0s; }
&:nth-child(2) { top: 40%; animation-delay: 2s; }
&:nth-child(3) { top: 60%; animation-delay: 4s; }
&:nth-child(4) { top: 80%; animation-delay: 6s; }
}
// 光点效果
.light-spot {
position: absolute;
width: 4px;
height: 4px;
background: $primary-color;
border-radius: 50%;
box-shadow: 0 0 10px $primary-color, 0 0 20px $primary-color;
animation: float 6s ease-in-out infinite;
&:nth-child(5) { top: 15%; left: 20%; animation-delay: 0s; }
&:nth-child(6) { top: 25%; left: 70%; animation-delay: 2s; }
&:nth-child(7) { top: 55%; left: 15%; animation-delay: 4s; }
&:nth-child(8) { top: 75%; left: 80%; animation-delay: 1s; }
}
}
@keyframes gridMove {
0% { transform: translateX(-100%); }
100% { transform: translateX(100%); }
}
@keyframes float {
0%, 100% { transform: translateY(0) scale(1); opacity: 0.6; }
50% { transform: translateY(-20px) scale(1.2); opacity: 1; }
}
// ===== 主卡片 =====
.auth-wrapper {
width: 100%;
max-width: 960px;
padding: 20px;
position: relative;
z-index: 1;
}
.auth-card {
background: rgba(255, 255, 255, 0.02);
backdrop-filter: blur(24px);
-webkit-backdrop-filter: blur(24px);
border-radius: 28px;
padding: 0;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
border: 1px solid $border-color;
overflow: hidden;
display: flex;
min-height: 580px;
animation: cardFadeIn 0.6s ease-out;
}
@keyframes cardFadeIn {
0% { opacity: 0; transform: translateY(20px); }
100% { opacity: 1; transform: translateY(0); }
}
// ===== 左侧装饰区 =====
.decoration-area {
flex: 1;
background: linear-gradient(135deg, rgba(255, 107, 53, 0.08) 0%, rgba(255, 217, 61, 0.03) 100%);
padding: 60px 40px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
border-right: 1px solid $border-color;
}
.tech-circle {
position: relative;
width: 220px;
height: 220px;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 48px;
.circle-inner {
width: 110px;
height: 110px;
background: linear-gradient(135deg, $primary-color 0%, $primary-light 100%);
border-radius: 50%;
box-shadow: 0 0 50px rgba(255, 107, 53, 0.4);
animation: pulse 3s ease-in-out infinite;
display: flex;
align-items: center;
justify-content: center;
&::after {
content: '';
width: 60px;
height: 60px;
background: linear-gradient(135deg, $secondary-color 0%, $accent-color 100%);
border-radius: 50%;
box-shadow: 0 0 30px rgba(255, 217, 61, 0.5);
}
}
.circle-ring {
position: absolute;
width: 160px;
height: 160px;
border: 2px solid rgba(255, 107, 53, 0.2);
border-radius: 50%;
animation: rotate 12s linear infinite;
&::before {
content: '';
position: absolute;
top: -2px;
left: 50%;
transform: translateX(-50%);
width: 8px;
height: 8px;
background: $primary-color;
border-radius: 50%;
box-shadow: 0 0 15px $primary-color;
}
}
.circle-ring-2 {
width: 200px;
height: 200px;
border: 1px solid rgba(255, 217, 61, 0.15);
animation: rotate 18s linear infinite reverse;
}
}
@keyframes pulse {
0%, 100% { transform: scale(1); opacity: 1; }
50% { transform: scale(1.08); opacity: 0.85; }
}
@keyframes rotate {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.decoration-text {
text-align: center;
h2 {
margin: 0 0 16px;
font-size: 32px;
font-weight: 700;
background: linear-gradient(135deg, $primary-color 0%, $secondary-color 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
letter-spacing: 1px;
}
p {
margin: 0;
color: $text-secondary;
font-size: 16px;
font-weight: 400;
letter-spacing: 0.5px;
}
}
// ===== 右侧表单区 =====
.form-area {
flex: 1.3;
padding: 60px 56px;
}
.auth-header {
margin-bottom: 40px;
h1 {
margin: 0 0 12px;
font-size: 36px;
font-weight: 700;
background: linear-gradient(135deg, $primary-color 0%, $accent-color 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
letter-spacing: 1px;
}
.subtitle {
margin: 0;
color: $text-secondary;
font-size: 15px;
font-weight: 400;
}
}
// ===== 表单样式 =====
.auth-form {
margin-top: 0;
:deep(.ant-form-item) {
margin-bottom: 26px;
}
:deep(.ant-form-item-label > label) {
color: $text-secondary;
font-size: 14px;
font-weight: 500;
}
// 输入框样式
:deep(.ant-input-affix-wrapper),
:deep(.ant-input) {
background: rgba(255, 255, 255, 0.03);
border: 1px solid $border-color;
border-radius: 12px;
color: $text-primary;
padding: 12px 16px;
font-size: 15px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
&:hover {
background: rgba(255, 255, 255, 0.06);
border-color: $border-hover;
}
&:focus,
&.ant-input-affix-wrapper-focused {
background: rgba(255, 255, 255, 0.06);
border-color: $primary-color;
box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}
}
:deep(.ant-input::placeholder) {
color: $text-muted;
}
:deep(.ant-input-affix-wrapper > input.ant-input) {
background: transparent;
}
// 图标样式
:deep(.anticon) {
color: $text-secondary;
font-size: 16px;
transition: color 0.3s;
}
:deep(.ant-input-affix-wrapper-focused .anticon) {
color: $primary-color;
}
}
// ===== 按钮样式 =====
.auth-form :deep(.ant-btn-primary) {
background: linear-gradient(135deg, $primary-color 0%, $primary-light 100%);
border: none;
border-radius: 12px;
height: 48px;
font-weight: 600;
font-size: 16px;
letter-spacing: 0.5px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
&:hover:not(:disabled) {
background: linear-gradient(135deg, $primary-light 0%, $accent-color 100%);
box-shadow: 0 6px 25px rgba(255, 107, 53, 0.4);
transform: translateY(-2px);
}
&:active:not(:disabled) {
transform: translateY(0);
box-shadow: 0 2px 10px rgba(255, 107, 53, 0.3);
}
&:disabled {
background: rgba(255, 255, 255, 0.08);
color: $text-muted;
box-shadow: none;
transform: none;
cursor: not-allowed;
}
}
// ===== 表单选项 =====
.form-options {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 26px;
:deep(.ant-checkbox-wrapper) {
color: $text-primary;
font-size: 14px;
.ant-checkbox {
.ant-checkbox-inner {
border-color: $border-color;
background: rgba(255, 255, 255, 0.03);
}
&.ant-checkbox-checked .ant-checkbox-inner {
background: $primary-color;
border-color: $primary-color;
}
}
}
}
.forgot-password {
color: $primary-color;
text-decoration: none;
font-size: 14px;
font-weight: 500;
transition: all 0.3s;
&:hover {
color: $primary-light;
text-decoration: underline;
}
}
// ===== 验证码输入框 =====
.code-input-wrapper {
display: flex;
gap: 14px;
.code-input {
flex: 1;
}
.code-btn {
width: 150px;
white-space: nowrap;
background: linear-gradient(135deg, $primary-color 0%, $primary-light 100%);
border: none;
border-radius: 12px;
font-weight: 600;
font-size: 14px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
&:hover:not(:disabled) {
background: linear-gradient(135deg, $primary-light 0%, $accent-color 100%);
box-shadow: 0 6px 25px rgba(255, 107, 53, 0.4);
transform: translateY(-2px);
}
&:active:not(:disabled) {
transform: translateY(0);
}
&:disabled {
background: rgba(255, 255, 255, 0.08);
color: $text-muted;
box-shadow: none;
transform: none;
cursor: not-allowed;
}
}
}
// ===== 协议复选框 =====
.agreement-checkbox {
:deep(.ant-checkbox-wrapper) {
color: $text-secondary;
font-size: 13px;
align-items: flex-start;
line-height: 1.6;
.ant-checkbox {
margin-top: 2px;
.ant-checkbox-inner {
border-color: $border-color;
background: rgba(255, 255, 255, 0.03);
}
&.ant-checkbox-checked .ant-checkbox-inner {
background: $primary-color;
border-color: $primary-color;
}
}
}
}
.agreement-text {
font-size: 13px;
line-height: 1.6;
color: $text-secondary;
}
.link {
color: $primary-color;
text-decoration: none;
font-weight: 500;
transition: all 0.3s;
&:hover {
color: $primary-light;
text-decoration: underline;
}
}
// ===== 表单底部 =====
.form-footer {
text-align: center;
margin-top: 28px;
color: $text-secondary;
font-size: 14px;
.auth-link {
color: $primary-color;
text-decoration: none;
font-weight: 600;
margin-left: 6px;
transition: all 0.3s;
&:hover {
color: $primary-light;
text-decoration: underline;
}
}
}
// ===== 响应式设计 =====
@media (max-width: 768px) {
.auth-card {
flex-direction: column;
min-height: auto;
margin: 20px 0;
}
.decoration-area {
padding: 48px 24px;
border-right: none;
border-bottom: 1px solid $border-color;
}
.tech-circle {
width: 160px;
height: 160px;
.circle-inner {
width: 80px;
height: 80px;
&::after {
width: 45px;
height: 45px;
}
}
.circle-ring {
width: 120px;
height: 120px;
}
.circle-ring-2 {
width: 150px;
height: 150px;
}
}
.decoration-text {
h2 {
font-size: 26px;
}
p {
font-size: 14px;
}
}
.form-area {
padding: 48px 32px;
}
.auth-header {
h1 {
font-size: 28px;
}
.subtitle {
font-size: 14px;
}
}
.code-input-wrapper {
flex-direction: column;
gap: 12px;
.code-btn {
width: 100%;
}
}
}
@media (max-width: 480px) {
.auth-wrapper {
padding: 16px;
}
.auth-card {
border-radius: 20px;
}
.form-area {
padding: 36px 24px;
}
.auth-header {
margin-bottom: 32px;
}
}

334
src/assets/style/auth.scss Normal file
View File

@@ -0,0 +1,334 @@
// Auth Pages - Warm Tech Theme
// Warm color palette with tech-inspired design
:root {
--auth-primary: #ff6b35;
--auth-primary-light: #ff8c5a;
--auth-primary-dark: #e55a2b;
--auth-secondary: #ffb347;
--accent-orange: #ffa500;
--accent-coral: #ff7f50;
--accent-amber: #ffc107;
--bg-gradient-start: #fff5f0;
--bg-gradient-end: #ffe8dc;
--card-bg: rgba(255, 255, 255, 0.95);
--text-primary: #2d1810;
--text-secondary: #6b4423;
--text-muted: #a67c52;
--border-color: #ffd4b8;
--shadow-color: rgba(255, 107, 53, 0.15);
--success: #28a745;
--warning: #ffc107;
--error: #dc3545;
--tech-blue: #007bff;
--tech-purple: #6f42c1;
}
.auth-container {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
position: relative;
overflow: hidden;
// Tech pattern background
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image:
radial-gradient(circle at 20% 50%, rgba(255, 107, 53, 0.03) 0%, transparent 50%),
radial-gradient(circle at 80% 20%, rgba(255, 179, 71, 0.05) 0%, transparent 40%),
radial-gradient(circle at 40% 80%, rgba(255, 127, 80, 0.04) 0%, transparent 40%);
pointer-events: none;
}
// Animated tech elements
&::after {
content: '';
position: absolute;
width: 600px;
height: 600px;
background: radial-gradient(circle, rgba(255, 107, 53, 0.08) 0%, transparent 70%);
border-radius: 50%;
top: -200px;
right: -200px;
animation: float 20s ease-in-out infinite;
pointer-events: none;
}
}
@keyframes float {
0%, 100% {
transform: translate(0, 0);
}
50% {
transform: translate(-50px, 50px);
}
}
.auth-card {
width: 100%;
max-width: 440px;
background: var(--card-bg);
backdrop-filter: blur(20px);
border-radius: 24px;
padding: 48px 40px;
box-shadow:
0 20px 60px var(--shadow-color),
0 8px 24px rgba(0, 0, 0, 0.08);
position: relative;
z-index: 1;
margin: 20px;
// Tech accent line
&::before {
content: '';
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 80px;
height: 4px;
background: linear-gradient(90deg, var(--auth-primary), var(--auth-secondary));
border-radius: 0 0 4px 4px;
}
}
.auth-header {
text-align: center;
margin-bottom: 40px;
.auth-title {
font-size: 28px;
font-weight: 700;
color: var(--text-primary);
margin-bottom: 8px;
background: linear-gradient(135deg, var(--auth-primary-dark), var(--auth-primary));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.auth-subtitle {
font-size: 14px;
color: var(--text-secondary);
line-height: 1.6;
}
}
.auth-form {
.el-form-item {
margin-bottom: 24px;
}
.el-input {
--el-input-border-radius: 12px;
--el-input-border-color: var(--border-color);
--el-input-hover-border-color: var(--auth-primary-light);
--el-input-focus-border-color: var(--auth-primary);
.el-input__wrapper {
padding: 12px 16px;
box-shadow: 0 2px 8px rgba(255, 107, 53, 0.08);
transition: all 0.3s ease;
&.is-focus {
box-shadow: 0 4px 16px rgba(255, 107, 53, 0.15);
}
}
.el-input__inner {
font-size: 14px;
color: var(--text-primary);
}
}
.el-input__prefix {
color: var(--auth-primary);
font-size: 18px;
}
.el-input__suffix {
color: var(--text-muted);
}
.el-button {
--el-button-border-radius: 12px;
height: 48px;
font-size: 16px;
font-weight: 600;
&.el-button--primary {
background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-dark));
border: none;
box-shadow: 0 8px 24px rgba(255, 107, 53, 0.35);
transition: all 0.3s ease;
&:hover {
background: linear-gradient(135deg, var(--auth-primary-light), var(--auth-primary));
transform: translateY(-2px);
box-shadow: 0 12px 32px rgba(255, 107, 53, 0.45);
}
&:active {
transform: translateY(0);
}
}
}
}
.auth-links {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
.remember-me {
.el-checkbox__label {
color: var(--text-secondary);
font-size: 14px;
}
}
.forgot-password {
color: var(--auth-primary);
font-size: 14px;
text-decoration: none;
transition: color 0.3s ease;
&:hover {
color: var(--auth-primary-dark);
}
}
}
.auth-divider {
display: flex;
align-items: center;
margin: 32px 0;
color: var(--text-muted);
font-size: 13px;
&::before,
&::after {
content: '';
flex: 1;
height: 1px;
background: var(--border-color);
}
span {
padding: 0 16px;
}
}
.auth-footer {
text-align: center;
margin-top: 24px;
.auth-footer-text {
color: var(--text-secondary);
font-size: 14px;
.auth-link {
color: var(--auth-primary);
text-decoration: none;
font-weight: 600;
margin-left: 4px;
transition: color 0.3s ease;
&:hover {
color: var(--auth-primary-dark);
}
}
}
}
.tech-decoration {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
pointer-events: none;
overflow: hidden;
.tech-circle {
position: absolute;
border: 2px solid rgba(255, 107, 53, 0.1);
border-radius: 50%;
animation: pulse 4s ease-in-out infinite;
}
.tech-circle:nth-child(1) {
width: 300px;
height: 300px;
top: -150px;
left: -150px;
animation-delay: 0s;
}
.tech-circle:nth-child(2) {
width: 200px;
height: 200px;
bottom: -100px;
right: -100px;
animation-delay: 1s;
}
.tech-circle:nth-child(3) {
width: 150px;
height: 150px;
bottom: 20%;
left: -75px;
animation-delay: 2s;
}
}
@keyframes pulse {
0%, 100% {
opacity: 0.3;
transform: scale(1);
}
50% {
opacity: 0.6;
transform: scale(1.05);
}
}
// Responsive design
@media (max-width: 768px) {
.auth-card {
padding: 40px 24px;
margin: 16px;
}
.auth-header {
.auth-title {
font-size: 24px;
}
}
}
// Element Plus customizations for auth pages
.el-form-item__error {
color: var(--error);
font-size: 12px;
}
.el-message {
--el-message-bg: rgba(255, 255, 255, 0.98);
--el-message-border-color: var(--border-color);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

View File

@@ -5,11 +5,11 @@ export default {
install(app) {
for (let icon in AIcons) {
app.component(`${icon}`, AIcons[icon])
app.component(`A${icon}`, AIcons[icon])
}
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(`El${key}`, component)
app.component(`${key}`, component)
}
}
}

View File

@@ -3,7 +3,7 @@ export default {
DASHBOARD_URL: '/dashboard',
// 白名单路由(不需要登录即可访问)
whiteList: ['/login', '/register', '/reset-password'],
whiteList: ['/login', '/register', '/forgot-password'],
//版本号
APP_VER: '1.6.6',

1
src/layouts/index.vue Normal file
View File

@@ -0,0 +1 @@
<template></template>

233
src/layouts/other/404.vue Normal file
View File

@@ -0,0 +1,233 @@
<template>
<div class="not-found-container">
<div class="tech-decoration">
<div class="tech-circle"></div>
<div class="tech-circle"></div>
<div class="tech-circle"></div>
</div>
<div class="not-found-content">
<div class="error-code">404</div>
<div class="error-title">页面未找到</div>
<div class="error-description">
抱歉您访问的页面不存在或已被移除
</div>
<div class="action-buttons">
<el-button type="primary" size="large" @click="goBack">
<el-icon>
<ArrowLeft />
</el-icon>
返回上一页
</el-button>
<el-button size="large" @click="goHome">
<el-icon>
<HomeFilled />
</el-icon>
返回首页
</el-button>
</div>
</div>
</div>
</template>
<script setup>
import { useRouter } from 'vue-router'
import { ArrowLeft, HomeFilled } from '@element-plus/icons-vue'
import '@/assets/style/auth.scss'
const router = useRouter()
// Go back to previous page
const goBack = () => {
router.back()
}
// Go to home page
const goHome = () => {
router.push('/')
}
</script>
<style scoped lang="scss">
@import '@/assets/style/auth.scss';
.not-found-container {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
position: relative;
overflow: hidden;
.tech-decoration {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
pointer-events: none;
overflow: hidden;
.tech-circle {
position: absolute;
border: 2px solid rgba(255, 107, 53, 0.1);
border-radius: 50%;
animation: pulse 4s ease-in-out infinite;
}
.tech-circle:nth-child(1) {
width: 300px;
height: 300px;
top: -150px;
left: -150px;
animation-delay: 0s;
}
.tech-circle:nth-child(2) {
width: 200px;
height: 200px;
bottom: -100px;
right: -100px;
animation-delay: 1s;
}
.tech-circle:nth-child(3) {
width: 150px;
height: 150px;
bottom: 20%;
left: -75px;
animation-delay: 2s;
}
}
}
@keyframes pulse {
0%,
100% {
opacity: 0.3;
transform: scale(1);
}
50% {
opacity: 0.6;
transform: scale(1.05);
}
}
.not-found-content {
text-align: center;
padding: 40px;
position: relative;
z-index: 1;
.error-code {
font-size: 120px;
font-weight: 700;
background: linear-gradient(135deg, var(--auth-primary-dark), var(--auth-primary));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 20px;
line-height: 1;
animation: float 3s ease-in-out infinite;
}
@keyframes float {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-10px);
}
}
.error-title {
font-size: 32px;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 16px;
}
.error-description {
font-size: 16px;
color: var(--text-secondary);
margin-bottom: 40px;
line-height: 1.6;
}
.action-buttons {
display: flex;
gap: 16px;
justify-content: center;
flex-wrap: wrap;
.el-button {
--el-button-border-radius: 12px;
height: 48px;
padding: 0 32px;
font-size: 16px;
font-weight: 600;
&.el-button--primary {
background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-dark));
border: none;
box-shadow: 0 8px 24px rgba(255, 107, 53, 0.35);
transition: all 0.3s ease;
&:hover {
background: linear-gradient(135deg, var(--auth-primary-light), var(--auth-primary));
transform: translateY(-2px);
box-shadow: 0 12px 32px rgba(255, 107, 53, 0.45);
}
}
&:not(.el-button--primary) {
background: rgba(255, 255, 255, 0.9);
border: 2px solid var(--border-color);
color: var(--text-secondary);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
transition: all 0.3s ease;
&:hover {
border-color: var(--auth-primary);
color: var(--auth-primary);
transform: translateY(-2px);
box-shadow: 0 8px 20px rgba(255, 107, 53, 0.15);
}
}
}
}
}
// Responsive design
@media (max-width: 768px) {
.not-found-content {
padding: 20px;
.error-code {
font-size: 80px;
}
.error-title {
font-size: 24px;
}
.error-description {
font-size: 14px;
}
.action-buttons {
.el-button {
width: 100%;
max-width: 200px;
}
}
}
}
</style>

211
src/layouts/other/empty.vue Normal file
View File

@@ -0,0 +1,211 @@
<template>
<div class="empty-container">
<div class="tech-decoration">
<div class="tech-circle"></div>
<div class="tech-circle"></div>
<div class="tech-circle"></div>
</div>
<div class="empty-content">
<div class="empty-icon">
<el-icon :size="120" color="#ff6b35">
<Box />
</el-icon>
</div>
<div class="empty-title">暂无数据</div>
<div class="empty-description">
{{ description || '当前页面暂无数据,请稍后再试' }}
</div>
<el-button v-if="showButton" type="primary" size="large" @click="handleAction">
<el-icon v-if="buttonIcon">
<component :is="buttonIcon" />
</el-icon>
{{ buttonText || '刷新页面' }}
</el-button>
</div>
</div>
</template>
<script setup>
import { Box } from '@element-plus/icons-vue'
import '@/assets/style/auth.scss'
defineProps({
description: {
type: String,
default: '当前页面暂无数据,请稍后再试'
},
showButton: {
type: Boolean,
default: true
},
buttonText: {
type: String,
default: '刷新页面'
},
buttonIcon: {
type: [String, Object],
default: null
}
})
const emit = defineEmits(['action'])
const handleAction = () => {
emit('action')
}
</script>
<style scoped lang="scss">
@import '@/assets/style/auth.scss';
.empty-container {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
position: relative;
overflow: hidden;
.tech-decoration {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
pointer-events: none;
overflow: hidden;
.tech-circle {
position: absolute;
border: 2px solid rgba(255, 107, 53, 0.1);
border-radius: 50%;
animation: pulse 4s ease-in-out infinite;
}
.tech-circle:nth-child(1) {
width: 300px;
height: 300px;
top: -150px;
left: -150px;
animation-delay: 0s;
}
.tech-circle:nth-child(2) {
width: 200px;
height: 200px;
bottom: -100px;
right: -100px;
animation-delay: 1s;
}
.tech-circle:nth-child(3) {
width: 150px;
height: 150px;
bottom: 20%;
left: -75px;
animation-delay: 2s;
}
}
}
@keyframes pulse {
0%,
100% {
opacity: 0.3;
transform: scale(1);
}
50% {
opacity: 0.6;
transform: scale(1.05);
}
}
.empty-content {
text-align: center;
padding: 40px;
position: relative;
z-index: 1;
.empty-icon {
margin-bottom: 32px;
animation: float 3s ease-in-out infinite;
}
@keyframes float {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-10px);
}
}
.empty-title {
font-size: 28px;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 16px;
}
.empty-description {
font-size: 16px;
color: var(--text-secondary);
margin-bottom: 40px;
line-height: 1.6;
max-width: 400px;
}
.el-button {
--el-button-border-radius: 12px;
height: 48px;
padding: 0 40px;
font-size: 16px;
font-weight: 600;
background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-dark));
border: none;
box-shadow: 0 8px 24px rgba(255, 107, 53, 0.35);
transition: all 0.3s ease;
&:hover {
background: linear-gradient(135deg, var(--auth-primary-light), var(--auth-primary));
transform: translateY(-2px);
box-shadow: 0 12px 32px rgba(255, 107, 53, 0.45);
}
}
}
// Responsive design
@media (max-width: 768px) {
.empty-content {
padding: 20px;
.empty-icon {
:deep(.el-icon) {
font-size: 80px;
}
}
.empty-title {
font-size: 24px;
}
.empty-description {
font-size: 14px;
}
.el-button {
width: 100%;
max-width: 200px;
}
}
}
</style>

View File

@@ -1,7 +1,7 @@
import { createApp } from 'vue'
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/reset.css'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import '@/assets/style/app.scss'
import App from './App.vue'
import router from './router'
@@ -11,7 +11,7 @@ import boot from './boot'
const app = createApp(App)
app.use(Antd)
app.use(ElementPlus)
app.use(router)
app.use(pinia)
app.use(i18n)

View File

@@ -0,0 +1,167 @@
<template>
<div class="auth-container">
<div class="tech-decoration">
<div class="tech-circle"></div>
<div class="tech-circle"></div>
<div class="tech-circle"></div>
</div>
<div class="auth-card">
<div class="auth-header">
<h1 class="auth-title">找回密码</h1>
<p class="auth-subtitle">输入您的邮箱我们将发送重置密码链接</p>
</div>
<el-form ref="forgotFormRef" :model="forgotForm" :rules="forgotRules" class="auth-form"
@submit.prevent="handleSubmit">
<el-form-item prop="email">
<el-input v-model="forgotForm.email" placeholder="请输入注册邮箱" size="large" clearable
@keyup.enter="handleSubmit">
<template #prefix>
<el-icon>
<Message />
</el-icon>
</template>
</el-input>
</el-form-item>
<el-form-item prop="captcha" v-if="showCaptcha">
<div style="display: flex; gap: 12px">
<el-input v-model="forgotForm.captcha" placeholder="请输入验证码" size="large" style="flex: 1">
<template #prefix>
<el-icon>
<Key />
</el-icon>
</template>
</el-input>
<el-button type="info" size="large" :disabled="captchaDisabled" @click="sendCaptcha">
{{ captchaButtonText }}
</el-button>
</div>
</el-form-item>
<el-button type="primary" :loading="loading" size="large" style="width: 100%" @click="handleSubmit">
{{ loading ? '提交中...' : '发送重置链接' }}
</el-button>
</el-form>
<div class="auth-footer">
<p class="auth-footer-text">
想起密码了
<router-link to="/login" class="auth-link">
返回登录
</router-link>
</p>
</div>
</div>
</div>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import '@/assets/style/auth.scss'
const router = useRouter()
const forgotFormRef = ref(null)
const loading = ref(false)
const showCaptcha = ref(false)
const captchaDisabled = ref(false)
const countdown = ref(60)
// Forgot password form data
const forgotForm = reactive({
email: '',
captcha: ''
})
// Captcha button text
const captchaButtonText = ref('获取验证码')
// Form validation rules
const forgotRules = {
email: [
{ required: true, message: '请输入邮箱地址', trigger: 'blur' },
{ type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur' }
],
captcha: [
{ required: true, message: '请输入验证码', trigger: 'blur' },
{ len: 6, message: '验证码为6位数字', trigger: 'blur' }
]
}
// Send captcha code
const sendCaptcha = async () => {
if (!forgotForm.email) {
ElMessage.warning('请先输入邮箱地址')
return
}
// Validate email format
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
if (!emailRegex.test(forgotForm.email)) {
ElMessage.warning('请输入正确的邮箱地址')
return
}
try {
// Simulate API call - Replace with actual API call
// Example: const response = await sendCaptchaApi(forgotForm.email)
await new Promise(resolve => setTimeout(resolve, 500))
ElMessage.success('验证码已发送至您的邮箱')
// Start countdown
captchaDisabled.value = true
const timer = setInterval(() => {
countdown.value--
captchaButtonText.value = `${countdown.value}秒后重试`
if (countdown.value <= 0) {
clearInterval(timer)
captchaDisabled.value = false
captchaButtonText.value = '获取验证码'
countdown.value = 60
}
}, 1000)
showCaptcha.value = true
} catch (error) {
console.error('Send captcha failed:', error)
ElMessage.error('发送验证码失败,请稍后重试')
}
}
// Handle submit
const handleSubmit = async () => {
if (!forgotFormRef.value) return
try {
await forgotFormRef.value.validate()
loading.value = true
// Simulate API call - Replace with actual API call
// Example: const response = await forgotPasswordApi(forgotForm)
// Simulated delay
await new Promise(resolve => setTimeout(resolve, 1500))
// Success message
ElMessage.success('密码重置链接已发送至您的邮箱,请注意查收')
// Redirect to login page
setTimeout(() => {
router.push('/login')
}, 2000)
} catch (error) {
console.error('Forgot password failed:', error)
ElMessage.error('提交失败,请检查邮箱地址和验证码')
} finally {
loading.value = false
}
}
</script>

View File

@@ -0,0 +1,212 @@
<template>
<div class="auth-container">
<div class="tech-decoration">
<div class="tech-circle"></div>
<div class="tech-circle"></div>
<div class="tech-circle"></div>
</div>
<div class="auth-card">
<div class="auth-header">
<h1 class="auth-title">欢迎回来</h1>
<p class="auth-subtitle">登录您的账户继续探索科技世界</p>
</div>
<el-form ref="loginFormRef" :model="loginForm" :rules="loginRules" class="auth-form"
@submit.prevent="handleLogin">
<el-form-item prop="username">
<el-input v-model="loginForm.username" placeholder="请输入用户名/邮箱" size="large" clearable>
<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" placeholder="请输入密码" size="large" clearable
show-password @keyup.enter="handleLogin">
<template #prefix>
<el-icon>
<Lock />
</el-icon>
</template>
</el-input>
</el-form-item>
<div class="auth-links">
<el-checkbox v-model="loginForm.rememberMe" class="remember-me">
记住我
</el-checkbox>
<router-link to="/forgot-password" class="forgot-password">
忘记密码
</router-link>
</div>
<el-button type="primary" :loading="loading" size="large" style="width: 100%" @click="handleLogin">
{{ loading ? '登录中...' : '登录' }}
</el-button>
</el-form>
<div class="auth-footer">
<p class="auth-footer-text">
还没有账户
<router-link to="/register" class="auth-link">
立即注册
</router-link>
</p>
</div>
</div>
</div>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { defineOptions } from 'vue'
defineOptions({
name: 'LoginPage'
})
import { useRouter, useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import { useUserStore } from '@/stores/modules/user'
import auth from '@/api/auth'
import config from '@/config'
import tool from '@/utils/tool'
import system from '@/api/system'
import '@/assets/style/auth.scss'
const router = useRouter()
const route = useRoute()
const loginFormRef = ref(null)
const loading = ref(false)
const userStore = useUserStore()
// Login form data
const loginForm = reactive({
username: '',
password: '',
rememberMe: false
})
// Form validation rules
const loginRules = {
username: [
{ required: true, message: '请输入用户名或邮箱', trigger: 'blur' },
{ min: 3, max: 50, message: '长度在 3 到 50 个字符', trigger: 'blur' }
],
password: [
{ required: true, message: '请输入密码', trigger: 'blur' },
{ min: 6, message: '密码长度不能少于 6 位', trigger: 'blur' }
]
}
// Handle login
const handleLogin = async () => {
if (!loginFormRef.value) return
try {
// Validate form
await loginFormRef.value.validate()
loading.value = true
// 1. Call login API
const loginResponse = await auth.login.post({
username: loginForm.username,
password: loginForm.password
})
// Check if login was successful
if (!loginResponse || !loginResponse.data) {
throw new Error('登录响应数据异常')
}
const loginData = loginResponse.data
// 2. Store access_token persistently
if (loginData.access_token) {
userStore.setToken(loginData.access_token)
}
// Store refresh token if available
if (loginData.refresh_token) {
userStore.setRefreshToken(loginData.refresh_token)
}
// 3. Get user information after login
const userResponse = await auth.user.get()
if (userResponse && userResponse.data) {
userStore.setUserInfo(userResponse.data)
}
// 4. Get authorized menu information
const menuResponse = await auth.menu.my.get()
if (menuResponse && menuResponse.data) {
userStore.setMenu(menuResponse.data)
}
// 5. Cache system configuration data
try {
const settingResponse = await system.setting.list.get()
if (settingResponse && settingResponse.data) {
tool.data.set('system_setting', settingResponse.data)
}
} catch (error) {
console.error('Failed to cache system settings:', error)
}
// 6. Cache dictionary data
try {
const dictResponse = await system.dictionary.list.get()
if (dictResponse && dictResponse.data) {
tool.data.set('system_dictionary', dictResponse.data)
}
} catch (error) {
console.error('Failed to cache dictionary data:', error)
}
// 7. Cache area data
try {
const areaResponse = await system.area.list.get()
if (areaResponse && areaResponse.data) {
tool.data.set('system_area', areaResponse.data)
}
} catch (error) {
console.error('Failed to cache area data:', error)
}
// Success message
ElMessage.success('登录成功!')
// 5. Redirect to dashboard or redirect parameter
setTimeout(() => {
// Get redirect from query parameter
const redirect = route.query.redirect
if (redirect) {
// If there's a redirect parameter, go there
router.push(redirect)
} else {
// Otherwise, go to configured dashboard URL
router.push(config.DASHBOARD_URL)
}
}, 500)
} catch (error) {
console.error('Login failed:', error)
// Clear user data on login failure
userStore.logout()
// Show error message
const errorMsg = error.response?.data?.message || error.message || '登录失败,请检查用户名和密码'
ElMessage.error(errorMsg)
} finally {
loading.value = false
}
}
</script>

View File

@@ -0,0 +1,181 @@
<template>
<div class="auth-container">
<div class="tech-decoration">
<div class="tech-circle"></div>
<div class="tech-circle"></div>
<div class="tech-circle"></div>
</div>
<div class="auth-card">
<div class="auth-header">
<h1 class="auth-title">创建账户</h1>
<p class="auth-subtitle">加入我们开启科技之旅</p>
</div>
<el-form ref="registerFormRef" :model="registerForm" :rules="registerRules" class="auth-form"
@submit.prevent="handleRegister">
<el-form-item prop="username">
<el-input v-model="registerForm.username" placeholder="请输入用户名" size="large" clearable>
<template #prefix>
<el-icon>
<User />
</el-icon>
</template>
</el-input>
</el-form-item>
<el-form-item prop="email">
<el-input v-model="registerForm.email" placeholder="请输入邮箱地址" size="large" clearable>
<template #prefix>
<el-icon>
<Message />
</el-icon>
</template>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="registerForm.password" type="password" placeholder="请输入密码至少6位" size="large"
show-password>
<template #prefix>
<el-icon>
<Lock />
</el-icon>
</template>
</el-input>
</el-form-item>
<el-form-item prop="confirmPassword">
<el-input v-model="registerForm.confirmPassword" type="password" placeholder="请再次输入密码" size="large"
show-password @keyup.enter="handleRegister">
<template #prefix>
<el-icon>
<Lock />
</el-icon>
</template>
</el-input>
</el-form-item>
<el-form-item prop="agreeTerms">
<el-checkbox v-model="registerForm.agreeTerms" class="remember-me">
我已阅读并同意
<a href="#" class="auth-link">服务条款</a>
<a href="#" class="auth-link">隐私政策</a>
</el-checkbox>
</el-form-item>
<el-button type="primary" :loading="loading" size="large" style="width: 100%" @click="handleRegister">
{{ loading ? '注册中...' : '注册' }}
</el-button>
</el-form>
<div class="auth-footer">
<p class="auth-footer-text">
已有账户
<router-link to="/login" class="auth-link">
立即登录
</router-link>
</p>
</div>
</div>
</div>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import '@/assets/style/auth.scss'
const router = useRouter()
const registerFormRef = ref(null)
const loading = ref(false)
// Register form data
const registerForm = reactive({
username: '',
email: '',
password: '',
confirmPassword: '',
agreeTerms: false
})
// Custom password validation
const validatePassword = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入密码'))
} else if (value.length < 6) {
callback(new Error('密码长度不能少于 6 位'))
} else {
callback()
}
}
// Custom confirm password validation
const validateConfirmPassword = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入密码'))
} else if (value !== registerForm.password) {
callback(new Error('两次输入的密码不一致'))
} else {
callback()
}
}
// Form validation rules
const registerRules = {
username: [
{ required: true, message: '请输入用户名', trigger: 'blur' },
{ min: 3, max: 20, message: '长度在 3 到 20 个字符', trigger: 'blur' }
],
email: [
{ required: true, message: '请输入邮箱地址', trigger: 'blur' },
{ type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur' }
],
password: [
{ required: true, validator: validatePassword, trigger: 'blur' }
],
confirmPassword: [
{ required: true, validator: validateConfirmPassword, trigger: 'blur' }
],
agreeTerms: [
{
type: 'enum',
enum: [true],
message: '请阅读并同意服务条款和隐私政策',
trigger: 'change'
}
]
}
// Handle register
const handleRegister = async () => {
if (!registerFormRef.value) return
try {
await registerFormRef.value.validate()
loading.value = true
// Simulate API call - Replace with actual API call
// Example: const response = await registerApi(registerForm)
// Simulated delay
await new Promise(resolve => setTimeout(resolve, 1500))
// Success message
ElMessage.success('注册成功!正在跳转到登录页面...')
// Redirect to login page
setTimeout(() => {
router.push('/login')
}, 1500)
} catch (error) {
console.error('Register failed:', error)
ElMessage.error('注册失败,请稍后重试')
} finally {
loading.value = false
}
}
</script>

View File

@@ -7,27 +7,27 @@ const systemRoutes = [
{
path: '/login',
name: 'Login',
component: () => import('../pages/login/index.vue'),
component: () => import('../pages/ucenter/login/index.vue'),
meta: {
title: 'login',
title: '登录',
hidden: true,
},
},
{
path: '/register',
name: 'Register',
component: () => import('../pages/login/userRegister.vue'),
component: () => import('../pages/ucenter/register/index.vue'),
meta: {
title: 'register',
title: '注册',
hidden: true,
},
},
{
path: '/reset-password',
name: 'ResetPassword',
component: () => import('../pages/login/resetPassword.vue'),
path: '/forgot-password',
name: 'ForgotPassword',
component: () => import('../pages/ucenter/forgot-password/index.vue'),
meta: {
title: 'resetPassword',
title: '找回密码',
hidden: true,
},
},

View File

@@ -1,7 +1,7 @@
import axios from 'axios'
import config from '@/config'
import { useUserStore } from '@/stores/modules/user'
import { message } from 'ant-design-vue'
import { ElMessage } from 'element-plus'
import router from '@/router'
const http = axios.create({
@@ -45,7 +45,7 @@ http.interceptors.response.use(
}
// 其他错误码处理
message.error(message || '请求失败')
ElMessage.error(message || '请求失败')
return Promise.reject(new Error(message || '请求失败'))
},
async (error) => {
@@ -54,7 +54,7 @@ http.interceptors.response.use(
// 无响应(网络错误、超时等)
if (!response) {
message.error('网络错误,请检查网络连接')
ElMessage.error('网络错误,请检查网络连接')
return Promise.reject(error)
}
@@ -95,7 +95,7 @@ http.interceptors.response.use(
requests = []
userStore.logout()
router.push('/login')
message.error('登录已过期,请重新登录')
ElMessage.error('登录已过期,请重新登录')
return Promise.reject(refreshError)
} finally {
isRefreshing = false
@@ -104,25 +104,25 @@ http.interceptors.response.use(
// 403 禁止访问
if (status === 403) {
message.error('没有权限访问该资源')
ElMessage.error('没有权限访问该资源')
return Promise.reject(error)
}
// 404 资源不存在
if (status === 404) {
message.error('请求的资源不存在')
ElMessage.error('请求的资源不存在')
return Promise.reject(error)
}
// 500 服务器错误
if (status >= 500) {
message.error('服务器错误,请稍后重试')
ElMessage.error('服务器错误,请稍后重试')
return Promise.reject(error)
}
// 其他错误
const errorMessage = data?.message || error.message || '请求失败'
message.error(errorMessage)
ElMessage.error(errorMessage)
return Promise.reject(error)
}
)