大屏页面初始化

This commit is contained in:
2026-03-03 17:35:54 +08:00
parent 6f9562d121
commit 353ed9cd22
3 changed files with 563 additions and 11 deletions

View File

@@ -696,20 +696,27 @@ onMounted(() => {
color: #333; color: #333;
} }
/* 核心修复:内容容器布局 */
.content-container { .content-container {
flex: 1; flex: 1;
padding: 0 !important; padding: 0 !important;
overflow: auto; overflow: hidden !important;
display: flex !important;
flex-direction: column !important;
} }
.content-wrapper { .content-wrapper {
margin: 16px; margin: 8px;
padding: 24px; padding: 2px;
background: #fff; background: #fff;
border: 1px solid #e6e6e6; border: 1px solid #e6e6e6;
border-radius: 8px; border-radius: 8px;
min-height: calc(100% - 32px); flex: 1 !important;
height: calc(100% - 16px) !important;
min-height: 0 !important;
box-shadow: 0 1px 2px rgba(0,0,0,0.1); box-shadow: 0 1px 2px rgba(0,0,0,0.1);
display: flex !important;
flex-direction: column !important;
} }
:deep(.el-sub-menu .el-menu) { :deep(.el-sub-menu .el-menu) {

View File

@@ -0,0 +1,213 @@
<template>
<div class="chart-top-container">
<div class="card-item" v-for="(item, index) in cardList" :key="index">
<div class="card-left">
<div class="icon-box">
<img
:src="item.iconImg"
class="icon-img"
:style="{ filter: item.iconFilter }"
>
</div>
<div class="card-text">
<div class="module-name">{{ item.module }}</div>
<div class="desc-text">{{ item.title }}</div>
</div>
</div>
<div class="card-right">
<div class="num-value">{{ item.value }}</div>
<div class="num-label">{{ item.label }}</div>
</div>
</div>
</div>
</template>
<script setup>
import { ref, onMounted, watch } from 'vue'
import { getIndexInfoList } from '@/api/bizApi'
const cardList = ref()
async function getList() {
try {
const reqParams = {
indexCode: "werpIndex"
}
const res = await getIndexInfoList(reqParams)
cardList.value = res || []
} catch (error) {
console.error('获取数据失败:', error)
cardList.value = []
}
}
const resizeHandler = () => {
const container = document.querySelector('.chart-top-container')
if (container) {
const height = container.parentElement.clientHeight
container.style.height = `${height}px`
}
}
onMounted(() => {
getList()
})
watch(
() => {},
() => {
window.removeEventListener('resize', resizeHandler)
},
{ once: true }
)
</script>
<style scoped>
.chart-top-container {
width: 100%;
height: 100%;
display: flex;
justify-content: space-between;
align-items: center;
gap: 4px;
padding: 2px 4px;
box-sizing: border-box;
flex-wrap: wrap;
background: transparent;
}
.card-item {
flex: 1;
min-width: 160px;
height: 85%;
background: rgba(15, 52, 96, 0.95);
border: 1px solid #1a508b;
border-radius: 8px;
padding: 0 8px;
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
position: relative;
overflow: hidden;
transition: all 0.3s ease;
}
.card-item:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(60, 156, 255, 0.3);
border-color: #3c9cff;
}
.card-left {
display: flex;
align-items: center;
gap: 6px;
}
.icon-box {
width: 40px;
height: 40px;
background: transparent;
display: flex;
justify-content: center;
align-items: center;
border: 1px solid rgba(224, 230, 255, 0.2);
border-radius: 8px;
box-sizing: border-box;
}
.icon-img {
width: 100%;
height: 100%;
object-fit: contain;
opacity: 0.9;
transition: all 0.2s ease;
}
.icon-box:hover .icon-img {
opacity: 1;
transform: scale(1.05);
filter: brightness(1.1) contrast(1.2);
}
.card-text {
color: #e0e6ff;
}
.module-name {
font-size: 15px;
font-weight: 600;
line-height: 1.2;
}
.desc-text {
font-size: 11px;
opacity: 0.7;
margin-top: 2px;
}
.card-right {
text-align: right;
color: #e0e6ff;
}
.num-value {
font-size: 24px;
font-weight: 700;
line-height: 1;
background: linear-gradient(to right, #3c9cff, #7472fe);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.num-label {
font-size: 11px;
opacity: 0.7;
margin-top: 4px;
}
@media (max-width: 1600px) {
.card-item {
min-width: 140px;
padding: 0 6px;
}
.icon-box {
width: 36px;
height: 36px;
}
.module-name {
font-size: 14px;
}
.num-value {
font-size: 22px;
}
}
@media (max-width: 768px) {
.chart-top-container {
flex-direction: column;
height: auto !important;
gap: 4px;
padding: 2px;
}
.card-item {
width: 100%;
height: 80px;
min-width: unset;
padding: 0 8px;
}
}
@media (max-height: 900px) {
.card-item {
height: 80%;
}
.icon-box {
width: 32px;
height: 32px;
}
.num-value {
font-size: 20px;
}
}
</style>

View File

@@ -1,17 +1,349 @@
<template> <template>
<!-- Dashboard自身的内容后台首页 --> <div class="search-list-page">
<div class="dashboard-container"> <div class="search-section">
<h1>后台首页</h1> <div class="search-wrapper">
<div class="stats">数据概览快捷入口等</div> <el-input
v-model="searchForm.keyword"
placeholder="请输入搜索关键词"
class="search-input"
clearable
@keyup.enter="handleSearch"
/>
<div class="search-btn-group">
<el-button type="primary" icon="Search" @click="handleSearch">查询</el-button>
<el-button icon="Refresh" @click="handleReset">重置</el-button>
</div>
</div>
</div>
<div class="tabs-section">
<el-tabs v-model="activeTab" @tab-change="handleTabChange">
<el-tab-pane
v-for="tab in tabList"
:key="tab.key"
:label="tab.name"
:name="tab.key"
>
</el-tab-pane>
</el-tabs>
</div>
<div class="list-wrapper">
<div class="list-section">
<div v-if="listData.length === 0" class="empty-tip">
<el-empty description="暂无数据" />
</div>
<div v-else class="card-list">
<el-card
v-for="item in listData"
:key="item.id"
class="list-card"
shadow="hover"
>
<div class="card-top">
<div class="site-avatar">
<el-icon size="24"><Link /></el-icon>
</div>
<div class="site-main">
<div class="site-name">{{ item.siteName }}</div>
<el-tooltip :content="item.siteUrl" placement="top">
<div class="site-url">{{ item.siteUrl }}</div>
</el-tooltip>
</div>
</div>
<div class="card-divider"></div>
<div class="card-bottom">
<span class="card-date">{{ item.date }}</span>
<div class="card-actions">
<el-button size="small" type="primary" link @click="handleVisit(item)">
<el-icon><Link /></el-icon>
访问
</el-button>
<el-button size="small" type="text" @click="handleDetail(item)">详情</el-button>
</div>
</div>
</el-card>
</div>
</div>
</div>
<div class="pagination-footer">
<el-pagination
v-model:current-page="pagination.pageNum"
v-model:page-size="pagination.pageSize"
:page-sizes="[ 20, 50, 99]"
:total="pagination.total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
background
/>
</div>
</div> </div>
</template> </template>
<script setup> <script setup>
// 无需引入LayoutLayout已作为路由层的父组件 import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { Link } from '@element-plus/icons-vue'
const searchForm = reactive({
keyword: ''
})
const tabList = ref([
{ key: 'tab1', name: '标签一' },
{ key: 'tab2', name: '标签二' },
{ key: 'tab3', name: '标签三' }
])
const activeTab = ref('tab1')
const pagination = reactive({
pageNum: 1,
pageSize: 20,
total: 0
})
const listData = ref([])
const fetchData = () => {
}
const handleVisit = (item) => {
window.open(item.siteUrl, '_blank')
}
const handleDetail = (item) => {
ElMessage.info(`查看 ${item.siteName} 详情`)
}
const handleSearch = () => {
pagination.pageNum = 1
fetchData()
}
const handleReset = () => {
searchForm.keyword = ''
pagination.pageNum = 1
fetchData()
}
const handleTabChange = (tabKey) => {
pagination.pageNum = 1
fetchData()
}
const handleSizeChange = (val) => {
pagination.pageSize = val
fetchData()
}
const handleCurrentChange = (val) => {
pagination.pageNum = val
fetchData()
}
onMounted(() => {
fetchData()
})
</script> </script>
<style scoped> <style scoped>
.dashboard-container { .search-list-page {
padding: 20px; width: 100%;
height: 100%;
padding: 16px;
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow: hidden !important;
}
.search-section {
width: 100%;
margin-bottom: 16px;
flex-shrink: 0;
padding-bottom: 12px;
border-bottom: 1px solid #e5e7eb;
}
.search-wrapper {
display: flex;
align-items: center;
gap: 12px;
width: 100%;
}
.search-input {
flex: 1;
}
.search-btn-group {
display: flex;
gap: 8px;
flex-shrink: 0;
}
.tabs-section {
width: 100%;
border-bottom: 1px solid #e5e7eb;
margin-bottom: 16px;
flex-shrink: 0;
}
.list-wrapper {
flex: 1;
width: 100%;
overflow: hidden;
min-height: 0;
border: 1px solid #e5e7eb;
border-radius: 6px;
margin-bottom: 12px;
}
.list-section {
width: 100%;
height: 100%;
overflow-y: auto !important;
overflow-x: hidden !important;
padding: 12px;
box-sizing: border-box;
}
.empty-tip {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.card-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 16px;
padding: 8px;
}
.list-card {
transition: all 0.3s ease;
cursor: pointer;
border-radius: 12px;
overflow: hidden;
border: 1px solid #f0f0f0 !important;
}
.list-card:hover {
transform: translateY(-4px);
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08) !important;
border-color: #409eff !important;
}
.card-top {
display: flex;
align-items: center;
gap: 12px;
padding: 16px;
}
.site-avatar {
width: 48px;
height: 48px;
border-radius: 50%;
background: #f0f7ff;
display: flex;
align-items: center;
justify-content: center;
color: #409eff;
flex-shrink: 0;
}
.site-main {
flex: 1;
min-width: 0;
}
.site-name {
font-weight: 600;
font-size: 16px;
color: #1f2937;
margin-bottom: 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.site-url {
font-size: 13px;
color: #9ca3af;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
}
.site-url:hover {
color: #409eff;
text-decoration: underline;
}
.card-divider {
height: 1px;
background: #f0f0f0;
margin: 0 16px;
}
.card-bottom {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 16px;
}
.card-date {
font-size: 12px;
color: #9ca3af;
}
.card-actions {
display: flex;
gap: 8px;
}
.pagination-footer {
width: 100%;
display: flex;
justify-content: center;
padding: 8px 0;
border: 1px solid #e5e7eb;
border-radius: 6px;
flex-shrink: 0;
background: #fff;
z-index: 10;
}
.list-section::-webkit-scrollbar {
width: 6px;
height: 6px;
}
.list-section::-webkit-scrollbar-track {
background: #f1f5f9;
border-radius: 3px;
}
.list-section::-webkit-scrollbar-thumb {
background: #cbd5e1;
border-radius: 3px;
}
.list-section::-webkit-scrollbar-thumb:hover {
background: #94a3b8;
}
@media (max-width: 768px) {
.card-list {
grid-template-columns: 1fr;
}
} }
</style> </style>