feat: 全站移动端适配
- AdminLayout: 移动端侧边栏抽屉式折叠(汉堡菜单+遮罩) - Dashboard: 统计卡片/快捷操作响应式布局(2列→1列) - Links: 筛选条件垂直堆叠,表格横向滚动,弹窗自适应宽度 - Categories: 表格横向滚动,弹窗自适应 - Settings: 表单标签响应式(小屏换行) - Login: 登录卡片自适应边距 - Home: 搜索框全宽,网址卡片缩窄,导航描述隐藏
This commit is contained in:
@@ -164,6 +164,7 @@ loadData()
|
||||
border: 1px solid #6366f1;
|
||||
border-radius: 8px;
|
||||
transition: all 0.2s;
|
||||
white-space: nowrap;
|
||||
&:hover {
|
||||
background: #6366f1;
|
||||
color: white;
|
||||
@@ -251,4 +252,28 @@ loadData()
|
||||
color: #aaa;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.header {
|
||||
.header-content {
|
||||
padding: 16px;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
.brand {
|
||||
.logo { font-size: 22px; }
|
||||
.desc { display: none; }
|
||||
}
|
||||
.search-box { width: 100%; order: 10; }
|
||||
.admin-link {
|
||||
padding: 6px 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
.main-content { padding: 16px; }
|
||||
.links-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
|
||||
.link-card { padding: 12px; }
|
||||
.category-header .name { font-size: 16px; }
|
||||
.category-section { margin-bottom: 24px; }
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
<template>
|
||||
<div class="admin-layout">
|
||||
<el-aside width="200px">
|
||||
<div class="sidebar-logo">言逍导航</div>
|
||||
<!-- 移动端遮罩 -->
|
||||
<div v-if="sidebarVisible && isMobile" class="sidebar-overlay" @click="sidebarVisible = false" />
|
||||
<!-- 侧边栏 -->
|
||||
<el-aside :width="isMobile && !sidebarVisible ? '0' : sidebarWidth" class="sidebar">
|
||||
<div class="sidebar-logo">
|
||||
<span v-if="!isMobile || sidebarVisible">言逍导航</span>
|
||||
<button v-if="isMobile" class="close-sidebar" @click="sidebarVisible = false">✕</button>
|
||||
</div>
|
||||
<el-menu router :default-active="$route.path">
|
||||
<el-menu-item index="/admin/dashboard">
|
||||
<el-icon><DataBoard /></el-icon>
|
||||
@@ -23,10 +29,15 @@
|
||||
</el-aside>
|
||||
<el-main>
|
||||
<div class="admin-header">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item>后台管理</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>{{ pageTitle }}</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<div class="header-left">
|
||||
<button v-if="isMobile" class="menu-btn" @click="sidebarVisible = !sidebarVisible">
|
||||
<span class="hamburger" />
|
||||
</button>
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item>后台管理</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>{{ pageTitle }}</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
<div class="user-area">
|
||||
<span class="nickname">{{ store.user?.nickname || '管理员' }}</span>
|
||||
<el-button text @click="handleLogout">退出</el-button>
|
||||
@@ -38,7 +49,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { DataBoard, Link, Folder, Setting } from '@element-plus/icons-vue'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
@@ -46,6 +57,16 @@ import router from '@/router'
|
||||
|
||||
const route = useRoute()
|
||||
const store = useUserStore()
|
||||
const sidebarWidth = '200px'
|
||||
const sidebarVisible = ref(false)
|
||||
const isMobile = ref(window.innerWidth < 768)
|
||||
|
||||
function checkMobile() {
|
||||
isMobile.value = window.innerWidth < 768
|
||||
if (!isMobile.value) sidebarVisible.value = false
|
||||
}
|
||||
onMounted(() => window.addEventListener('resize', checkMobile))
|
||||
onUnmounted(() => window.removeEventListener('resize', checkMobile))
|
||||
|
||||
const titleMap: Record<string, string> = {
|
||||
'/admin/dashboard': '仪表盘',
|
||||
@@ -62,17 +83,39 @@ function handleLogout() {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.admin-layout { height: 100vh; }
|
||||
.el-aside {
|
||||
.admin-layout {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
}
|
||||
.sidebar {
|
||||
background: #1e293b;
|
||||
color: white;
|
||||
transition: width 0.3s;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.sidebar-overlay {
|
||||
display: none;
|
||||
}
|
||||
.sidebar-logo {
|
||||
padding: 24px;
|
||||
padding: 24px 16px;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.1);
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.close-sidebar {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: none;
|
||||
border: none;
|
||||
color: rgba(255,255,255,0.7);
|
||||
font-size: 18px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.el-menu {
|
||||
background: transparent;
|
||||
@@ -89,7 +132,73 @@ function handleLogout() {
|
||||
padding-bottom: 16px;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
.user-area { display: flex; align-items: center; gap: 16px; }
|
||||
.nickname { color: #555; font-weight: 500; }
|
||||
.el-main { background: #f5f7fa; padding: 24px; overflow-y: auto; }
|
||||
</style>
|
||||
.header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.menu-btn {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
background: none;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.hamburger {
|
||||
display: block;
|
||||
width: 18px;
|
||||
height: 2px;
|
||||
background: #555;
|
||||
position: relative;
|
||||
}
|
||||
.hamburger::before,
|
||||
.hamburger::after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 18px;
|
||||
height: 2px;
|
||||
background: #555;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
}
|
||||
.hamburger::before { top: -6px; }
|
||||
.hamburger::after { top: 6px; }
|
||||
.user-area { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
|
||||
.nickname { color: #555; font-weight: 500; white-space: nowrap; }
|
||||
.el-main { background: #f5f7fa; padding: 24px; overflow-y: auto; flex: 1; }
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.sidebar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100vh;
|
||||
z-index: 100;
|
||||
width: 200px !important;
|
||||
transform: translateX(-100%);
|
||||
transition: transform 0.3s;
|
||||
}
|
||||
.sidebar:not([style*="width: 0"]) {
|
||||
transform: translateX(0);
|
||||
}
|
||||
.sidebar[style*="width: 0"] {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
.sidebar-overlay {
|
||||
display: block;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background: rgba(0,0,0,0.4);
|
||||
z-index: 99;
|
||||
}
|
||||
.admin-header { flex-wrap: wrap; gap: 8px; }
|
||||
.el-main { padding: 16px; }
|
||||
}
|
||||
</style>
|
||||
@@ -3,25 +3,27 @@
|
||||
<div class="page-header">
|
||||
<h2>分类管理</h2>
|
||||
<el-button type="primary" @click="openDialog">
|
||||
<el-icon><Plus /></el-icon> 新增分类
|
||||
<el-icon><Plus /></el-icon> 新增
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-card>
|
||||
<el-table :data="categories">
|
||||
<el-table-column prop="icon" label="图标" width="80" align="center" />
|
||||
<el-table-column prop="name" label="名称" />
|
||||
<el-table-column prop="sort" label="排序" width="80" align="center" />
|
||||
<el-table-column label="操作" width="140">
|
||||
<template #default="scope">
|
||||
<el-button size="small" @click="openDialog(scope.row)">编辑</el-button>
|
||||
<el-button size="small" type="danger" @click="del(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="table-wrap">
|
||||
<el-table :data="categories">
|
||||
<el-table-column prop="icon" label="图标" width="70" align="center" />
|
||||
<el-table-column prop="name" label="名称" min-width="120" />
|
||||
<el-table-column prop="sort" label="排序" width="70" align="center" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button size="small" @click="openDialog(scope.row)">编辑</el-button>
|
||||
<el-button size="small" type="danger" @click="del(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-dialog v-model="dialogVisible" :title="editId ? '编辑分类' : '新增分类'" width="420px">
|
||||
<el-dialog v-model="dialogVisible" :title="editId ? '编辑分类' : '新增分类'" :width="dialogWidth">
|
||||
<el-form :model="form" label-width="60px">
|
||||
<el-form-item label="图标">
|
||||
<el-input v-model="form.icon" placeholder="如:🌟" />
|
||||
@@ -42,7 +44,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { adminApi } from '@/api'
|
||||
@@ -51,6 +53,7 @@ const categories = ref([])
|
||||
const dialogVisible = ref(false)
|
||||
const editId = ref(null)
|
||||
const form = ref({ icon: '🔗', name: '', sort: 0 })
|
||||
const dialogWidth = computed(() => window.innerWidth < 500 ? '92%' : '420px')
|
||||
|
||||
async function load() {
|
||||
categories.value = (await adminApi.getCategories()).result.data
|
||||
@@ -87,4 +90,9 @@ onMounted(load)
|
||||
<style scoped>
|
||||
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
|
||||
.page-header h2 { font-size: 20px; font-weight: 600; }
|
||||
</style>
|
||||
.table-wrap { overflow-x: auto; }
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.page-header h2 { font-size: 18px; }
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="dashboard">
|
||||
<el-row :gutter="20" class="stat-cards">
|
||||
<el-col :span="6">
|
||||
<el-row :gutter="[16, 16]" class="stat-cards">
|
||||
<el-col :xs="12" :sm="6">
|
||||
<el-card shadow="hover">
|
||||
<div class="stat-item">
|
||||
<span class="num">{{ stats.linkCount }}</span>
|
||||
@@ -9,7 +9,7 @@
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-col :xs="12" :sm="6">
|
||||
<el-card shadow="hover">
|
||||
<div class="stat-item">
|
||||
<span class="num">{{ stats.catCount }}</span>
|
||||
@@ -17,7 +17,7 @@
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-col :xs="12" :sm="6">
|
||||
<el-card shadow="hover">
|
||||
<div class="stat-item">
|
||||
<span class="num">{{ stats.totalViews }}</span>
|
||||
@@ -25,10 +25,10 @@
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-col :xs="12" :sm="6">
|
||||
<el-card shadow="hover">
|
||||
<div class="stat-item">
|
||||
<span class="num">{{ settings.site_name }}</span>
|
||||
<span class="num" style="font-size:20px">{{ settings.site_name || '言逍导航' }}</span>
|
||||
<span class="label">站点名称</span>
|
||||
</div>
|
||||
</el-card>
|
||||
@@ -36,27 +36,25 @@
|
||||
</el-row>
|
||||
|
||||
<el-card style="margin-top:24px">
|
||||
<template #header>
|
||||
<span>快捷操作</span>
|
||||
</template>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<el-button type="primary" block @click="$router.push('/admin/links')">
|
||||
<template #header><span>快捷操作</span></template>
|
||||
<el-row :gutter="[16, 16]">
|
||||
<el-col :xs="12" :sm="6">
|
||||
<el-button type="primary" class="action-btn" @click="$router.push('/admin/links')">
|
||||
<el-icon><Plus /></el-icon> 管理网址
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-button type="success" block @click="$router.push('/admin/categories')">
|
||||
<el-col :xs="12" :sm="6">
|
||||
<el-button type="success" class="action-btn" @click="$router.push('/admin/categories')">
|
||||
<el-icon><FolderAdd /></el-icon> 管理分类
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-button type="warning" block @click="$router.push('/admin/settings')">
|
||||
<el-col :xs="12" :sm="6">
|
||||
<el-button type="warning" class="action-btn" @click="$router.push('/admin/settings')">
|
||||
<el-icon><Setting /></el-icon> 站点配置
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-button block @click="() => window.open('/', '_blank')">
|
||||
<el-col :xs="12" :sm="6">
|
||||
<el-button class="action-btn" @click="() => window.open('/', '_blank')">
|
||||
<el-icon><View /></el-icon> 预览前台
|
||||
</el-button>
|
||||
</el-col>
|
||||
@@ -65,11 +63,13 @@
|
||||
|
||||
<el-card style="margin-top:24px">
|
||||
<template #header><span>分类概览</span></template>
|
||||
<el-table :data="categories" style="width:100%">
|
||||
<el-table-column prop="name" label="分类" />
|
||||
<el-table-column prop="linkCount" label="网址数" width="100" />
|
||||
<el-table-column prop="icon" label="图标" width="80" />
|
||||
</el-table>
|
||||
<div class="table-wrap">
|
||||
<el-table :data="categories" style="width:100%">
|
||||
<el-table-column prop="name" label="分类" />
|
||||
<el-table-column prop="linkCount" label="网址数" width="100" />
|
||||
<el-table-column prop="icon" label="图标" width="80" />
|
||||
</el-table>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -103,4 +103,12 @@ onMounted(async () => {
|
||||
.stat-item { text-align: center; }
|
||||
.stat-item .num { display: block; font-size: 36px; font-weight: 700; color: #6366f1; margin-bottom: 8px; }
|
||||
.stat-item .label { color: #888; font-size: 14px; }
|
||||
</style>
|
||||
.action-btn {
|
||||
width: 100%;
|
||||
}
|
||||
.table-wrap { overflow-x: auto; }
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.stat-item .num { font-size: 28px; }
|
||||
}
|
||||
</style>
|
||||
@@ -3,45 +3,46 @@
|
||||
<div class="page-header">
|
||||
<h2>网址管理</h2>
|
||||
<el-button type="primary" @click="openDialog()">
|
||||
<el-icon><Plus /></el-icon> 新增网址
|
||||
<el-icon><Plus /></el-icon> 新增
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-card>
|
||||
<el-row :gutter="16" style="margin-bottom:16px">
|
||||
<el-col :span="6">
|
||||
<el-input v-model="keyword" placeholder="搜索标题" @input="loadLinks" />
|
||||
<el-row :gutter="[12, 12]" style="margin-bottom:16px">
|
||||
<el-col :xs="24" :sm="12" :md="6">
|
||||
<el-input v-model="keyword" placeholder="搜索标题" @input="loadLinks" clearable />
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-select v-model="catFilter" placeholder="选择分类" @change="loadLinks" clearable>
|
||||
<el-col :xs="24" :sm="12" :md="6">
|
||||
<el-select v-model="catFilter" placeholder="选择分类" @change="loadLinks" clearable style="width:100%">
|
||||
<el-option v-for="c in categories" :key="c.id" :label="c.name" :value="c.id" />
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table :data="links">
|
||||
<el-table-column prop="title" label="标题" />
|
||||
<el-table-column prop="categoryName" label="分类" width="120" />
|
||||
<el-table-column prop="url" label="网址" />
|
||||
<el-table-column prop="isShow" label="显示" width="80" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.isShow ? 'success' : 'info'">
|
||||
{{ scope.row.isShow ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="views" label="访问" width="80" align="center" />
|
||||
<el-table-column label="操作" width="140">
|
||||
<template #default="scope">
|
||||
<el-button size="small" @click="openDialog(scope.row)">编辑</el-button>
|
||||
<el-button size="small" type="danger" @click="deleteLink(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="table-wrap">
|
||||
<el-table :data="links">
|
||||
<el-table-column prop="title" label="标题" min-width="120" />
|
||||
<el-table-column prop="categoryName" label="分类" width="100" />
|
||||
<el-table-column prop="url" label="网址" min-width="180" />
|
||||
<el-table-column prop="isShow" label="显示" width="70" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.isShow ? 'success' : 'info'" size="small">
|
||||
{{ scope.row.isShow ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="views" label="访问" width="70" align="center" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button size="small" @click="openDialog(scope.row)">编辑</el-button>
|
||||
<el-button size="small" type="danger" @click="deleteLink(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 新增/编辑弹窗 -->
|
||||
<el-dialog v-model="dialogVisible" :title="editId ? '编辑网址' : '新增网址'" width="500px">
|
||||
<el-dialog v-model="dialogVisible" :title="editId ? '编辑网址' : '新增网址'" :width="dialogWidth">
|
||||
<el-form :model="form" label-width="80px">
|
||||
<el-form-item label="标题">
|
||||
<el-input v-model="form.title" placeholder="如:百度" />
|
||||
@@ -50,7 +51,7 @@
|
||||
<el-input v-model="form.url" placeholder="https://" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类">
|
||||
<el-select v-model="form.categoryId" placeholder="选择分类">
|
||||
<el-select v-model="form.categoryId" placeholder="选择分类" style="width:100%">
|
||||
<el-option v-for="c in categories" :key="c.id" :label="c.name" :value="c.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -76,7 +77,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { adminApi } from '@/api'
|
||||
@@ -88,6 +89,7 @@ const catFilter = ref('')
|
||||
const dialogVisible = ref(false)
|
||||
const editId = ref(null)
|
||||
const form = ref({ title: '', url: '', categoryId: '', description: '', iconUrl: '', sort: 0, isShow: true })
|
||||
const dialogWidth = computed(() => window.innerWidth < 500 ? '92%' : '500px')
|
||||
|
||||
async function loadLinks() {
|
||||
links.value = (await adminApi.getLinks({ keyword: keyword.value || undefined, categoryId: catFilter.value || undefined })).result.data
|
||||
@@ -127,4 +129,10 @@ onMounted(async () => { await loadLinks(); await loadCats() })
|
||||
<style scoped>
|
||||
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
|
||||
.page-header h2 { font-size: 20px; font-weight: 600; }
|
||||
</style>
|
||||
.table-wrap { overflow-x: auto; }
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.page-header h2 { font-size: 18px; }
|
||||
.page-header .el-button { padding: 8px 12px; }
|
||||
}
|
||||
</style>
|
||||
@@ -61,16 +61,24 @@ async function handleLogin() {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||
padding: 20px;
|
||||
}
|
||||
.login-card {
|
||||
background: white;
|
||||
padding: 48px 40px;
|
||||
border-radius: 16px;
|
||||
width: 380px;
|
||||
max-width: 100%;
|
||||
box-shadow: 0 20px 60px rgba(0,0,0,0.2);
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.login-card h2 { font-size: 24px; font-weight: 700; }
|
||||
.subtitle { color: #888; margin: 8px 0 24px; }
|
||||
.login-btn { width: 100%; margin-top: 8px; }
|
||||
</style>
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.login-card { padding: 32px 24px; }
|
||||
.login-card h2 { font-size: 20px; }
|
||||
}
|
||||
</style>
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="page-header"><h2>站点配置</h2></div>
|
||||
|
||||
<el-card>
|
||||
<el-form :model="settings" label-width="120px">
|
||||
<el-form :model="settings" :label-width="isMobile ? '80px' : '120px'" :label-position="isMobile ? 'top' : 'left'">
|
||||
<el-form-item label="站点名称">
|
||||
<el-input v-model="settings.site_name" />
|
||||
</el-form-item>
|
||||
@@ -42,9 +42,11 @@ const settings = ref({
|
||||
layout_mode: 'grid',
|
||||
footer_text: '',
|
||||
})
|
||||
const isMobile = ref(window.innerWidth < 768)
|
||||
|
||||
onMounted(async () => {
|
||||
Object.assign(settings.value, (await adminApi.getSettings()).result.data)
|
||||
window.addEventListener('resize', () => { isMobile.value = window.innerWidth < 768 })
|
||||
})
|
||||
|
||||
async function save() {
|
||||
@@ -56,4 +58,4 @@ async function save() {
|
||||
<style scoped>
|
||||
.page-header { margin-bottom: 20px; }
|
||||
.page-header h2 { font-size: 20px; font-weight: 600; }
|
||||
</style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user