用户信息显示优化
This commit is contained in:
@@ -182,25 +182,16 @@ class DashboardServer:
|
|||||||
|
|
||||||
# 获取用户详细信息
|
# 获取用户详细信息
|
||||||
user_info = self.wcf.get_user_info()
|
user_info = self.wcf.get_user_info()
|
||||||
self.logger.info(f"获取用户信息:: {user_info}")
|
self.logger.info(f"获取用户信息:{user_info}")
|
||||||
# 获取头像
|
|
||||||
avatar_path = None
|
|
||||||
try:
|
|
||||||
avatar_path = self.wcf.get_avatar(wx_id)
|
|
||||||
except Exception as e:
|
|
||||||
self.logger.warning(f"获取用户头像失败: {e}")
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"success": True,
|
"success": True,
|
||||||
"data": {
|
"data": {
|
||||||
"wx_id": wx_id,
|
"wx_id": user_info.get("wxid", wx_id),
|
||||||
"nickname": user_info.get("nickname", "未知用户"),
|
"nickname": user_info.get("name", "未知用户"),
|
||||||
"avatar": avatar_path,
|
"avatar": "logo.png", # 使用默认LOGO
|
||||||
"signature": user_info.get("signature", ""),
|
"mobile": user_info.get("mobile", ""),
|
||||||
"gender": user_info.get("gender", 0),
|
"home": user_info.get("home", "")
|
||||||
"country": user_info.get("country", ""),
|
|
||||||
"province": user_info.get("province", ""),
|
|
||||||
"city": user_info.get("city", "")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<el-col :span="6">
|
<el-col :span="6">
|
||||||
<div v-if="currentUser.success" style="display: flex; flex-direction: column; align-items: center;">
|
<div v-if="currentUser.success" style="display: flex; flex-direction: column; align-items: center;">
|
||||||
<div v-if="currentUser.data.avatar" style="margin-bottom: 10px;">
|
<div v-if="currentUser.data.avatar" style="margin-bottom: 10px;">
|
||||||
<img :src="'/static/images/' + currentUser.data.avatar" style="width: 80px; height: 80px; border-radius: 50%;" />
|
<img :src="'/static/' + currentUser.data.avatar" style="width: 80px; height: 80px; border-radius: 50%;" />
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<div style="font-size: 18px; font-weight: bold;">{% raw %}{{ currentUser.data.nickname }}{% endraw %}</div>
|
<div style="font-size: 18px; font-weight: bold;">{% raw %}{{ currentUser.data.nickname }}{% endraw %}</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user