feat(ui): 完成主要功能页面移动端适配

This commit is contained in:
向宇康 committed 2026-03-23 17:50:52 +08:00
1 parent 189693f40a
commit cc73cc2fa9
6 files changed
+284 -32

No files matched your search

+62 -7
View File
@@ -6,7 +6,7 @@
<!-- Stats Row -->
<el-row :gutter="20" class="mb-4">
<el-col :span="6">
<el-col :xs="12" :sm="12" :md="6" :lg="6">
<el-card shadow="hover" class="stats-card hover-card">
<template #header>
<div class="card-header">
@@ -18,7 +18,7 @@
</el-card>
</el-col>
<template v-if="userStore.isAdmin">
<el-col :span="6">
<el-col :xs="12" :sm="12" :md="6" :lg="6">
<el-card shadow="hover" class="stats-card hover-card">
<template #header>
<div class="card-header">
@@ -29,7 +29,7 @@
<div class="stats-value">{{ stats.total_users || 0 }}</div>
</el-card>
</el-col>
<el-col :span="6">
<el-col :xs="12" :sm="12" :md="6" :lg="6">
<el-card shadow="hover" class="stats-card hover-card">
<template #header>
<div class="card-header">
@@ -40,7 +40,7 @@
<div class="stats-value">{{ stats.total_uploads || 0 }}</div>
</el-card>
</el-col>
<el-col :span="6">
<el-col :xs="12" :sm="12" :md="6" :lg="6">
<el-card shadow="hover" class="stats-card hover-card">
<template #header>
<div class="card-header">
@@ -57,14 +57,14 @@
<!-- Main Content Row: Chart & Notifications -->
<el-row :gutter="20" class="mb-4">
<!-- Left Column: Chart -->
<el-col :span="16">
<el-col :xs="24" :sm="24" :md="24" :lg="16">
<el-card shadow="hover" class="chart-card">
<div ref="chartRef" style="height: 300px;"></div>
</el-card>
</el-col>
<!-- Right Column: Notifications -->
<el-col :span="8">
<el-col :xs="24" :sm="24" :md="24" :lg="8">
<el-card shadow="hover" class="notifications-card">
<template #header>
<div class="card-header">
@@ -293,4 +293,59 @@ onUnmounted(() => {
text-align: center;
padding: 20px;
}
/* 移动端适配 */
@media screen and (max-width: 768px) {
.dashboard-container {
max-width: 100%;
}
.dashboard-header {
margin-bottom: 15px;
}
.title {
font-size: 20px;
}
.mb-4 {
margin-bottom: 15px;
}
.stats-value {
font-size: 24px;
}
.card-header {
flex-direction: column;
align-items: flex-start;
gap: 8px;
}
.chart-card {
margin-bottom: 15px;
}
.table-card {
margin-top: 15px;
}
:deep(.el-table) {
font-size: 13px;
}
:deep(.el-table .el-button) {
padding: 4px 8px;
font-size: 12px;
}
/* 统计卡片移动端样式 */
.stats-card {
margin-bottom: 10px;
}
.stats-value {
font-size: 28px;
}
}
</style>
+88 -16
View File
@@ -1,27 +1,40 @@
<template>
<div>
<div style="display:flex; justify-content: space-between; align-items: center">
<h1>{{ $t('common.dataDetail') }}</h1>
<div class="page-header">
<h1 class="page-title">{{ $t('common.dataDetail') }}</h1>
<el-button @click="$router.back()">{{ $t('common.back') }}</el-button>
</div>
<el-card v-if="item">
<div><strong>{{ $t('common.title') }}:</strong> {{ item.title }}</div>
<div><strong>{{ $t('common.time') }}:</strong> {{ item.timestamp }}</div>
<div style="margin-top: 12px" v-html="safeContent"></div>
<el-card v-if="item" class="mb-4">
<div class="detail-item"><strong>{{ $t('common.title') }}:</strong> {{ item.title }}</div>
<div class="detail-item"><strong>{{ $t('common.time') }}:</strong> {{ new Date(item.timestamp).toLocaleString() }}</div>
<div class="detail-item" v-if="item.researcher"><strong>{{ $t('common.researcher') }}:</strong> {{ item.researcher }}</div>
<div class="detail-item">
<strong>{{ $t('common.isPermanent') }}:</strong>
<el-tag :type="item.is_permanent ? 'success' : 'warning'" size="small" style="margin-left: 8px;">
{{ item.is_permanent ? $t('common.yes') : $t('common.no') }}
</el-tag>
</div>
<div class="detail-item" v-if="!item.is_permanent && item.start_date"><strong>{{ $t('common.startDate') }}:</strong> {{ new Date(item.start_date).toLocaleString() }}</div>
<div class="detail-item" v-if="!item.is_permanent && item.expiration_date"><strong>{{ $t('common.expirationDate') }}:</strong> {{ new Date(item.expiration_date).toLocaleString() }}</div>
<div class="detail-item" v-if="item.associated_filename"><strong>{{ $t('common.csvFile') }}:</strong> {{ item.associated_filename }}</div>
<el-divider />
<div class="detail-content" v-html="safeContent"></div>
</el-card>
<el-card style="margin-top: 12px" v-if="item">
<el-card v-if="item" class="mb-4">
<template #header>{{ $t('common.attachments') }}</template>
<el-table :data="item.attachments" style="width: 100%">
<el-table-column prop="original_name" :label="$t('common.file')" />
<el-table-column prop="upload_time" :label="$t('common.uploaded')" />
<el-table-column :label="$t('common.actions')">
<template #default="scope">
<el-button size="small" @click="downloadAttachment(scope.row)">{{ $t('common.download') }}</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-responsive">
<el-table :data="item.attachments" style="width: 100%">
<el-table-column prop="original_name" :label="$t('common.file')" min-width="150" />
<el-table-column prop="upload_time" :label="$t('common.uploaded')" width="160" />
<el-table-column :label="$t('common.actions')" width="120" fixed="right">
<template #default="scope">
<el-button size="small" @click="downloadAttachment(scope.row)">{{ $t('common.download') }}</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
</div>
</template>
@@ -60,3 +73,62 @@ onMounted(() => {
fetchDetail()
})
</script>
<style scoped>
.page-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.page-title {
font-size: 24px;
color: #303133;
margin: 0;
}
.mb-4 {
margin-bottom: 15px;
}
.detail-item {
margin-bottom: 12px;
font-size: 15px;
}
.detail-content {
margin-top: 12px;
line-height: 1.8;
}
.table-responsive {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
/* 移动端适配 */
@media screen and (max-width: 768px) {
.page-header {
flex-direction: column;
gap: 12px;
align-items: flex-start;
}
.page-title {
font-size: 20px;
}
.page-header .el-button {
width: 100%;
}
.detail-item {
font-size: 14px;
}
:deep(.el-table) {
font-size: 13px;
}
}
</style>
+35
View File
@@ -114,10 +114,12 @@ const handleLogin = async () => {
width: 100vw;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
overflow: hidden;
padding: 15px;
}
.login-card {
width: 400px;
max-width: 90%;
border-radius: 12px;
overflow: hidden;
border: none;
@@ -156,4 +158,37 @@ const handleLogin = async () => {
opacity: 0;
transform: translateY(30px);
}
/* 移动端适配 */
@media screen and (max-width: 768px) {
.login-container {
padding: 10px;
}
.login-card {
width: 100%;
max-width: 100%;
}
.login-title {
font-size: 20px;
}
.login-subtitle {
font-size: 13px;
}
:deep(.el-form-item__label) {
font-size: 14px;
}
:deep(.el-input__inner) {
font-size: 16px; /* 防止 iOS 自动缩放 */
}
.login-button {
padding: 14px 0;
font-size: 16px;
}
}
</style>
+23 -1
View File
@@ -4,7 +4,7 @@
<h1 class="title">404</h1>
<p class="subtitle">Page Not Found</p>
<p class="description">The page you are looking for does not exist or has been moved.</p>
<el-button type="primary" @click="$router.push('/')">Back to Dashboard</el-button>
<el-button type="primary" @click="$router.push('/dashboard')">Back to Dashboard</el-button>
</div>
</div>
</template>
@@ -20,10 +20,12 @@
align-items: center;
height: 100vh;
background-color: #f5f7fa;
padding: 20px;
}
.content {
text-align: center;
max-width: 500px;
}
.title {
@@ -31,6 +33,7 @@
font-weight: bold;
color: #409eff;
margin: 0;
line-height: 1;
}
.subtitle {
@@ -44,4 +47,23 @@
color: #606266;
margin-bottom: 20px;
}
/* 移动端适配 */
@media screen and (max-width: 768px) {
.title {
font-size: 4rem;
}
.subtitle {
font-size: 1.5rem;
}
.description {
font-size: 0.9rem;
}
.el-button {
width: 100%;
}
}
</style>
+32 -6
View File
@@ -1,11 +1,13 @@
<template>
<div>
<h1>{{ $t('menu.notifications') }}</h1>
<el-table :data="items" style="width: 100%">
<el-table-column prop="title" :label="$t('common.title')" />
<el-table-column prop="timestamp" :label="$t('common.time')" />
<el-table-column prop="author" :label="$t('common.author')" />
</el-table>
<h1 class="page-title">{{ $t('menu.notifications') }}</h1>
<div class="table-responsive">
<el-table :data="items" style="width: 100%">
<el-table-column prop="title" :label="$t('common.title')" min-width="150" />
<el-table-column prop="timestamp" :label="$t('common.time')" width="160" />
<el-table-column prop="author" :label="$t('common.author')" min-width="120" />
</el-table>
</div>
</div>
</template>
@@ -24,3 +26,27 @@ onMounted(() => {
fetchNotifications()
})
</script>
<style scoped>
.page-title {
margin-bottom: 15px;
font-size: 24px;
color: #303133;
}
.table-responsive {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
/* 移动端适配 */
@media screen and (max-width: 768px) {
.page-title {
font-size: 20px;
}
:deep(.el-table) {
font-size: 13px;
}
}
</style>
+44 -2
View File
@@ -1,7 +1,7 @@
<template>
<div>
<h1>{{ $t('common.search') }}</h1>
<div style="display:flex; gap: 8px; align-items: center">
<h1 class="page-title">{{ $t('common.search') }}</h1>
<div class="search-bar">
<el-input v-model="q" :placeholder="$t('common.search')" @input="fetchSuggestions" />
<el-button type="primary" @click="doSearch">{{ $t('common.search') }}</el-button>
</div>
@@ -78,3 +78,45 @@ const go = (url) => {
router.push(url)
}
</script>
<style scoped>
.page-title {
margin-bottom: 15px;
font-size: 24px;
color: #303133;
}
.search-bar {
display: flex;
gap: 8px;
align-items: center;
}
/* 移动端适配 */
@media screen and (max-width: 768px) {
.page-title {
font-size: 20px;
}
.search-bar {
flex-direction: column;
}
.search-bar .el-input {
width: 100%;
}
.search-bar .el-button {
width: 100%;
}
:deep(.el-table) {
font-size: 13px;
}
:deep(.el-tabs__item) {
font-size: 14px;
padding: 0 15px;
}
}
</style>