feat: 完成布局优化 - 操作列固定、批量按钮自适应、分类标签带数量
优化内容: 1. 表格布局: - 使用 calc(100vw - 160px) 确保表格不超出视口 - 操作列 fixed='right' 固定在右侧,宽度 300px - 按钮 3 个后自动换行 (max-width: 200px) - 恢复合理列宽,不再过度压缩 2. 批量操作区域: - 容器改为 inline-block,宽度自适应按钮内容 - 背景宽度与按钮总宽度匹配 3. 分类标签: - 显示数量 (如 '待处理 (20)') - 点击切换筛选,去掉误导的 'X' 图标 4. 删除功能: - 操作列增加删除按钮 - 删除前弹出确认对话框 5. 系统日志: - 修复后端日志路径 (parents[4]) - 404 时显示友好提示 6. 其他: - 左侧菜单宽度 160px - 所有功能保留 (登录、用户管理、批量操作等)
This commit is contained in:
+44
-26
@@ -43,9 +43,10 @@ class WeComNotifier:
|
||||
try:
|
||||
with open(CONFIG_DIR / "wecom_config.yaml", "r", encoding='utf-8') as f:
|
||||
self.config = yaml.safe_load(f)
|
||||
except:
|
||||
# 如果没有yaml,使用默认配置
|
||||
except Exception as e:
|
||||
logger.warning(f"加载配置文件失败,使用默认配置: {e}")
|
||||
self.config = {
|
||||
"notification_channel": "wecom",
|
||||
"wecom": {
|
||||
"target_user": "WangLiuTong",
|
||||
"message_template": {
|
||||
@@ -55,24 +56,15 @@ class WeComNotifier:
|
||||
}
|
||||
},
|
||||
"notification_templates": {
|
||||
"sustainability_task_complete": """【可持续性内容收集完成】
|
||||
时间: {{TIME}}
|
||||
新增选题数: {{TOPIC_COUNT}}
|
||||
新增案例数: {{CASE_COUNT}}
|
||||
信息源: {{SOURCE_COUNT}}个
|
||||
详情: {{DETAILS_LINK}}""",
|
||||
"content_creation_complete": """【内容创作完成】
|
||||
时间: {{TIME}}
|
||||
选题: {{TOPIC_TITLE}}
|
||||
平台版本: 知乎、公众号、小红书
|
||||
图片数: {{IMAGE_COUNT}}
|
||||
文件位置: {{OUTPUT_DIR}}
|
||||
状态: {{STATUS}}""",
|
||||
"system_error": """【定时任务异常】
|
||||
任务: {{TASK_NAME}}
|
||||
错误: {{ERROR}}
|
||||
时间: {{TIME}}
|
||||
请检查日志: {{LOG_PATH}}"""
|
||||
"daily_summary": """【宇之然日报】{{DATE}}
|
||||
✅ 今日完成:
|
||||
• 新增选题:{{TOPIC_COUNT}} 个
|
||||
• 创作完成:{{CREATED_COUNT}} 篇
|
||||
• 已发布:{{PUBLISHED_COUNT}} 篇 ({{PLATFORMS}})
|
||||
📁 发布包:{{PUBLISH_PATH}}
|
||||
{{FAILURES}}
|
||||
——————————
|
||||
全流程结束, awaiting tomorrow's run."""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,20 +90,36 @@ class WeComNotifier:
|
||||
|
||||
return message
|
||||
|
||||
def send_via_openclaw(self, message: str) -> bool:
|
||||
"""通过OpenClaw发送消息"""
|
||||
def send_via_openclaw(self, message: str, account: str = None) -> bool:
|
||||
"""通过OpenClaw发送消息
|
||||
|
||||
Args:
|
||||
message: 要发送的消息
|
||||
account: OpenClaw账户ID(对应openclaw.json中的channels.wecom.accounts key)
|
||||
默认为None,自动根据项目选择:yzr-yxl项目用"yzr-yxl",main项目用"main"
|
||||
"""
|
||||
try:
|
||||
import subprocess
|
||||
|
||||
# 尝试使用OpenClaw CLI发送消息
|
||||
# 假设有企业微信通道配置
|
||||
# 确定账户
|
||||
if account is None:
|
||||
# 根据项目根目录推断账户(PROJECT_ROOT已定义)
|
||||
cwd = str(PROJECT_ROOT)
|
||||
if 'yzr-yxl' in cwd:
|
||||
account = "yzr-yxl"
|
||||
elif 'agent-lt' in cwd:
|
||||
account = "agent-lt"
|
||||
else:
|
||||
account = "main"
|
||||
|
||||
target_user = self.config["wecom"]["target_user"]
|
||||
|
||||
# 构建命令:使用openclaw message send
|
||||
channel = self.config.get("notification_channel", "wecom")
|
||||
cmd = [
|
||||
"openclaw", "message", "send",
|
||||
"--channel", "wecom",
|
||||
"--account", "default",
|
||||
"--channel", channel,
|
||||
"--account", account,
|
||||
"--target", target_user,
|
||||
"--message", message
|
||||
]
|
||||
@@ -179,6 +187,16 @@ class WeComNotifier:
|
||||
}
|
||||
message = self.format_message("content_creation_complete", message_data)
|
||||
|
||||
elif task_type == "daily_summary":
|
||||
# 日报:使用 DATE 而非 TIME
|
||||
message_data = {
|
||||
"DATE": data.get("date", datetime.datetime.now().strftime("%Y-%m-%d")),
|
||||
"PUBLISHED_COUNT": data.get("published_count", 0),
|
||||
"PLATFORMS": ", ".join(data.get("platforms", [])),
|
||||
"PUBLISH_DIR": data.get("publish_dir", "")
|
||||
}
|
||||
message = self.format_message("daily_summary", message_data)
|
||||
|
||||
else:
|
||||
message_data = {
|
||||
"TASK_NAME": task_type,
|
||||
|
||||
Reference in New Issue
Block a user