加入签名信息显示

This commit is contained in:
liuwei
2025-06-12 09:16:38 +08:00
parent f9e53ca964
commit 6301a4baad
3 changed files with 13 additions and 6 deletions

View File

@@ -92,14 +92,14 @@ class DashboardServer:
app.secret_key = "stats_dashboard_secret_key"
# 禁用模板缓存使修改HTML文件后立即生效 False =重启才生效
app.config['TEMPLATES_AUTO_RELOAD'] = True
# 设置Werkzeug日志级别为DEBUG
import logging
logging.getLogger('werkzeug').setLevel(logging.ERROR)
# 将dashboard_server实例设置为app的属性
app.dashboard_server = self
# 配置静态文件访问
static_folder = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'static')
@@ -200,7 +200,8 @@ class DashboardServer:
"wxid": self.robot.wxid,
"nickName": self.robot.nickname,
"mobile": self.robot.phone,
"smallHeadImgUrl": self.robot.head_image
"smallHeadImgUrl": self.robot.head_image,
"signature": self.robot.signature
}
if not user_data:
return {"success": False, "message": "未获取到用户数据"}
@@ -212,7 +213,8 @@ class DashboardServer:
"nickname": user_data.get("nickName", "未知用户"),
"avatar": user_data.get("smallHeadImgUrl", "logo.png"), # 使用小头像URL
"mobile": user_data.get("mobile", ""),
"home": f"{user_data.get('province', '')}-{user_data.get('city', '')}" # 组合省市信息
"home": f"{user_data.get('province', '')}-{user_data.get('city', '')}", # 组合省市信息
"signature": user_data.get("signature", "")
}
}
except Exception as e:

View File

@@ -32,6 +32,10 @@
<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.signature">
<span class="user-info-label">签名:</span>
<span class="user-info-value">{% raw %}{{ currentUser.data.signature }}{% endraw %}</span>
</div>
</div>
</el-col>
</el-row>

View File

@@ -165,12 +165,13 @@ class Robot:
self.ipad_bot.nickname = profile.get("NickName").get("string")
self.ipad_bot.alias = profile.get("Alias")
self.ipad_bot.phone = profile.get("BindMobile").get("string")
self.ipad_bot.signature = profile.get("Signature")
# 更新Robot类的属性
self.wxid = self.ipad_bot.wxid
self.nickname = self.ipad_bot.nickname
self.alias = self.ipad_bot.alias
self.phone = self.ipad_bot.phone
self.signature = self.ipad_bot.signature
self.LOG.info(
f"wechat_ipad登录账号信息: wxid: {self.wxid} 昵称: {self.nickname} 微信号: {self.alias} 手机号: {self.phone}")