refactor(mpuniapp): 优化底部导航栏信息架构,移出微官网为独立落地页,纯化名片主管家工作流

这个提交包含在:
wikiboss
2026-09-21 15:23:15 +08:00
父节点 cb75e16214
当前提交 51a2f37180
共有 3 个文件被更改,包括 67 次插入 和 14 次删除

查看文件

@@ -1,5 +1,12 @@
{
"pages": [
{
"path": "pages/owner/card/index",
"style": {
"navigationBarTitleText": "我的名片",
"backgroundColorContent": "#F7F8FA"
}
},
{
"path": "pages/portal/index",
"style": {
@@ -51,13 +58,6 @@
"backgroundColorContent": "#F7F8FA"
}
},
{
"path": "pages/owner/card/index",
"style": {
"navigationBarTitleText": "我的名片",
"backgroundColorContent": "#F7F8FA"
}
},
{
"path": "pages/owner/radar",
"style": {
@@ -164,12 +164,6 @@
"backgroundColor": "#FFFFFF",
"borderStyle": "white",
"list": [
{
"pagePath": "pages/portal/index",
"iconPath": "static/tab-portal.png",
"selectedIconPath": "static/tab-portal-active.png",
"text": "官网"
},
{
"pagePath": "pages/owner/card/index",
"iconPath": "static/tab-card.png",

查看文件

@@ -445,7 +445,6 @@ function onQuotaClick(): void {
function openPage(url: string): void {
const tabPages = [
'/pages/portal/index',
'/pages/owner/card/index',
'/pages/owner/radar',
'/pages/owner/leads',

查看文件

@@ -0,0 +1,60 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
const MP_ROOT = path.resolve('m:/2026项目/CRMmp/mpuniapp');
const pagesJsonPath = path.join(MP_ROOT, 'pages.json');
const profileUvuePath = path.join(MP_ROOT, 'pages/owner/profile/index.uvue');
const cardHomeUtsPath = path.join(MP_ROOT, 'pages/owner/card/useCardHome.uts');
test('1. pages.json TabBar 信息架构纯正性审查 (只保留名片主 4 大工作台,移除微官网)', () => {
assert.ok(fs.existsSync(pagesJsonPath), 'pages.json 必须存在');
const content = fs.readFileSync(pagesJsonPath, 'utf-8');
const config = JSON.parse(content);
const tabBarList = config.tabBar?.list || [];
assert.equal(tabBarList.length, 4, 'TabBar 应当仅包含 4 个核心工作台 Tab');
// 验证不包含微官网 pages/portal/index
const hasPortalInTabBar = tabBarList.some((item: any) => item.pagePath === 'pages/portal/index');
assert.equal(hasPortalInTabBar, false, '微官网 pages/portal/index 严禁作为 TabBar 常驻项,应作为独立落地页');
// 验证 4 个 Tab 顺序与路由
assert.equal(tabBarList[0].pagePath, 'pages/owner/card/index', 'TabBar 第 1 项必须是名片');
assert.equal(tabBarList[0].text, '名片');
assert.equal(tabBarList[1].pagePath, 'pages/owner/radar', 'TabBar 第 2 项必须是雷达');
assert.equal(tabBarList[1].text, '雷达');
assert.equal(tabBarList[2].pagePath, 'pages/owner/leads', 'TabBar 第 3 项必须是潜客');
assert.equal(tabBarList[2].text, '潜客');
assert.equal(tabBarList[3].pagePath, 'pages/owner/profile/index', 'TabBar 第 4 项必须是我的');
assert.equal(tabBarList[3].text, '我的');
// 验证 pages[0] 首屏页面为名片页
assert.equal(config.pages[0].path, 'pages/owner/card/index', '应用首屏 pages[0] 应设为名片首页');
// 验证微官网依然保留在 pages 路由列表中供扫码和独立预览访问
const hasPortalInPages = config.pages.some((item: any) => item.path === 'pages/portal/index');
assert.equal(hasPortalInPages, true, '微官网 pages/portal/index 必须保留在 pages 列表中供独立沉浸访问');
});
test('2. profile/index.uvue 的 openPage 导航守卫与新 TabBar 保持 100% 一致', () => {
const content = fs.readFileSync(profileUvuePath, 'utf-8');
// 验证 tabPages 数组不包含 portal/index,且包含 4 个管理页
assert.ok(content.includes("'/pages/owner/card/index'"), 'tabPages 必须包含 /pages/owner/card/index');
assert.ok(content.includes("'/pages/owner/radar'"), 'tabPages 必须包含 /pages/owner/radar');
assert.ok(content.includes("'/pages/owner/leads'"), 'tabPages 必须包含 /pages/owner/leads');
assert.ok(content.includes("'/pages/owner/profile/index'"), 'tabPages 必须包含 /pages/owner/profile/index');
assert.equal(content.includes("'/pages/portal/index'"), false, 'tabPages 严禁包含 /pages/portal/index,微官网应通过 uni.navigateTo 打开');
});
test('3. useCardHome.uts 中的 buildPortalPreviewUrl 保持对微官网的独立全屏预览能力', () => {
const content = fs.readFileSync(cardHomeUtsPath, 'utf-8');
assert.ok(content.includes('buildPortalPreviewUrl'), '必须包含 buildPortalPreviewUrl');
assert.ok(content.includes('openCardPreview'), '必须包含 openCardPreview');
assert.ok(content.includes('/pages/portal/index'), '预览链接必须指向微官网 /pages/portal/index');
});