加入登录账户信息

This commit is contained in:
liuwei
2025-04-11 17:51:46 +08:00
parent 89bac7123c
commit ea59ceeef2
4 changed files with 94 additions and 5 deletions

View File

@@ -6,6 +6,28 @@
<!-- 首页概览 -->
<div>
<el-row :gutter="20">
<el-col :span="4">
<el-card shadow="hover" class="stats-card">
<div slot="header">
<span>当前登录微信账号</span>
</div>
<div v-if="currentUser.success" style="display: flex; align-items: center;">
<div v-if="currentUser.data.avatar" style="margin-right: 15px;">
<img :src="'/static/images/' + currentUser.data.avatar" style="width: 60px; height: 60px; border-radius: 50%;" />
</div>
<div>
<div style="font-size: 18px; font-weight: bold;">{% raw %}{{ currentUser.data.nickname }}{% endraw %}</div>
<div style="font-size: 14px; color: #666;">微信号: {% raw %}{{ currentUser.data.wx_id }}{% endraw %}</div>
<div style="font-size: 12px; color: #999; margin-top: 5px;">{% raw %}{{ currentUser.data.signature || '暂无签名' }}{% endraw %}</div>
</div>
</div>
<div v-else style="text-align: center; color: #999;">
<i class="el-icon-warning" style="font-size: 24px;"></i>
<div>{% raw %}{{ currentUser.message || '未获取到用户信息' }}{% endraw %}</div>
</div>
</el-card>
</el-col>
<el-col :span="4">
<el-card shadow="hover" class="stats-card">
<div slot="header">
@@ -252,6 +274,8 @@
this.loadData();
// 加载系统信息
this.loadSystemInfo();
// 加载当前用户信息
this.loadCurrentUserInfo();
// 设置定时刷新系统信息每30秒
this.systemInfoTimer = setInterval(this.loadSystemInfo, 30000);
},
@@ -279,6 +303,21 @@
.catch(error => {
console.error('加载系统信息出错:', error);
});
},
// 添加获取当前用户信息的方法
loadCurrentUserInfo() {
axios.get('/api/current_user_info')
.then(response => {
this.currentUser = response.data;
})
.catch(error => {
console.error('加载当前用户信息出错:', error);
this.currentUser = {
success: false,
message: '获取用户信息失败',
data: {}
};
});
},
// 添加获取进度条状态的方法
getProgressStatus(value) {