7.2 KiB
Plan: 用户中心内链推广中心与 UI/UX 重设计
现状校正:邀请卡片当前已不在“账号设置”中,而是作为一个区块内嵌在“收益中心 / revenue”标签内 (
inc/helpers/user-center-renderers/profile-revenue.php:63依据show_invite_sectionrequire profile-invite.php)。 本计划按用户决定,将推广能力抽出为独立的promotion标签,并对其完成 UI/UX 重设计。
Architectural Decisions
Durable decisions that apply across all phases:
- 独立标签键
promotion:在src/User/Center.php面板注册表新增promotion面板;标签键与 URL 参数统一为promotion,复用现有?tab=机制,不新增前台路由或页面模板。 - 复用现有用户中心壳与渲染管线:沿用
page-profile.php壳、aksrt_get_user_center_render_context()上下文、templates/parts/user-center/panel.php面板包裹、侧栏组合器、mobile-tabs.php移动导航与aksrt_get_user_center_tab_url()URL 生成;只新增/移动渲染片段,不复制渲染路径。 - 可见性沿用现有开关:推广标签的注册与渲染沿用现有
$invite_on判定(credits_enabled()&&invite_enabled()&&invite_registration_enabled(),见Center.php:130-133与aksrt-user-center.php:497-500);任一关闭即不注册标签、不出现入口。 - 深链归一到单一目标:
invite/promotion深链统一解析到promotion标签(替换现有invite/promotion → revenue折叠);保留invite → promotion归一以满足 PRD “旧邀请深链归一”,不保留 revenue 双渲染路径。 - 单一邀请渲染位置:邀请卡片只在推广标签渲染;
revenue标签恢复为纯“收益与提现”,不再require profile-invite.php。 - 复用既有业务通路:继续使用现有 REST 端点
aksrt/v1/invite/me、aksrt/v1/invite/list(src/Credits/Invite.php:49,56,登录用户权限)与前端assets/js/credits.js的initInvite()(:193,[data-aksrt-invite]契约);不新增邀请码生成、cookie、归因、注册绑定、奖励结算逻辑或第二套请求。 - 样式模块化:推广卡
uc-promotion-*样式迁入独立assets/css/routes/user-center/promotion.css,由assets/css/routes/user-center.css引入;从user-center/revenue.css移除,不引入独立 UI 框架。
Phase 1 — 推广中心作为独立标签可端到端进入
User stories: US1、US4、US6、US7
What to build
将邀请能力从收益标签迁出为独立 promotion 标签的完整纵切:在面板注册表按现有邀请开关注册 promotion 面板;新增 profile-promotion.php 面板渲染器承接现有 data-aksrt-invite 卡片(本阶段保持行为一致,视觉重设计留待 Phase 2);从 revenue 标签移除邀请区块使其恢复为纯收益/提现;将 invite/promotion 深链与运行时别名统一归一到 promotion;在桌面侧栏与移动导航暴露推广入口。REST 与 credits.js 邀请逻辑保持不变。
Done when
src/User/Center.php注册promotion面板(type=panel),其注册受credits_enabled() && invite_enabled() && invite_registration_enabled()门控;三者任一关闭时get_dashboard_tabs()不含promotion;revenue面板的注册不再依赖$invite_on。- 新增
inc/helpers/user-center-renderers/profile-promotion.php输出含data-aksrt-invite的卡片;aksrt-user-center.php的$built_in_tabs(:182)与视图映射(:147-162)能将promotion解析到该文件;profile-revenue.php不再require profile-invite.php(grep -n "profile-invite" inc/helpers/user-center-renderers/profile-revenue.php无结果)。 - 深链归一:
aksrt_get_user_center_tab_url()(aksrt-user-center.php:106)、aksrt_user_center_resolve_tabs()(:289)、aksrt_user_center_runtime_config()的tabAliases(:347-350)与inc/modules/user-parts/urls.php别名表(:31-37)均将invite/promotion归一到promotion;访问?tab=invite服务端激活promotion面板(is-active落在#panel-promotion)。 - 桌面侧栏(
sidebar-nav.php或sidebar-creator.php)与mobile-tabs.php(经dashboard_tabs自动渲染)暴露“推广中心”入口,其href来自aksrt_get_user_center_tab_url('promotion');assets/js/credits.jsinitInvite()仍通过[data-aksrt-invite]绑定(该契约选择器未改名)。 - 运行
php tools/audit-admin-contracts.php,退出码为 0 且报告errors=0。
Phase 2 — 推广中心完成 UI/UX 重设计与移动适配
User stories: US2、US3、US5
What to build
在独立推广标签内按“成果概览 → 分享操作 → 奖励说明 → 邀请记录”优先级重组信息架构并完成视觉重设计;把 uc-promotion-* 样式迁入独立 promotion.css 模块;确保加载中/空数据/请求失败的非误导状态反馈、键盘可操作的复制交互与可见成功/失败反馈、语义化结构与不只依赖颜色的状态;移动端单列、无横向溢出、复制按钮易触达。数据仍来自现有 /invite/me、/invite/list。
Done when
- 新增
assets/css/routes/user-center/promotion.css承载uc-promotion-*规则并在assets/css/routes/user-center.css中@import;assets/css/routes/user-center/revenue.css不再包含uc-promotion-*规则(grep -n "uc-promotion" assets/css/routes/user-center/revenue.css无结果)。 profile-promotion.php面板按“成果概览 → 分享操作 → 奖励说明 → 邀请记录”顺序输出;复制按钮为可聚焦的<button>,credits.js复制成功/失败均写入[data-invite-copy-feedback]文本(非仅颜色),失败时聚焦并选中链接输入框。- 加载中/空数据/失败状态经现有
[data-invite-status]、[data-invite-list]、[data-invite-total]呈现,失败时统计不呈现误导性的 0(保持—占位,见credits.js:294-298)。 - [agent:test-auditor] 人工在 ≤640px 宽度验收推广面板单列布局、无横向溢出、复制按钮整行可点击,且统计/链接/记录可读可点击。
- 运行
php tools/audit-admin-contracts.php,退出码为 0 且报告errors=0。
Out of Scope
- 新增独立的公开推广落地页、推广门户或第二套前台路由。
- 修改邀请码生成规则、推广 cookie 时长、邀请归因规则、邮箱验证条件、奖励额度或积分结算模型。
- 新增社交平台 SDK、自动化分享到第三方平台,或站外推广统计系统。
- 对管理员后台邀请码运营界面、推广/返利支付规则进行功能重构。
- 增加任何向后兼容、数据迁移或旧新两套邀请 UI 并存的实现。
Open Questions
- “推广中心”的最终中文名称是否固定为“推广中心”,还是应使用“邀请推广”/“邀请好友”等已有产品术语?默认采用“推广中心”。
- 推广中心在用户中心侧边栏中的最终排序位置需在实现时根据现有 tabs 的产品优先级确定;默认放在积分/资产(credits)相关入口附近。