style: 调整设置模态框样式,优化布局和间距

This commit is contained in:
Wenjie Zhang 2026-01-14 21:40:48 +08:00
parent e1825aded2
commit 5047cd0744
2 changed files with 29 additions and 25 deletions

View File

@ -308,6 +308,8 @@ const openLink = (url) => {
} }
&.card-select { &.card-select {
gap: 0px;
padding: 0;
.label { .label {
margin-top: 0; margin-top: 0;
} }

View File

@ -3,7 +3,7 @@
v-model:open="visible" v-model:open="visible"
title="系统设置" title="系统设置"
width="90%" width="90%"
:style="{ maxWidth: '1200px', minWidth: '320px', top: '3%' }" :style="{ maxWidth: '980px', minWidth: '320px', top: '10%' }"
:footer="null" :footer="null"
@cancel="handleClose" @cancel="handleClose"
class="settings-modal" class="settings-modal"
@ -12,7 +12,7 @@
> >
<div class="settings-container"> <div class="settings-container">
<!-- 侧边栏 (Desktop) --> <!-- 侧边栏 (Desktop) -->
<div class="settings-sider" v-if="!isMobile"> <div class="settings-sider">
<div <div
class="sider-item" class="sider-item"
:class="{ activesec: activeTab === 'base' }" :class="{ activesec: activeTab === 'base' }"
@ -52,7 +52,7 @@
</div> </div>
<!-- 顶部导航 (Mobile) --> <!-- 顶部导航 (Mobile) -->
<div class="settings-mobile-nav" v-else> <div class="settings-mobile-nav">
<div <div
class="nav-item" class="nav-item"
:class="{ active: activeTab === 'base' }" :class="{ active: activeTab === 'base' }"
@ -112,7 +112,7 @@
</template> </template>
<script setup> <script setup>
import { ref, computed, watch, onMounted, onUnmounted } from 'vue' import { ref, computed, watch } from 'vue'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import { import {
SettingOutlined, SettingOutlined,
@ -136,9 +136,6 @@ const emit = defineEmits(['update:visible', 'close'])
const userStore = useUserStore() const userStore = useUserStore()
const activeTab = ref('base') const activeTab = ref('base')
const windowWidth = ref(window?.innerWidth || 0)
const isMobile = computed(() => windowWidth.value <= 768)
const visible = computed({ const visible = computed({
get: () => props.visible, get: () => props.visible,
@ -149,18 +146,6 @@ const handleClose = () => {
emit('close') emit('close')
} }
const updateWindowWidth = () => {
windowWidth.value = window?.innerWidth || 0
}
onMounted(() => {
window.addEventListener('resize', updateWindowWidth)
})
onUnmounted(() => {
window.removeEventListener('resize', updateWindowWidth)
})
// //
watch(() => props.visible, (newVal) => { watch(() => props.visible, (newVal) => {
if (newVal) { if (newVal) {
@ -197,11 +182,15 @@ watch(() => props.visible, (newVal) => {
display: flex; display: flex;
height: 100%; height: 100%;
width: 100%; width: 100%;
@media (max-width: 768px) {
flex-direction: column;
}
} }
/* Sidebar Styles - Matching SettingView.vue style */ /* Sidebar Styles - Matching SettingView.vue style */
.settings-sider { .settings-sider {
width: 140px; width: 128px;
height: 100%; height: 100%;
padding-top: 8px; padding-top: 8px;
display: flex; display: flex;
@ -210,9 +199,13 @@ watch(() => props.visible, (newVal) => {
gap: 8px; gap: 8px;
flex-shrink: 0; flex-shrink: 0;
@media (max-width: 768px) {
display: none;
}
.sider-item { .sider-item {
width: 100%; width: 100%;
padding: 6px 16px; /* Matches SettingView .sider > * */ padding: 6px 12px; /* Matches SettingView .sider > * */
cursor: pointer; cursor: pointer;
transition: all 0.1s; /* Matches SettingView */ transition: all 0.1s; /* Matches SettingView */
text-align: left; text-align: left;
@ -222,6 +215,7 @@ watch(() => props.visible, (newVal) => {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 10px; gap: 10px;
margin-left: -20px;
.icon { .icon {
font-size: 14px; /* Slightly adjusted to align better, SettingView uses h() icon defaults */ font-size: 14px; /* Slightly adjusted to align better, SettingView uses h() icon defaults */
@ -248,10 +242,14 @@ watch(() => props.visible, (newVal) => {
padding: 0 20px; /* Matches SettingView .setting padding */ padding: 0 20px; /* Matches SettingView .setting padding */
// margin-bottom: 40px; /* Matches SettingView .setting margin-bottom */ // margin-bottom: 40px; /* Matches SettingView .setting margin-bottom */
overflow-y: scroll; overflow-y: scroll;
height: 80vh; height: 70vh;
@media (max-width: 768px) {
height: 70vh;
padding: 0px;
}
h3 { h3 {
font-size: 18px;
font-weight: 600; font-weight: 600;
color: var(--gray-900); color: var(--gray-900);
margin-bottom: 0.5em; margin-bottom: 0.5em;
@ -263,13 +261,17 @@ watch(() => props.visible, (newVal) => {
/* Mobile Styles */ /* Mobile Styles */
.settings-mobile-nav { .settings-mobile-nav {
display: flex; display: none;
overflow-x: auto; overflow-x: auto;
border-bottom: 1px solid var(--gray-150); border-bottom: 1px solid var(--gray-150);
background: var(--gray-0); background: var(--gray-0);
padding: 0 16px; padding: 0;
flex-shrink: 0; flex-shrink: 0;
@media (max-width: 768px) {
display: flex;
}
.nav-item { .nav-item {
padding: 12px 16px; padding: 12px 16px;
white-space: nowrap; white-space: nowrap;