后台管理系统优化

This commit is contained in:
2025-12-27 16:45:38 +08:00
parent a4e2542b23
commit 464386efe0
14 changed files with 542 additions and 57 deletions
+5 -5
View File
@@ -498,7 +498,7 @@ const updateUserChart = () => {
.page-title {
margin: 0;
font-size: 24px;
color: #333;
color: var(--ls-text);
}
.dashboard-actions {
@@ -535,13 +535,13 @@ const updateUserChart = () => {
.stat-value {
font-size: 28px;
font-weight: bold;
color: #333;
color: var(--ls-text);
margin-bottom: 5px;
}
.stat-label {
font-size: 14px;
color: #999;
color: rgba(226, 232, 240, 0.65);
}
}
}
@@ -563,7 +563,7 @@ const updateUserChart = () => {
.nickname {
font-size: 14px;
font-weight: 500;
color: #333;
color: rgba(226, 232, 240, 0.9);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -571,7 +571,7 @@ const updateUserChart = () => {
.username {
font-size: 12px;
color: #999;
color: rgba(226, 232, 240, 0.6);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+25 -7
View File
@@ -93,15 +93,33 @@ const handleLogin = async () => {
justify-content: center;
align-items: center;
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
background: var(--ls-bg);
position: relative;
overflow: hidden;
}
.login-container::before {
content: '';
position: absolute;
inset: -20%;
background:
radial-gradient(700px 500px at 20% 30%, rgba(255, 171, 145, 0.18), transparent 55%),
radial-gradient(650px 500px at 80% 20%, rgba(129, 212, 250, 0.14), transparent 55%),
radial-gradient(800px 600px at 60% 80%, rgba(255, 171, 145, 0.10), transparent 55%);
filter: blur(0px);
pointer-events: none;
}
.login-box {
width: 400px;
padding: 40px;
background: #fff;
border-radius: 10px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
background: var(--ls-glass-bg);
border: 1px solid var(--ls-glass-border);
border-radius: var(--ls-radius-xl);
box-shadow: var(--ls-shadow);
backdrop-filter: blur(25px) saturate(180%);
-webkit-backdrop-filter: blur(25px) saturate(180%);
position: relative;
}
.login-header {
@@ -110,13 +128,13 @@ const handleLogin = async () => {
h2 {
font-size: 24px;
color: #333;
color: var(--ls-text);
margin-bottom: 10px;
}
p {
font-size: 14px;
color: #999;
color: rgba(226, 232, 240, 0.7);
}
}
@@ -132,7 +150,7 @@ const handleLogin = async () => {
p {
font-size: 12px;
color: #999;
color: rgba(226, 232, 240, 0.6);
}
}
</style>
+3 -3
View File
@@ -24,20 +24,20 @@ const goHome = () => {
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #f0f2f5;
background-color: var(--ls-bg);
.content {
text-align: center;
h1 {
font-size: 120px;
color: #409eff;
color: var(--ls-accent-orange);
margin-bottom: 20px;
}
p {
font-size: 24px;
color: #666;
color: rgba(226, 232, 240, 0.75);
margin-bottom: 30px;
}
}
+1 -1
View File
@@ -296,7 +296,7 @@ onMounted(() => {
.page-title {
margin-bottom: 20px;
font-size: 24px;
color: #333;
color: var(--ls-text);
}
.search-card {
@@ -1581,7 +1581,7 @@ onMounted(() => {
.page-title {
margin-bottom: 20px;
font-size: 24px;
color: #333;
color: var(--ls-text);
}
.search-card {
@@ -1614,8 +1614,9 @@ onMounted(() => {
.stats-row {
margin-bottom: 20px;
padding: 20px;
background: #f8f9fa;
border-radius: 8px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: var(--ls-radius-lg);
}
.pagination {
@@ -1627,7 +1628,7 @@ onMounted(() => {
.form-tip {
margin-left: 10px;
font-size: 12px;
color: #999;
color: rgba(226, 232, 240, 0.6);
}
}
@@ -1635,8 +1636,8 @@ onMounted(() => {
.test-section {
h4 {
margin-bottom: 20px;
color: #333;
border-bottom: 2px solid #409eff;
color: var(--ls-text);
border-bottom: 2px solid rgba(255, 171, 145, 0.6);
padding-bottom: 8px;
}
@@ -1646,7 +1647,7 @@ onMounted(() => {
gap: 8px;
.info-icon {
color: #909399;
color: rgba(226, 232, 240, 0.6);
cursor: help;
}
}
@@ -69,7 +69,7 @@
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue'
import { ref, reactive, onMounted, computed, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { useRouter, useRoute } from 'vue-router'
import { getDictionaryById, createDictionary, updateDictionary } from '@/api/dictionary'
@@ -81,7 +81,10 @@ const route = useRoute()
const formRef = ref()
const submitting = ref(false)
const form = reactive<DictionaryCreateRequest | DictionaryUpdateRequest>({
/**
* 创建/编辑表单默认值
*/
const DEFAULT_FORM: DictionaryCreateRequest = {
dictType: '',
dictCode: '',
dictName: '',
@@ -89,7 +92,14 @@ const form = reactive<DictionaryCreateRequest | DictionaryUpdateRequest>({
sortOrder: 0,
status: 1,
remarks: ''
})
}
/**
* 字典表单数据
* - 创建模式:DictionaryCreateRequest
* - 编辑模式:DictionaryUpdateRequest(后端会要求 id
*/
const form = reactive<DictionaryCreateRequest | DictionaryUpdateRequest>({ ...DEFAULT_FORM })
const rules = {
dictType: [
@@ -122,6 +132,14 @@ const fetchDetail = async () => {
}
}
/**
* 重置表单(用于从编辑切换到创建时清空旧数据)
*/
const resetFormToDefault = () => {
Object.assign(form, { ...DEFAULT_FORM })
formRef.value?.clearValidate?.()
}
const handleSubmit = async () => {
if (!formRef.value) return
@@ -156,6 +174,22 @@ onMounted(() => {
fetchDetail()
}
})
/**
* 监听路由模式切换:
* - edit -> create:清空表单,避免复用组件实例导致“新增页带出旧数据”
* - create -> edit:拉取详情
*/
watch(
() => route.params.id,
async (id) => {
if (id) {
await fetchDetail()
} else {
resetFormToDefault()
}
}
)
</script>
<style scoped lang="scss">
@@ -163,7 +197,7 @@ onMounted(() => {
.page-title {
margin-bottom: 20px;
font-size: 24px;
color: #333;
color: var(--ls-text);
}
.el-card {
@@ -99,9 +99,17 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useRouter } from 'vue-router'
import { getDictionaryPage, deleteDictionary, updateDictionary } from '@/api/dictionary'
import type { Dictionary, DictionaryPageRequest } from '@/types/dictionary'
/**
* 字典列表页
* - 负责查询/展示/跳转新增与编辑
* - 注意:项目使用 history 路由模式,禁止使用 window.location.hash 跳转
*/
const router = useRouter()
const loading = ref(false)
const detailVisible = ref(false)
const currentDictionary = ref<Dictionary | null>(null)
@@ -156,13 +164,17 @@ const handleReset = () => {
}
const handleCreate = () => {
// 跳转到创建页面
window.location.hash = '#/dictionary/create'
/**
* 跳转到创建页面(history 模式)
*/
router.push('/dictionary/create')
}
const handleEdit = (row: Dictionary) => {
// 跳转到编辑页面
window.location.hash = `#/dictionary/edit/${row.id}`
/**
* 跳转到编辑页面(history 模式)
*/
router.push(`/dictionary/edit/${row.id}`)
}
const handleView = (row: Dictionary) => {
@@ -222,7 +234,7 @@ onMounted(() => {
.page-title {
margin-bottom: 20px;
font-size: 24px;
color: #333;
color: var(--ls-text);
}
.search-card {
+6 -4
View File
@@ -588,7 +588,7 @@ initHistory()
.page-title {
margin-bottom: 20px;
font-size: 24px;
color: #333;
color: var(--ls-text);
}
.request-card,
@@ -610,7 +610,7 @@ initHistory()
margin-bottom: 10px;
.params-tip {
color: #909399;
color: rgba(226, 232, 240, 0.6);
font-size: 12px;
}
@@ -642,8 +642,9 @@ initHistory()
.response-body {
max-height: 500px;
overflow: auto;
background-color: #f5f7fa;
border-radius: 4px;
background: rgba(0, 0, 0, 0.2);
border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: var(--ls-radius-md);
padding: 10px;
}
@@ -654,6 +655,7 @@ initHistory()
line-height: 1.5;
white-space: pre-wrap;
word-break: break-all;
color: rgba(226, 232, 240, 0.9);
}
}
</style>
+1 -1
View File
@@ -190,7 +190,7 @@ onMounted(() => {
.page-title {
margin-bottom: 20px;
font-size: 24px;
color: #333;
color: var(--ls-text);
}
.search-card {