调整卡片高度

This commit is contained in:
liuwei
2025-06-04 16:19:08 +08:00
parent aef459108f
commit a6301d7ab3

View File

@@ -5,7 +5,84 @@
{% block content %}
<!-- 首页概览 -->
<div>
<!-- 用户信息和系统信息 -->
<el-row :gutter="20" style="margin-top: 20px;">
<el-col :span="6">
<el-card shadow="hover">
<div slot="header">
<span>用户信息</span>
</div>
<div v-if="currentUser.success" class="user-info-container">
<div class="user-avatar-container">
<img :src="currentUser.data.avatar" alt="用户头像" />
</div>
<div class="user-info-details">
<div class="user-info-item">
<span class="user-info-label">昵称:</span>
<span class="user-info-value">{% raw %}{{ currentUser.data.nickname || '未知用户' }}{% endraw %}</span>
</div>
<div class="user-info-item">
<span class="user-info-label">微信ID:</span>
<span class="user-info-value">{% raw %}{{ currentUser.data.wx_id }}{% endraw %}</span>
</div>
<div class="user-info-item" v-if="currentUser.data.mobile">
<span class="user-info-label">手机号:</span>
<span class="user-info-value">{% raw %}{{ currentUser.data.mobile }}{% endraw %}</span>
</div>
<div class="user-info-item" v-if="currentUser.data.home">
<span class="user-info-label">主目录:</span>
<span class="user-info-value user-home-path">{% raw %}{{ currentUser.data.home }}{% endraw %}</span>
</div>
</div>
</div>
<div v-else class="user-info-empty">
<i class="el-icon-warning"></i>
<div>{% raw %}{{ currentUser.message || '未获取到用户信息' }}{% endraw %}</div>
</div>
</el-card>
</el-col>
<el-col :span="18">
<el-card shadow="hover">
<div slot="header">
<span>系统信息</span>
</div>
<el-row :gutter="20">
<el-col :span="8">
<div class="system-info-item">
<div class="system-info-row">
<span class="info-label">操作系统:</span>
<span class="info-value">{% raw %}{{ systemInfo.os }} {{ systemInfo.os_version }}{% endraw %}</span>
</div>
<div class="system-info-row">
<span class="info-label">Python版本:</span>
<span class="info-value">{% raw %}{{ systemInfo.python_version }}{% endraw %}</span>
</div>
</div>
</el-col>
<el-col :span="8">
<div class="system-info-item">
<div class="system-info-row">
<span class="info-label">运行时间:</span>
<span class="info-value">{% raw %}{{ formattedUptime }}{% endraw %}</span>
</div>
<div class="system-info-row">
<span class="info-label">打开文件数:</span>
<span class="info-value">{% raw %}{{ systemInfo.open_files }}{% endraw %}</span>
</div>
</div>
</el-col>
<el-col :span="8">
<div class="system-info-item">
<div class="system-info-row">
<span class="info-label">最后更新:</span>
<span class="info-value">{% raw %}{{ systemInfo.timestamp }}{% endraw %}</span>
</div>
</div>
</el-col>
</el-row>
</el-card>
</el-col>
</el-row>
<!-- 用户信息和统计数据 -->
<el-row :gutter="20" style="margin-top: 20px;">
@@ -166,66 +243,6 @@
</el-card>
</el-col>
</el-row>
<!-- 系统状态卡片移到顶部 -->
<el-row :gutter="20">
<el-col :span="24">
<el-card shadow="hover">
<div slot="header">
<span>系统状态</span>
<span class="system-info-summary">
操作系统: {% raw %}{{ systemInfo.os }} {{ systemInfo.os_version }}{% endraw %} |
Python版本: {% raw %}{{ systemInfo.python_version }}{% endraw %} |
运行时间: {% raw %}{{ formattedUptime }}{% endraw %} |
最后更新: {% raw %}{{ systemInfo.timestamp }}{% endraw %}
打开文件数: {% raw %}{{ systemInfo.open_files }}{% endraw %}
</span>
</div>
<el-row :gutter="20">
<!-- 左侧用户信息 -->
<el-col :span="6">
<div class="chart-container pie-chart-container user-info-chart">
<!-- 移除了"用户信息"标题 -->
<div v-if="currentUser.success" class="user-info-container">
<div class="user-avatar-container">
<img :src="currentUser.data.avatar" alt="用户头像" />
</div>
<div class="user-info-details">
<div class="user-info-item">
<span class="user-info-label">昵称:</span>
<span class="user-info-value">{% raw %}{{ currentUser.data.nickname || '未知用户' }}{% endraw %}</span>
</div>
<!-- 其他用户信息项保持不变 -->
<div class="user-info-item">
<span class="user-info-label">微信ID:</span>
<span class="user-info-value">{% raw %}{{ currentUser.data.wx_id }}{% endraw %}</span>
</div>
<div class="user-info-item" v-if="currentUser.data.mobile">
<span class="user-info-label">手机号:</span>
<span class="user-info-value">{% raw %}{{ currentUser.data.mobile }}{% endraw %}</span>
</div>
<div class="user-info-item" v-if="currentUser.data.home">
<span class="user-info-label">主目录:</span>
<span class="user-info-value user-home-path">{% raw %}{{ currentUser.data.home }}{% endraw %}</span>
</div>
</div>
</div>
<div v-else class="user-info-empty">
<i class="el-icon-warning"></i>
<div>{% raw %}{{ currentUser.message || '未获取到用户信息' }}{% endraw %}</div>
</div>
</div>
</el-col>
<!-- 移除中间系统信息部分,改为占位 -->
<el-col :span="18">
<!-- 占位,可以放置其他信息 -->
</el-col>
</el-row>
</el-card>
</el-col>
</el-row>
</div>
{% endblock %}
@@ -733,147 +750,85 @@
color: #606266;
}
/* 饼图容器样式 */
.pie-chart-container {
padding: 4px;
text-align: center;
margin-bottom: 0;
box-shadow: none;
}
.pie-chart-container h4 {
margin-top: 0;
margin-bottom: 4px;
font-size: 11px;
color: #606266;
}
/* 系统状态卡片样式 */
.system-info-item {
margin-bottom: 15px;
}
.system-info-row {
display: flex;
justify-content: space-between;
margin-bottom: 8px;
}
.system-update-time {
text-align: right;
font-size: 12px;
color: #909399;
margin-top: 10px;
}
/* 用户信息图表容器样式 */
.user-info-chart {
text-align: center;
height: 100%;
display: flex;
flex-direction: column;
padding: 5px;
margin-bottom: 0;
box-shadow: none;
}
/* 用户信息卡片样式 */
.user-info-container {
padding: 0;
display: flex;
flex-direction: column;
justify-content: center;
/* 调整高度与饼图完全一致 */
height: 100px;
align-items: center;
padding: 5px 0;
}
.user-avatar-container {
text-align: center;
margin-bottom: 5px;
margin-right: 10px;
}
.user-avatar-container img {
width: 45px; /* 进一步缩小头像 */
height: 45px;
width: 40px;
height: 40px;
border-radius: 50%;
border: 1px solid #fff; /* 减小边框 */
border: 1px solid #fff;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}
.user-info-details {
display: flex;
flex-direction: column;
gap: 3px; /* 减小间距 */
flex: 1;
}
.user-info-item {
display: flex;
align-items: center;
font-size: 11px; /* 进一步缩小字体 */
justify-content: center;
height: 16px; /* 固定每行高度 */
font-size: 12px;
line-height: 1.4;
margin-bottom: 2px;
}
.user-info-label {
width: 50px;
color: #606266;
font-weight: 500;
width: 45px;
flex-shrink: 0;
text-align: right;
padding-right: 5px;
}
.user-info-value {
color: #303133;
flex: 1;
word-break: break-all;
text-align: left;
max-width: 120px;
overflow: hidden;
text-overflow: ellipsis;
}
.user-home-path {
font-size: 10px;
white-space: nowrap;
}
.user-info-empty {
text-align: center;
color: #909399;
padding: 20px 0;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 10px 0;
}
.user-info-empty i {
font-size: 24px;
margin-bottom: 10px;
/* 系统信息卡片样式 */
.system-info-item {
padding: 5px 0;
}
.user-info-row {
.system-info-row {
display: flex;
justify-content: space-between;
margin-bottom: 12px;
line-height: 1.5;
font-size: 12px;
line-height: 1.4;
margin-bottom: 2px;
}
.info-label {
color: #606266;
font-weight: 500;
}
.info-value {
color: #303133;
text-align: right;
}
.system-update-time {
text-align: right;
font-size: 12px;
color: #909399;
margin-top: auto;
/* 卡片头部样式 */
.el-card__header {
padding: 10px 15px;
}
.el-card__body {
padding: 10px 15px;
}
</style>
{% endblock %}