From 7a5e515b8bdc58bd4931d6929c026b09ddd71f31 Mon Sep 17 00:00:00 2001 From: xcbyy <2578898740@qq.com> Date: Tue, 13 Oct 2026 15:17:15 +0800 Subject: [PATCH] feat(user): replace distribution modal with dedicated promote page --- pwuniapp/pages.json | 10 + pwuniapp/pages/user/index.vue | 205 +--- pwuniapp/pages/user/promote.vue | 1287 +++++++++++++++++++++++++ server/tests/content-security.spec.ts | 48 +- 4 files changed, 1347 insertions(+), 203 deletions(-) create mode 100644 pwuniapp/pages/user/promote.vue diff --git a/pwuniapp/pages.json b/pwuniapp/pages.json index 82c0842..eb67a2e 100644 --- a/pwuniapp/pages.json +++ b/pwuniapp/pages.json @@ -152,6 +152,16 @@ "backgroundColor": "#0A0F1D" } }, + { + "path": "pages/user/promote", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "推广赚钱", + "navigationBarBackgroundColor": "#0A0F1D", + "navigationBarTextStyle": "white", + "backgroundColor": "#0A0F1D" + } + }, { "path": "pages/user/settings", "style": { diff --git a/pwuniapp/pages/user/index.vue b/pwuniapp/pages/user/index.vue index 1ad952d..2708b55 100644 --- a/pwuniapp/pages/user/index.vue +++ b/pwuniapp/pages/user/index.vue @@ -117,7 +117,7 @@ 所有订单 对局与退款 - + @@ -321,200 +321,7 @@ - - - - - - 分销推广管理 - 全网二级裂变 · 下单即时分润 - - - - - - - - - ¥{{ user.commission || '0.00' }} - 可提现佣金 - - - - {{ distributionTeam.totalTeamCount || user.invitedCount || 0 }} 人 - 下级团队成员 - - - - - PW{{ user.id || 1001 }} - 一键复制 - - 专属邀请码 - - - - - - - 推广海报 - - - 下级团队 - - - 返佣订单 - - - 佣金提现 - - - - - - - - 官方认证邀请码 - 电竞陪伴 · 同城玩乐 - 寻找心仪陪伴师,立享新人首单礼包 - - - - - - - - - - 微信长按或扫码进入 - - - - 邀请码: - PW{{ user.id || 1001 }} - - - - - - - - - - - - - - 一级直推 ({{ distributionTeam.directCount || 0 }}人 · 5%) - - - 二级间推 ({{ distributionTeam.indirectCount || 0 }}人 · 2%) - - - - - - - - - {{ m.nickname }} - LV{{ m.level }}好友 - - 加入时间:{{ m.createdAt }} - - - ¥{{ m.totalContribute || '0.00' }} - 贡献收益 - - - - - - - - - - - {{ r.orderNo }} - {{ r.status }} - - - - {{ r.fromUserName }} - {{ r.level === 1 ? '直推订单' : '间推订单' }} - - - +¥{{ r.commission }} - 提成 {{ r.ratePercent }}% - - - - {{ r.createdAt }} - 消费:¥{{ r.orderAmount }} - - - - - - - - - 提现金额 (元) - - ¥ - - 全部提现 - - - 支持自动提现至绑定微信零钱,平台免收手续费,T+0 快速审核到账。 - - - - - - - @@ -1136,12 +943,12 @@ const clearLocalCache = () => { } }; -// 3. 分销推广管理业务逻辑 -const openDistributionModal = async () => { +// 3. 分销推广管理业务逻辑 (跳转独立页面) +const openDistributionModal = () => { if (!ensureLoggedIn()) return; - showDistributionModal.value = true; - distActiveTab.value = 'poster'; - await loadDistributionData(); + uni.navigateTo({ + url: '/pages/user/promote' + }); }; const showInvitePoster = () => { diff --git a/pwuniapp/pages/user/promote.vue b/pwuniapp/pages/user/promote.vue new file mode 100644 index 0000000..c8b65e6 --- /dev/null +++ b/pwuniapp/pages/user/promote.vue @@ -0,0 +1,1287 @@ + + + + + diff --git a/server/tests/content-security.spec.ts b/server/tests/content-security.spec.ts index 3101828..c9c92ec 100644 --- a/server/tests/content-security.spec.ts +++ b/server/tests/content-security.spec.ts @@ -130,7 +130,7 @@ describe('ContentSecurityService & Compliance Architecture (TDD 微信内容安 const raw = fs.readFileSync(pagesJsonPath, 'utf-8'); const config = JSON.parse(raw); expect(Array.isArray(config.pages)).toBe(true); - expect(config.pages.length).toBe(21); + expect(config.pages.length).toBe(22); for (const pageItem of config.pages) { const vueFilePath = path.join(rootDir, 'pwuniapp', `${pageItem.path}.vue`); @@ -437,12 +437,14 @@ describe('ContentSecurityService & Compliance Architecture (TDD 微信内容安 walk(path.join(rootDir, 'pwuniapp')); }); - it('推广赚钱二级分销弹窗必须符合微信4字规范并支持一键复制专属邀请码', () => { + it('推广赚钱二级分销专属页面与功能必须符合微信4字规范并支持一键复制专属邀请码', () => { const userIndexPath = path.join(rootDir, 'pwuniapp', 'pages', 'user', 'index.vue'); + const promotePath = path.join(rootDir, 'pwuniapp', 'pages', 'user', 'promote.vue'); const content = fs.readFileSync(userIndexPath, 'utf-8'); + const promoteContent = fs.readFileSync(promotePath, 'utf-8'); expect(content).toContain('showInvitePoster'); - expect(content).toContain('一键复制'); - expect(content).toContain('setClipboardData'); + expect(promoteContent).toContain('一键复制'); + expect(promoteContent).toContain('setClipboardData'); }); it('首页 Banner 轮播必须具备防 null 链式安全访问与数据容错过滤', () => { @@ -877,6 +879,44 @@ describe('ContentSecurityService & Compliance Architecture (TDD 微信内容安 expect(emojiRegex.test(content)).toBe(false); }); }); + + describe('20. 独立专属推广赚钱页面规格验证 (pages/user/promote.vue)', () => { + const promotePath = path.join(rootDir, 'pwuniapp', 'pages', 'user', 'promote.vue'); + const pagesJsonPath = path.join(rootDir, 'pwuniapp', 'pages.json'); + + it('pages.json 必须成功注册 pages/user/promote 且物理文件必须存在', () => { + expect(fs.existsSync(promotePath)).toBe(true); + const pagesJson = JSON.parse(fs.readFileSync(pagesJsonPath, 'utf-8')); + const hasPage = pagesJson.pages.some((p: any) => p.path === 'pages/user/promote'); + expect(hasPage).toBe(true); + }); + + it('推广赚钱页面必须包含沉浸式导航栏、分销总览、海报/团队/订单/提现四大板块', () => { + const content = fs.readFileSync(promotePath, 'utf-8'); + expect(content).toContain('custom-nav-bar'); + expect(content).toContain('推广赚钱'); + expect(content).toContain('dist-summary-banner'); + expect(content).toContain('tab-pane-poster'); + expect(content).toContain('tab-pane-team'); + expect(content).toContain('tab-pane-records'); + expect(content).toContain('tab-pane-withdraw'); + expect(content).toContain('handleBack'); + }); + + it('个人中心页面 (pages/user/index.vue) 推广赚钱入口必须原生跳转至 /pages/user/promote 且杜绝弹窗', () => { + const userIndexPath = path.join(rootDir, 'pwuniapp', 'pages', 'user', 'index.vue'); + const content = fs.readFileSync(userIndexPath, 'utf-8'); + expect(content).toContain("navTo('/pages/user/promote')"); + expect(content).toContain("url: '/pages/user/promote'"); + expect(content).not.toContain('class="profile-edit-modal dist-modal-box"'); + }); + + it('推广赚钱页面代码与测试严禁包含任何系统 Emoji 违规字符', () => { + const content = fs.readFileSync(promotePath, 'utf-8'); + const emojiRegex = /(?:\p{Extended_Pictographic}|\p{Emoji_Presentation}|[\u2600-\u27BF])/u; + expect(emojiRegex.test(content)).toBe(false); + }); + }); });