feat: 展开运维导航并迁移通知接入文档

- 在顶部导航展示发布、项目接入、成员、设置和文档
- 提供舌吻运营后台返回入口和项目名称编辑
This commit is contained in:
湛兮
2026-11-13 23:27:51 +08:00
parent cbc04a1e2a
commit c264885ece
19 changed files with 1085 additions and 34 deletions
+3
View File
@@ -78,3 +78,6 @@ MIT License。环境文件与真实凭据不得进入 Git。
后端上线前需要执行 `20261028030000_notification_config` 迁移。数据库、真实企微投递与生产部署需分别验收。 后端上线前需要执行 `20261028030000_notification_config` 迁移。数据库、真实企微投递与生产部署需分别验收。
发布记录页消费服务端 `supersededBy` 与 `recoveredFrom` 展示“后续成功版本”和历史失败互链,保留原始状态。前端不自行推断发布已恢复。 发布记录页消费服务端 `supersededBy` 与 `recoveredFrom` 展示“后续成功版本”和历史失败互链,保留原始状态。前端不自行推断发布已恢复。
- 右上角可切回舌吻运营后台,顶部导航可进入通知接入文档。文档位于 `/guides/notifications`,包含截图和可下载的技能包。
- 超级管理员可在「项目接入 → 查看配置」修改项目显示名称。
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 57 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 100 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 64 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 75 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 73 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 78 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 65 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 48 KiB

