调整卡片高度

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 %} {% block content %}
<!-- 首页概览 --> <!-- 首页概览 -->
<div> <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;"> <el-row :gutter="20" style="margin-top: 20px;">
@@ -166,66 +243,6 @@
</el-card> </el-card>
</el-col> </el-col>
</el-row> </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> </div>
{% endblock %} {% endblock %}
@@ -733,147 +750,85 @@
color: #606266; 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 { .user-info-container {
padding: 0;
display: flex; display: flex;
flex-direction: column; align-items: center;
justify-content: center; padding: 5px 0;
/* 调整高度与饼图完全一致 */
height: 100px;
} }
.user-avatar-container { .user-avatar-container {
text-align: center; margin-right: 10px;
margin-bottom: 5px;
} }
.user-avatar-container img { .user-avatar-container img {
width: 45px; /* 进一步缩小头像 */ width: 40px;
height: 45px; height: 40px;
border-radius: 50%; border-radius: 50%;
border: 1px solid #fff; /* 减小边框 */ border: 1px solid #fff;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
} }
.user-info-details { .user-info-details {
display: flex; flex: 1;
flex-direction: column;
gap: 3px; /* 减小间距 */
} }
.user-info-item { .user-info-item {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 11px; /* 进一步缩小字体 */ font-size: 12px;
justify-content: center; line-height: 1.4;
height: 16px; /* 固定每行高度 */ margin-bottom: 2px;
} }
.user-info-label { .user-info-label {
width: 50px;
color: #606266; color: #606266;
font-weight: 500; width: 45px;
flex-shrink: 0; flex-shrink: 0;
text-align: right;
padding-right: 5px;
} }
.user-info-value { .user-info-value {
color: #303133; color: #303133;
flex: 1; flex: 1;
word-break: break-all;
text-align: left;
max-width: 120px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} white-space: nowrap;
.user-home-path {
font-size: 10px;
} }
.user-info-empty { .user-info-empty {
text-align: center; text-align: center;
color: #909399; color: #909399;
padding: 20px 0; padding: 10px 0;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
} }
.user-info-empty i { /* 系统信息卡片样式 */
font-size: 24px; .system-info-item {
margin-bottom: 10px; padding: 5px 0;
} }
.user-info-row { .system-info-row {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 12px; font-size: 12px;
line-height: 1.5; line-height: 1.4;
margin-bottom: 2px;
} }
.info-label { .info-label {
color: #606266; color: #606266;
font-weight: 500;
} }
.info-value { .info-value {
color: #303133; color: #303133;
text-align: right;
} }
.system-update-time { /* 卡片头部样式 */
text-align: right; .el-card__header {
font-size: 12px; padding: 10px 15px;
color: #909399; }
margin-top: auto;
.el-card__body {
padding: 10px 15px;
} }
</style> </style>
{% endblock %} {% endblock %}