用户信息显示优化

This commit is contained in:
liuwei
2025-04-14 18:02:04 +08:00
parent 23c08b2951
commit 6178f254e0

View File

@@ -11,18 +11,36 @@
<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 %}
</span>
</div>
<el-row :gutter="20">
<!-- 左侧用户信息 -->
<el-col :span="6">
<div v-if="currentUser.success" class="user-info-container">
<div class="user-info-header">
<div v-if="currentUser.data.avatar" class="user-avatar">
<img :src="'/static/' + currentUser.data.avatar" alt="用户头像" />
<div class="user-avatar-container">
<img :src="'/static/' + 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-details">
<div class="user-nickname">{% raw %}{{ currentUser.data.nickname || '未知用户' }}{% endraw %}</div>
<div class="user-wxid">{% raw %}{{ currentUser.data.wx_id }}{% endraw %}</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>
@@ -32,24 +50,11 @@
</div>
</el-col>
<!-- 中间系统信息 -->
<!-- 移除中间系统信息部分,改为占位 -->
<el-col :span="6">
<div class="system-info-container">
<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 class="system-info-row">
<span class="info-label">运行时间:</span>
<span class="info-value">{% raw %}{{ formattedUptime }}{% endraw %}</span>
</div>
<div class="system-update-time">最后更新: {% raw %}{{ systemInfo.timestamp }}{% endraw %}</div>
</div>
<!-- 占位,可以放置其他信息 -->
</el-col>
<el-col :span="12">
<el-row :gutter="20">
<el-col :span="8">
@@ -58,6 +63,7 @@
<canvas id="cpuChart" width="80" height="80"></canvas>
</div>
</el-col>
<!-- 其他饼图保持不变 -->
<el-col :span="8">
<div class="chart-container pie-chart-container">
<h4>内存使用率: {% raw %}{{ systemInfo.memory_usage }}{% endraw %}%</h4>
@@ -726,5 +732,102 @@
color: #909399;
margin-top: auto;
}
/* 系统状态标题栏样式 */
.el-card__header {
position: relative;
}
.system-info-summary {
position: absolute;
right: 20px;
font-size: 12px;
color: #909399;
}
/* 用户信息容器样式调整 */
.user-info-container {
background-color: #f9f9f9;
border-radius: 4px;
padding: 15px;
height: 100%;
display: flex;
flex-direction: column;
}
.user-avatar-container {
text-align: center;
margin-bottom: 15px;
}
.user-avatar-container img {
width: 80px;
height: 80px;
border-radius: 50%;
border: 2px solid #fff;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.user-info-details {
display: flex;
flex-direction: column;
gap: 8px;
}
.user-info-item {
display: flex;
align-items: center;
}
.user-info-label {
width: 70px;
color: #606266;
font-weight: 500;
flex-shrink: 0;
}
.user-info-value {
color: #303133;
flex: 1;
word-break: break-all;
}
.user-home-path {
font-size: 12px;
}
/* 移除不再需要的样式 */
.user-info-header,
.user-avatar,
.user-details,
.user-nickname,
.user-wxid,
.system-info-container {
/* 这些类不再需要,但保留以防其他地方使用 */
}
.user-info-row {
display: flex;
justify-content: space-between;
margin-bottom: 12px;
line-height: 1.5;
}
.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;
}
</style>
{% endblock %}