+230
View File
@@ -0,0 +1,230 @@
{
"title": "企微消息推送 · 从创建到上线",
"intro": "让业务消息按你喜欢的样子抵达 💌 图文以 DevOps 通知为示例;配套 Skill 将相同的配置体验复用到任意业务平台,适配注册、充值、统计和告警。",
"updated": "2026-10-28",
"notice": "企微截图由用户提供;运维平台截图来自真实组件的隔离演示环境。标注只辅助定位,示例配置和截图不代表当前生产配置或验收结果。所有 Webhook 示例均为占位值。",
"steps": [
{
"id": "prepare",
"title": "开始前:账号、群聊与职责",
"lead": "这套方案通过企业内部群的 Webhook 主动推送消息。先准备接收通知的群,再配置负责发送的服务端。",
"bullets": [
"复用的是配置能力与交互,业务字段、数据来源和触发规则按项目适配;本文图片仍展示 DevOps 案例,不代表注册或充值功能已在当前平台上线。",
"没有企业管理员身份也可能创建:企业需要允许你创建消息推送,目标群也需要允许添加。若看不到入口,先核对内部群与群设置,再请管理员开通创建权限。",
"企微负责接收和呈现;DevOps 平台负责真实业务事件、通知时机、字段、模板、投递和重试。机器人名称不会自动连接 Jenkins。",
"本教程页面只提供图文教程和 skill 下载。实际通知偏好在运维平台的「设置 → 通知」维护;完整 Webhook 只保存在服务端。",
"本教程使用群消息推送,不涉及监听群聊、智能机器人对话或代发个人消息。"
]
},
{
"id": "wecom-entry",
"title": "1. 在企微群中添加消息推送",
"lead": "电脑企微进入目标内部群,打开群详情 → 消息推送。旧版入口可能显示为「群机器人」。",
"images": [
"01-wecom-entry"
],
"bullets": [
"点击「添加」,选择自定义消息推送。截图里已有的 devops 构建日志只是示例名称,你可以使用便于辨认的名字。",
"如果入口不存在或提示无权限,联系群主确认群管理设置,或请企业管理员为你开放创建消息推送权限;不需要索取企业管理员账号。"
]
},
{
"id": "wecom-create",
"title": "2. 填名称,复制完整 Webhook",
"lead": "名称、简介和图标方便群成员辨认。配置完成后复制完整 Webhook,并在企微保存。",
"images": [
"02-wecom-create"
],
"bullets": [
"名称可用「DevOps 发布通知」,简介说明推送哪些项目和结果。它们不负责决定发送内容,后续以平台配置为准。",
"将完整地址存入服务端 secret 或环境文件。截图中的地址已截断,不能从图片复制后直接使用。",
"截图、文档、Git、前端配置和日志都不保存完整 Webhook。若发现地址泄漏,按企微实际能力重置并同步服务端。"
]
},
{
"id": "server",
"title": "3. 接通服务端通知通道",
"lead": "由负责部署的人配置发送服务。企微使用 wecom 专用协议,随后重启或重新加载对应服务。",
"bullets": [
"NOTIFICATION_PROVIDER 设为 wecom;企微地址放 WECOM_WEBHOOK_URL。NOTIFICATION_WEBHOOK_URL 用于通用 JSON 网关,不能用它替代企微专用配置。",
"DEVOPS_PUBLIC_URL 填运维平台公开地址,用于通知中的发布详情链接。",
"核对密钥源文件、部署副本和进程环境,避免只改当前进程导致下次发布丢配置。先备份,只修改需要的键。",
"「已接入」表示服务端变量存在;供应商是否接受、群里是否实收要在测试和真实业务环节分别确认。"
],
"code": "NOTIFICATION_PROVIDER=wecom\nWECOM_WEBHOOK_URL=https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=replace-with-secret\nDEVOPS_PUBLIC_URL=https://devops.example.com"
},
{
"id": "events",
"title": "4. 选择什么时候通知",
"lead": "打开运维平台「设置 → 通知」。开启发布通知,再选择关心的业务时机。",
"images": [
"03-events"
],
"bullets": [
"可选创建发布、进入队列、发布成功、发布失败、发布取消和重新发布。系统默认六种全选。",
"只关心最终结果时,点击「只看发布结果」,会选择发布成功和发布失败;这一步要保存后才生效。",
"关闭发布通知后,仍能编辑和测试草稿;正式业务通知在保存后暂停。预览选择某种时机不会自动启用它。",
"保存需要平台超级管理员权限,和企微企业管理员身份是两套权限。"
]
},
{
"id": "fields",
"title": "5. 挑选字段,调整显示顺序",
"lead": "勾选消息要展示的信息,再用上移 / 下移调整顺序。缺少真实数据时自动略过。",
"images": [
"04-fields"
],
"bullets": [
"共有 11 种字段:项目、环境、分支/标签、状态、操作者、构建编号、耗时、提交 SHA、创建时间、发布单 ID、失败摘要。",
"字段顺序直接影响正文顺序。取消勾选后,预设正文和对应字段变量都不再显示它;你自己写下的固定文字不会被自动删除。",
"「附上发布详情链接」和「附上构建日志链接」独立控制自动链接。真实记录没有构建链接时会略过,预览中的示例链接不可当成真实构建。",
"失败摘要只在有错误数据时出现,耗时需要有效开始/结束时间。"
]
},
{
"id": "styles",
"title": "6. 选信封,加一点 emoji",
"lead": "三种样式共用同一份业务数据,选择适合群聊的信息密度。",
"images": [
"05-styles"
],
"bullets": [
"💌 软萌信笺:轻量问候、字段 emoji 和分行引用;🫧 清爽简报:清晰分行、减少点缀;⚡ 极简速报:把字段收进一则短消息。",
"「点缀 emoji」影响自动标题、问候与字段点缀,不删除你在标题、正文或信尾手写的 emoji。",
"当前采用 Markdown,可控制标题、加粗、引用与链接。消息气泡、背景和字体由企微客户端统一呈现。",
"正文为空时使用选定的预设;填写自定义正文后,以自定义内容优先,预设仍会影响 {{fields}} 和 {{greeting}} 的展开。"
]
},
{
"id": "templates",
"title": "7. 编辑标题、正文与信尾",
"lead": "从预设开始,按需展开「自定义正文」。变量会在预览和真实业务中由同一渲染器展开。",
"images": [
"06-custom-template"
],
"bullets": [
"标题保持单行,可用 {{emoji}}、{{eventTitle}} 和已勾选的字段,例如 {{projectKey}}。",
"正文可插入 {{greeting}}、{{fields}}、{{links}} 和具体字段名。点击变量按钮会插入正文;字段变量仍受勾选约束。",
"留空正文即可恢复预设排版。信尾可以写一句简短的话;不要把密钥或敏感错误原文写进模板。",
"未知变量、空标题、重复字段和超长内容会被拒绝。当前实现按 UTF-8 限制为 3900 字节,给测试标记留出余量。"
],
"code": "标题:{{emoji}} {{eventTitle}} · {{projectKey}}\n\n正文示例:\n{{greeting}}\n\n{{fields}}\n\n{{links}}\n\n信尾:今天也在认真把事情做好 🌷"
},
{
"id": "preview-test",
"title": "8. 预览,再发送一封测试信",
"lead": "右侧可切换预览成功、失败等时机。先看当前草稿,再决定是否实际发送。",
"images": [
"07-test-confirmation"
],
"bullets": [
"预览使用明确标注的示例数据,不创建发布单、不触发构建、不发送消息。切换预览时机会改变示例,不改变已保存的订阅。",
"点击「发送一条测试消息」,核对确认框中的目标通道,再点击「发送测试消息」。会向当前配置的群发送,使用当前草稿,并带「通知测试」标记。",
"测试不会自动保存偏好,暂停正式通知也能单独测试。后端有 10 秒限流,重复点击时等待窗口结束即可。",
"截图只展示隔离演示中的确认框,拍摄过程没有向真实企微群发送消息。"
]
},
{
"id": "save-receive",
"title": "9. 保存配置,核对群内实收",
"lead": "确认草稿后点击「保存配置」。后续业务通知使用已保存的版本。",
"images": [
"08-wecom-received"
],
"bullets": [
"保存成功后重新读取,确认字段、时机和样式仍一致。离开页面会提示未保存修改;保存返回 409 时说明配置已被他人更新,应重读再比较。",
"企微接口 HTTP 200 还不够,业务响应 errcode=0 才表示接口接受。群里实际看到消息,才完成目标群实收确认。",
"实收截图由用户提供,展示先前测试消息的样式;它不代替你的新模板、当前目标群或真实发布事件验收。",
"最后触发一次已授权的真实业务事件,核对时机、真实字段、详情链接和投递记录。测试消息成功不等于所有业务链路都已完成验收。"
]
},
{
"id": "implementation-release",
"title": "10. 实现、迁移与上线验收",
"lead": "如果要在其他项目复用,先核对已有架构。开发、提交、推送和部署按本次授权分别执行。",
"bullets": [
"前端只调用本方后端;后端提供读取/保存/预览/测试接口,统一渲染器处理预览、测试、真实事件和重试,HTTP 客户端检查企微 errcode。",
"本例偏好保存在 notification_configs,version 防止覆盖他人更新;Outbox 保存事件、状态、次数与重试时间。记录去重不是跨进程恰好一次投递的保证。",
"发布前执行相关测试、lint、类型检查与构建,备份数据库。先发后端并执行 20261028030000_notification_config 迁移,检查迁移记录、新表和健康,再发前端。",
"核对 Jenkins checkout SHA、公网资源、已授权接口的读取/预览/保存和落库。用实际结果区分代码测试、供应商接受、群内实收和真实业务验收。",
"切换机器人前查看历史待重试记录,避免旧通知集中补发。关闭的通知时机会停止相应自动重试,再开启不会自动恢复 dead。"
],
"code": "相对于 API 根地址:\nGET /notifications/config\nPUT /notifications/config { preferences, version }\nPOST /notifications/config/preview { preferences, event }\nPOST /notifications/config/test { preferences, event, confirmed: true }\n\n本例数据库迁移:20261028030000_notification_config"
},
{
"id": "troubleshooting",
"title": "11. 没收到消息时怎么查",
"lead": "沿着「权限 → 配置 → 订阅 → 响应 → 记录 → 实收」逐项定位,不用反复触发真实发布。",
"bullets": [
"没有添加入口:看内部群、群管理设置和企业的创建成员范围。",
"提示缺少 NOTIFICATION_WEBHOOK_URL:检查是否误选 generic,直连企微应使用 wecom 和 WECOM_WEBHOOK_URL。",
"显示已接入但没收到:核对进程环境、机器人是否仍在群、通知是否开启、时机是否勾选、企微业务码和 Outbox 错误。",
"预览与实收不同:看草稿是否保存、真实字段是否缺失、自定义正文是否覆盖预设,以及客户端排版差异。",
"409 需要重读版本;429 需要等待;dead 不再自动重试。只有明确了目标、范围和授权,才手动补发历史通知。",
"通知失败独立记录,不改变真实部署结果。成功构建也不等于服务实时健康。"
]
},
{
"id": "reuse-skill",
"title": "12. 把流程交给 Codex Skill",
"lead": "给 Codex Webhook 和目标业务需求,它会在目标项目复用相同的配置界面与交互,再接入真实数据和触发规则。支持业务事件、定时统计和按需的阈值提醒。",
"bullets": [
"压缩包根目录是 wecom-notification-integration,解压到 ~/.codex/skills/,最终路径应为 ~/.codex/skills/wecom-notification-integration/SKILL.md,避免多套一层目录。",
"刷新技能列表后可用 $wecom-notification-integration 调用,也可由匹配任务自动选择。",
"告诉 Codex 目标项目、消息内容、触发需求和已授权范围。它会优先从现有代码识别数据口径、权限和技术栈,缺少关键业务定义时再询问;Webhook 本身不能推导注册人数或充值金额。",
"固定复用开关、字段勾选/排序、三种样式、emoji、模板/变量/信尾、链接、实时预览、草稿测试、保存与持久化。注册/充值主题使用自己的字段与时机,多个主题分别保存。",
"技能包自带两张界面参考原图,离开本仓库也可对照复现。目标系统沿用自己的前后端、数据库、权限和调度设施;接收端按实际 Webhook 协议适配,不强制采用原 DevOps 技术栈。",
"项目中保留技能源与图文内容源;下载包可重复生成,避免网页、README 和安装版各说一套。"
],
"code": "示例一:\n请使用 $wecom-notification-integration,在当前平台复用这套通知配置。\n每天北京时间 09:00 向我给的 Webhook 推送昨天注册人数,口径沿用现有注册统计。\n\n示例二:\n在当前订单平台复用同样的通知配置,充值成功后推送金额和币种,\n支持勾选字段、调整顺序、编辑模板、预览和测试。\n\nWebhook 只放服务端;真实发送、提交推送和部署按本次授权范围执行。"
}
],
"captions": {
"01-wecom-entry": [
"点击「添加」,开始创建群消息推送。"
],
"02-wecom-create": [
"填写方便辨认的推送名称与简介。",
"复制完整 Webhook,只放到服务端密钥配置。",
"核对信息后在企微保存。"
],
"03-events": [
"开启或暂停业务发布通知。",
"按需选择通知时机,或只看成功/失败结果。",
"右侧显示示例预览,与订阅时机相互独立。"
],
"04-fields": [
"勾选需要的字段,缺少真实数据时会略过。",
"上移 / 下移调整正文顺序。",
"发布详情与构建日志链接可以分别开关。"
],
"05-styles": [
"选择软萌信笺、清爽简报或极简速报。",
"控制自动 emoji 点缀。",
"标题与信尾可继续编辑,右侧实时预览。"
],
"06-custom-template": [
"展开自定义正文,留空时恢复预设。",
"插入变量并编写 Markdown。",
"预览展示当前草稿,仍需保存后用于真实业务。"
],
"07-test-confirmation": [
"核对当前通道和测试标记,确认后才实际发送;本截图未点击发送。"
],
"08-wecom-received": []
},
"references": [
{
"label": "腾讯官方:企微消息推送创建入口",
"url": "https://cloud.tencent.com/document/product/1759/128391"
},
{
"label": "腾讯官方:内部群通知接入与限制",
"url": "https://cloud.tencent.com/document/product/248/50413"
},
{
"label": "企微消息推送协议",
"url": "https://developer.work.weixin.qq.com/document/path/99110"
}
]
}
+286
View File
@@ -0,0 +1,286 @@
{
"01-wecom-entry": {
"width": 480,
"height": 510,
"source": "用户提供的企微客户端截图",
"annotations": [
{
"number": 1,
"rect": {
"x": 26,
"y": 118,
"width": 429,
"height": 49
},
"badge": {
"x": 435,
"y": 98
}
}
],
"format": "png"
},
"02-wecom-create": {
"width": 480,
"height": 530,
"source": "用户提供的企微客户端截图,Webhook 已截断",
"annotations": [
{
"number": 1,
"rect": {
"x": 85,
"y": 158,
"width": 331,
"height": 125
},
"badge": {
"x": 440,
"y": 139
}
},
{
"number": 2,
"rect": {
"x": 154,
"y": 402,
"width": 292,
"height": 31
},
"badge": {
"x": 112,
"y": 454
}
},
{
"number": 3,
"rect": {
"x": 247,
"y": 475,
"width": 215,
"height": 31
},
"badge": {
"x": 440,
"y": 455
}
}
],
"format": "png"
},
"03-events": {
"width": 1265,
"height": 712,
"source": "真实 DevOps 组件的本地隔离演示截图",
"annotations": [
{
"number": 1,
"rect": {
"x": 764.435546875,
"y": 357.18203125,
"width": 39.53125,
"height": 31.644444444444446
},
"badge": {
"x": 828.1796875,
"y": 372.81111111111113
}
},
{
"number": 2,
"rect": {
"x": 76.591796875,
"y": 445.98116319444443,
"width": 727.375,
"height": 84.05555555555556
},
"badge": {
"x": 35.578125,
"y": 488.00894097222226
}
},
{
"number": 3,
"rect": {
"x": 875.123046875,
"y": 413.2551215277778,
"width": 300.4375,
"height": 31.644444444444446
},
"badge": {
"x": 832.1328125,
"y": 429.1777777777778
}
}
],
"format": "jpeg"
},
"04-fields": {
"width": 1265,
"height": 712,
"source": "真实 DevOps 组件的本地隔离演示截图",
"annotations": [
{
"number": 1,
"rect": {
"height": 129.54444444444445,
"width": 727.375,
"x": 76.591796875,
"y": 123.20164930555556
},
"badge": {
"x": 35.578125,
"y": 187.9738715277778
}
},
{
"number": 2,
"rect": {
"height": 52.41111111111111,
"width": 727.375,
"x": 76.591796875,
"y": 264.6127604166667
},
"badge": {
"x": 35.578125,
"y": 290.81831597222225
}
},
{
"number": 3,
"rect": {
"height": 41.53333333333333,
"width": 727.375,
"x": 76.591796875,
"y": 317.02387152777777
},
"badge": {
"x": 35.578125,
"y": 337.7905381944445
}
}
],
"format": "jpeg"
},
"05-styles": {
"width": 1265,
"height": 712,
"source": "真实 DevOps 组件的本地隔离演示截图",
"annotations": [
{
"number": 1,
"rect": {
"height": 109.76666666666667,
"width": 727.375,
"x": 76.591796875,
"y": 200.92213541666666
},
"badge": {
"x": 35.578125,
"y": 255.80546875000002
}
},
{
"number": 2,
"rect": {
"height": 23.733333333333334,
"width": 91.18438720703125,
"x": 712.7824096679688,
"y": 147.72300347222222
},
"badge": {
"x": 828.1796875,
"y": 159.2111111111111
}
},
{
"number": 3,
"rect": {
"height": 234.86111111111111,
"width": 727.375,
"x": 76.591796875,
"y": 332.4443576388889
},
"badge": {
"x": 35.578125,
"y": 449.87491319444445
}
}
],
"format": "jpeg"
},
"06-custom-template": {
"width": 1265,
"height": 712,
"source": "真实 DevOps 组件的本地隔离演示草稿,未保存到生产",
"annotations": [
{
"number": 1,
"rect": {
"height": 16.316666666666666,
"width": 727.375,
"x": 76.591796875,
"y": 205.86657986111112
},
"badge": {
"x": 35.578125,
"y": 214.02491319444445
}
},
{
"number": 2,
"rect": {
"height": 188.8777777777778,
"width": 727.375,
"x": 76.591796875,
"y": 247.8943576388889
},
"badge": {
"x": 35.578125,
"y": 342.3332465277778
}
},
{
"number": 3,
"rect": {
"height": 348.4674479166667,
"width": 300.4375,
"x": 875.123046875,
"y": 95.72135416666667
},
"badge": {
"x": 832.1328125,
"y": 158.22222222222223
}
}
],
"format": "jpeg"
},
"07-test-confirmation": {
"width": 1280,
"height": 720,
"source": "本地隔离演示的确认框,拍摄后取消发送",
"annotations": [
{
"number": 1,
"rect": {
"height": 152.0,
"width": 420.0,
"x": 430.0,
"y": 284.0
},
"badge": {
"x": 390.0,
"y": 360.0
}
}
],
"format": "jpeg"
},
"08-wecom-received": {
"width": 302,
"height": 212,
"source": "用户提供的先前企微测试消息实收截图",
"annotations": [],
"format": "png"
}
}
+36 -33
View File
@@ -1,13 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { ChatLineRound, Monitor, MoreFilled, Refresh, SwitchButton } from '@element-plus/icons-vue' import { ChatLineRound, Monitor, Refresh, SwitchButton } from '@element-plus/icons-vue'
import { computed, onMounted, onUnmounted } from 'vue' import { computed, onMounted, onUnmounted } from 'vue'
import { useRoute, useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import GlobalAgentDrawer from '../components/GlobalAgentDrawer.vue' import GlobalAgentDrawer from '../components/GlobalAgentDrawer.vue'
import { useAssistantStore } from '../stores/assistant' import { useAssistantStore } from '../stores/assistant'
import { usePlatformStore } from '../stores/platform' import { usePlatformStore } from '../stores/platform'
import { useSessionStore } from '../stores/session' import { useSessionStore } from '../stores/session'
const route = useRoute()
const router = useRouter() const router = useRouter()
const platform = usePlatformStore() const platform = usePlatformStore()
const session = useSessionStore() const session = useSessionStore()
@@ -68,12 +67,16 @@ async function logout() {
<RouterLink class="brand" to="/overview" aria-label="DevOps 项目" <RouterLink class="brand" to="/overview" aria-label="DevOps 项目"
><ElIcon aria-hidden="true"><Monitor /></ElIcon><span>DevOps</span></RouterLink ><ElIcon aria-hidden="true"><Monitor /></ElIcon><span>DevOps</span></RouterLink
> >
<nav class="primary-nav" aria-label="主要导航"> <nav class="primary-nav" aria-label="运维导航">
<RouterLink to="/overview" :aria-current="route.name === 'overview' ? 'page' : undefined" <RouterLink to="/overview">项目</RouterLink>
>项目</RouterLink <RouterLink to="/runs">记录</RouterLink>
><RouterLink to="/runs" :aria-current="route.name === 'runs' ? 'page' : undefined" <RouterLink v-if="canPublish" to="/releases">发起发布</RouterLink>
>记录</RouterLink <template v-if="session.role === 'super_admin'">
> <RouterLink to="/projects">项目接入</RouterLink>
<RouterLink to="/members">成员权限</RouterLink>
<RouterLink to="/settings">设置</RouterLink>
<RouterLink to="/guides/notifications">通知文档</RouterLink>
</template>
</nav> </nav>
<div class="topbar-actions"> <div class="topbar-actions">
<ElButton <ElButton
@@ -89,23 +92,9 @@ async function logout() {
:aria-expanded="agentOpen" :aria-expanded="agentOpen"
@click="agentOpen = !agentOpen" @click="agentOpen = !agentOpen"
>助手</ElButton >助手</ElButton
><ElDropdown trigger="click"
><ElButton text :icon="MoreFilled" aria-label="更多功能" /><template #dropdown
><ElDropdownMenu
><ElDropdownItem v-if="canPublish"
><RouterLink to="/releases">发起发布</RouterLink></ElDropdownItem
><ElDropdownItem v-if="session.role === 'super_admin'"
><RouterLink to="/projects">项目接入</RouterLink></ElDropdownItem
><ElDropdownItem v-if="session.role === 'super_admin'"
><RouterLink to="/members">成员权限</RouterLink></ElDropdownItem
><ElDropdownItem v-if="session.role === 'super_admin'"
><RouterLink to="/settings">设置</RouterLink></ElDropdownItem
><ElDropdownItem divided :icon="SwitchButton" @click="logout"
>退出 {{ session.displayName || session.operator }}</ElDropdownItem
></ElDropdownMenu
></template
></ElDropdown
> >
<a class="system-link" href="https://admin.dev.mrzhan.top/">舌吻运营后台</a>
<ElButton text :icon="SwitchButton" aria-label="退出登录" title="退出登录" @click="logout" />
</div> </div>
</div> </div>
</header> </header>
@@ -154,7 +143,7 @@ async function logout() {
.topbar-inner { .topbar-inner {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 44px; gap: 24px;
height: 100%; height: 100%;
max-width: 1220px; max-width: 1220px;
padding: 0 30px; padding: 0 30px;
@@ -181,8 +170,9 @@ async function logout() {
} }
.primary-nav { .primary-nav {
display: flex; display: flex;
gap: 26px; gap: 18px;
height: 100%; height: 100%;
white-space: nowrap;
} }
.primary-nav a { .primary-nav a {
display: grid; display: grid;
@@ -206,6 +196,11 @@ async function logout() {
gap: 3px; gap: 3px;
margin-left: auto; margin-left: auto;
} }
.system-link {
white-space: nowrap;
font-size: 13px;
color: var(--accent);
}
.main-area { .main-area {
max-width: 1220px; max-width: 1220px;
margin: 0 auto; margin: 0 auto;
@@ -220,14 +215,22 @@ async function logout() {
color: var(--text-muted); color: var(--text-muted);
font-size: 13px; font-size: 13px;
} }
@media (max-width: 650px) { @media (max-width: 950px) {
.topbar { .topbar { height: auto; }
height: 58px;
}
.topbar-inner { .topbar-inner {
padding: 0 16px; display: grid;
gap: 23px; grid-template-columns: auto minmax(0, 1fr);
padding: 10px 16px 0;
gap: 0 12px;
} }
.primary-nav {
grid-column: 1 / -1;
grid-row: 2;
min-height: 42px;
overflow-x: auto;
}
}
@media (max-width: 650px) {
.brand { .brand {
font-size: 15px; font-size: 15px;
} }
+7
View File
@@ -8,6 +8,7 @@ const ProjectsView = () => import('../views/ProjectsView.vue')
const MembersView = () => import('../views/MembersView.vue') const MembersView = () => import('../views/MembersView.vue')
const ReleaseCenterView = () => import('../views/ReleaseCenterView.vue') const ReleaseCenterView = () => import('../views/ReleaseCenterView.vue')
const RunsView = () => import('../views/RunsView.vue') const RunsView = () => import('../views/RunsView.vue')
const NotificationGuide = () => import('../views/NotificationGuide.vue')
const SettingsView = () => import('../views/SettingsView.vue') const SettingsView = () => import('../views/SettingsView.vue')
const routes: RouteRecordRaw[] = [ const routes: RouteRecordRaw[] = [
@@ -56,6 +57,12 @@ const routes: RouteRecordRaw[] = [
path: 'agent', path: 'agent',
redirect: '/overview', redirect: '/overview',
}, },
{
path: 'guides/notifications',
name: 'notification-guide',
component: NotificationGuide,
meta: { superAdminOnly: true },
},
{ {
path: 'settings', path: 'settings',
name: 'settings', name: 'settings',
+5
View File
@@ -398,6 +398,11 @@ export const devopsApi = {
return toIntegrationStatuses(await fetchHealth()) return toIntegrationStatuses(await fetchHealth())
}, },
async renameProject(key: string, name: string): Promise<{ name: string }> {
const { data } = await http.patch<{ name: string }>(`/projects/${encodeURIComponent(key)}/name`, { name })
return data
},
async getProjects(): Promise<ProjectConfig[]> { async getProjects(): Promise<ProjectConfig[]> {
lastDataSource = 'backend' lastDataSource = 'backend'
return toProjectConfigs(await fetchProjects()) return toProjectConfigs(await fetchProjects())
+2
View File
@@ -141,6 +141,7 @@ function accountLabel() {
<template> <template>
<main class="login-page"> <main class="login-page">
<a class="text-link system-return" href="https://admin.dev.mrzhan.top/">切回舌吻运营后台</a>
<section class="login-panel"> <section class="login-panel">
<div class="login-copy"> <div class="login-copy">
<ElIcon><Monitor /></ElIcon> <ElIcon><Monitor /></ElIcon>
@@ -242,6 +243,7 @@ function accountLabel() {
</template> </template>
<style scoped> <style scoped>
.system-return { position: absolute; top: 20px; right: 24px; }
.login-page { .login-page {
display: grid; display: grid;
min-height: 100vh; min-height: 100vh;
+478
View File
@@ -0,0 +1,478 @@
<script setup lang="ts">
/** 消息推送图文教程:共享内容源、截图来源、编号标注和技能下载,保持目录与阅读位置同步。 */
import { ElImage } from "element-plus";
import {
nextTick,
onActivated,
onBeforeUnmount,
onMounted,
ref,
watch
} from "vue";
import guide from "../content/notifications/guide.json";
import screenshotSizes from "../content/notifications/screenshots.json";
// 为懒加载截图预留真实比例,避免图片出现后章节位置发生跳动。
const sizes = screenshotSizes as Record<
string,
{ width: number; height: number; source: string }
>;
const page = ref<HTMLElement>(),
body = ref<HTMLElement>(),
toc = ref<HTMLElement>();
const captions: Record<string, string[]> = guide.captions;
const activeId = ref(guide.steps[0].id);
let frame = 0,
observer: ResizeObserver | undefined;
/** 正文是唯一阅读滚动容器,懒加载图片改变章节高度后也重新判定位置。 */
function updateReadingPosition() {
frame = 0;
if (!page.value?.offsetWidth || !body.value) return;
const available =
window.innerHeight - page.value.getBoundingClientRect().top - 24;
page.value.style.setProperty(
"--guide-height",
`${Math.max(360, available)}px`
);
const sections = Array.from(
body.value.querySelectorAll<HTMLElement>(".guide-section")
);
const top = body.value.getBoundingClientRect().top + 24;
let current: string | undefined = sections[0]?.id;
for (const section of sections) {
if (section.getBoundingClientRect().top <= top) current = section.id;
else break;
}
// 最后一章可能不足一屏;滚到底部时仍须选中它。
if (
body.value.scrollTop + body.value.clientHeight >=
body.value.scrollHeight - 2
)
current = sections.at(-1)?.id;
if (current) activeId.value = current.replace(/^guide-/, "");
}
function scheduleUpdate() {
if (!frame) frame = requestAnimationFrame(updateReadingPosition);
}
onMounted(() => {
window.addEventListener("resize", scheduleUpdate);
observer = new ResizeObserver(scheduleUpdate);
if (page.value) observer.observe(page.value);
if (body.value) {
observer.observe(body.value);
body.value
.querySelectorAll(".guide-section")
.forEach(section => observer!.observe(section));
}
scheduleUpdate();
});
onActivated(scheduleUpdate);
onBeforeUnmount(() => {
window.removeEventListener("resize", scheduleUpdate);
observer?.disconnect();
cancelAnimationFrame(frame);
});
watch(activeId, async id => {
await nextTick();
const button = toc.value?.querySelector<HTMLElement>(
`[data-section="${id}"]`
);
if (!button || !toc.value) return;
const item = button.getBoundingClientRect(),
menu = toc.value.getBoundingClientRect();
// 仅移动目录内部,避免 scrollIntoView 带动后台外层容器。
if (item.top < menu.top || item.bottom > menu.bottom)
toc.value.scrollTop +=
item.top - menu.top - toc.value.clientHeight / 2 + item.height / 2;
});
const images = guide.steps.flatMap(step =>
(step.images ?? []).map(image => `/guides/notifications/${image}.svg`)
);
/** 在当前二级页内滚动,不修改hash路由,也不触发任何配置保存或消息投递。 */
function jump(id: string) {
const section = body.value?.querySelector<HTMLElement>(`#guide-${id}`);
if (!section || !body.value) return;
body.value.scrollTo({
top:
body.value.scrollTop +
section.getBoundingClientRect().top -
body.value.getBoundingClientRect().top,
behavior: window.matchMedia("(prefers-reduced-motion: reduce)").matches
? "instant"
: "smooth"
});
}
</script>
<template>
<div ref="page" class="notification-guide">
<header class="guide-heading">
<div>
<el-tag type="info">企微篇 · {{ images.length }} 张操作图</el-tag>
<h1>{{ guide.title }}</h1>
<p>{{ guide.intro }}</p>
</div>
<div class="guide-actions">
<a
class="guide-action"
href="/settings?tab=notifications"
>打开通知配置 ↗</a
>
<a
class="guide-action primary"
href="/guides/notifications/wecom-notification-integration.zip"
download
>下载 Codex Skill</a
>
</div>
</header>
<el-alert :title="guide.notice" type="info" :closable="false" />
<div class="guide-layout">
<nav class="guide-toc" aria-label="教程目录">
<strong>本页目录</strong>
<div ref="toc" class="guide-links">
<button
v-for="step in guide.steps"
:key="step.id"
type="button"
:data-section="step.id"
:class="{ active: activeId === step.id }"
:aria-current="activeId === step.id ? 'location' : undefined"
@click="jump(step.id)"
>
{{ step.title }}
</button>
</div>
</nav>
<article
ref="body"
class="guide-body"
tabindex="0"
aria-label="教程正文"
@scroll="scheduleUpdate"
>
<section
v-for="step in guide.steps"
:id="`guide-${step.id}`"
:key="step.id"
class="guide-section"
>
<h2>{{ step.title }}</h2>
<p class="guide-lead">{{ step.lead }}</p>
<figure v-for="image in step.images ?? []" :key="image">
<ElImage
:src="`/guides/notifications/${image}.svg`"
:style="{
aspectRatio: `${sizes[image].width} / ${sizes[image].height}`,
maxWidth: `${sizes[image].width}px`
}"
:alt="`${step.title},${sizes[image].source}`"
:preview-src-list="images"
:initial-index="
images.indexOf(`/guides/notifications/${image}.svg`)
"
preview-teleported
lazy
fit="contain"
><template #error
><div class="image-error">
教程图片加载失败,请刷新重试。
</div></template
></ElImage
>
<figcaption>
{{ sizes[image].source }} · 点击放大<span
v-if="captions[image].length"
>
· 编号对应下方操作</span
>
</figcaption>
<ol v-if="captions[image].length" class="guide-callouts">
<li v-for="note in captions[image]" :key="note">
{{ note }}
</li>
</ol>
</figure>
<ul>
<li v-for="line in step.bullets" :key="line">{{ line }}</li>
</ul>
<pre v-if="'code' in step"><code>{{ step.code }}</code></pre>
</section>
<footer class="guide-footer">
<h2>官方参考与维护</h2>
<ul>
<li v-for="reference in guide.references" :key="reference.url">
<a :href="reference.url" target="_blank" rel="noopener noreferrer"
>{{ reference.label }} ↗</a
>
</li>
</ul>
<p>
教程更新:{{ guide.updated }}。网页与图文 README
共用内容源,截图保留来源;配置操作和实际发送在运维平台完成。
</p>
<div class="guide-actions">
<a
class="guide-action primary"
href="/guides/notifications/wecom-notification-integration.zip"
download
>下载 Codex Skill</a
>
</div>
</footer>
</article>
</div>
</div>
</template>
<style scoped>
.notification-guide {
display: flex;
flex-direction: column;
max-width: 1440px;
height: var(--guide-height, calc(100dvh - 134px));
min-height: 360px;
margin: 0 auto;
overflow: hidden;
}
.guide-heading {
display: flex;
gap: 24px;
align-items: flex-start;
justify-content: space-between;
margin-bottom: 24px;
}
.guide-heading h1 {
margin: 12px 0;
font-size: 28px;
}
.guide-heading p {
max-width: 800px;
line-height: 1.8;
color: var(--el-text-color-secondary);
}
.guide-layout {
display: grid;
flex: 1;
grid-template-columns: 220px minmax(0, 1fr);
gap: 32px;
min-height: 0;
margin-top: 24px;
}
.guide-toc {
display: flex;
flex-direction: column;
gap: 6px;
min-height: 0;
max-height: 100%;
padding: 16px;
overflow: hidden;
background: var(--el-bg-color);
border: 1px solid var(--el-border-color-lighter);
border-radius: 8px;
}
.guide-links {
display: flex;
flex-direction: column;
gap: 6px;
min-height: 0;
overflow-y: auto;
}
.guide-toc strong {
flex-shrink: 0;
padding: 4px 8px 12px;
}
.guide-toc button {
padding: 8px;
font: inherit;
font-size: 13px;
color: var(--el-text-color-regular);
text-align: left;
cursor: pointer;
background: transparent;
border: 0;
border-radius: 4px;
}
.guide-toc button.active {
font-weight: 600;
color: var(--el-color-primary);
background: var(--el-color-primary-light-9);
box-shadow: inset 3px 0 var(--el-color-primary);
}
.guide-body {
min-width: 0;
min-height: 0;
overflow-y: auto;
overscroll-behavior: contain;
}
.guide-body:focus-visible {
outline: 2px solid var(--el-color-primary);
outline-offset: -2px;
}
.guide-toc button:hover {
color: var(--el-color-primary);
background: var(--el-fill-color-light);
}
.guide-toc button:focus-visible {
outline: 2px solid var(--el-color-primary);
outline-offset: 2px;
}
.guide-section {
padding: 24px;
margin-bottom: 24px;
scroll-margin-top: 0;
background: var(--el-bg-color);
border: 1px solid var(--el-border-color-lighter);
border-radius: 8px;
}
.guide-section h2 {
margin: 0 0 12px;
font-size: 21px;
}
.guide-lead {
line-height: 1.8;
}
.guide-section figure {
margin: 20px 0;
}
.guide-section .el-image {
display: block;
width: 100%;
min-height: 100px;
margin: 0 auto;
border: 1px solid var(--el-border-color-lighter);
border-radius: 6px;
}
.guide-section figcaption {
margin-top: 8px;
font-size: 12px;
color: var(--el-text-color-secondary);
text-align: center;
}
.guide-section ul {
padding-left: 22px;
line-height: 1.9;
}
.guide-section li {
margin-bottom: 12px;
overflow-wrap: anywhere;
}
.guide-section pre {
padding: 16px;
overflow-x: auto;
font-size: 12px;
line-height: 1.8;
white-space: pre-wrap;
background: var(--el-fill-color-light);
border-radius: 6px;
}
.image-error {
padding: 24px;
color: var(--el-text-color-secondary);
text-align: center;
}
.guide-footer {
padding: 20px 0 32px;
line-height: 1.8;
}
.guide-footer p {
color: var(--el-text-color-secondary);
}
@media (width <= 900px) {
.guide-layout {
grid-template-rows: auto minmax(0, 1fr);
grid-template-columns: 1fr;
gap: 16px;
}
.guide-toc {
max-height: 140px;
}
.guide-heading {
flex-direction: column;
gap: 8px;
margin-bottom: 12px;
}
.guide-heading h1 {
font-size: 22px;
}
.guide-heading p {
margin: 0;
font-size: 12px;
}
.guide-section {
padding: 16px;
}
}
.guide-actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: center;
}
.guide-action {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 34px;
padding: 7px 12px;
font-size: 13px;
line-height: 1.5;
color: var(--el-color-primary);
text-decoration: none;
border: 1px solid var(--el-border-color);
border-radius: 5px;
}
.guide-action.primary {
color: white;
background: var(--el-color-primary);
border-color: var(--el-color-primary);
}
.guide-action:hover {
filter: brightness(0.95);
}
.guide-action:focus-visible {
outline: 2px solid var(--el-color-primary);
outline-offset: 3px;
}
.guide-footer a:not(.guide-action) {
color: var(--el-color-primary);
text-decoration: underline;
}
</style>
+28 -1
View File
@@ -1,9 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref, watch } from 'vue' import { computed, ref, watch } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { ElMessage } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { Search, Refresh } from '@element-plus/icons-vue' import { Search, Refresh } from '@element-plus/icons-vue'
import StatusPill from '../components/StatusPill.vue' import StatusPill from '../components/StatusPill.vue'
import { devopsApi } from '../services/devopsApi'
import { usePlatformStore } from '../stores/platform' import { usePlatformStore } from '../stores/platform'
import { useSessionStore } from '../stores/session' import { useSessionStore } from '../stores/session'
import type { ProjectConfig } from '../types/devops' import type { ProjectConfig } from '../types/devops'
@@ -37,6 +38,29 @@ const hasDiagnostics = computed(() =>
function openProject(project: ProjectConfig) { function openProject(project: ProjectConfig) {
selectedKey.value = project.key selectedKey.value = project.key
} }
async function renameProject(project: ProjectConfig) {
let name: string
try {
const result = await ElMessageBox.prompt('输入新的项目显示名称', '修改项目名称', {
inputValue: project.name,
inputValidator: (value) => Boolean(value?.trim()) && value.trim().length <= 100
? true
: '请输入 1 至 100 个字符',
})
name = result.value.trim()
} catch {
return
}
try {
const saved = await devopsApi.renameProject(project.key, name)
const current = platform.projects.find((item) => item.key === project.key)
if (current) current.name = saved.name
ElMessage.success('项目名称已保存')
} catch (error) {
ElMessage.error(error instanceof Error ? error.message : '保存项目名称失败')
}
}
async function diagnose() { async function diagnose() {
diagnosing.value = true diagnosing.value = true
diagnosisError.value = '' diagnosisError.value = ''
@@ -137,6 +161,9 @@ async function diagnose() {
@close="selectedKey = ''" @close="selectedKey = ''"
> >
<template v-if="selected"> <template v-if="selected">
<ElButton v-if="session.role === 'super_admin'" @click="renameProject(selected)">
修改项目名称
</ElButton>
<dl class="project-details"> <dl class="project-details">
<dt>代码仓库</dt> <dt>代码仓库</dt>
<dd> <dd>
+2
View File
@@ -492,6 +492,7 @@ function resetAuditFilters() {
<div class="page-header"> <div class="page-header">
<div> <div>
<h1>系统配置</h1> <h1>系统配置</h1>
<a class="text-link" href="https://admin.dev.mrzhan.top/">切回舌吻运营后台</a>
<p>按需查看接入状态、通知投递和操作审计。</p> <p>按需查看接入状态、通知投递和操作审计。</p>
</div> </div>
</div> </div>
@@ -666,6 +667,7 @@ function resetAuditFilters() {
<section v-if="activeTab === 'notifications' && session.role === 'super_admin'" class="panel"> <section v-if="activeTab === 'notifications' && session.role === 'super_admin'" class="panel">
<div class="panel-header"> <div class="panel-header">
<h2>通知 outbox</h2> <h2>通知 outbox</h2>
<RouterLink class="text-link" to="/guides/notifications">通知接入文档</RouterLink>
<span <span
>{{ filteredNotificationOutbox.length }} / >{{ filteredNotificationOutbox.length }} /
{{ platform.notificationOutbox.length }} 条</span {{ platform.notificationOutbox.length }} 条</span