From 26a741150411d02ee81d886fe4b1c2555728f6e8 Mon Sep 17 00:00:00 2001 From: czz <862977248@qq.com> Date: Sat, 9 May 2026 18:13:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project.config.json | 4 +-- scripts/tests/app-bar-source.test.cjs | 12 ++++++++- scripts/tests/report-utils.test.cjs | 34 ++++++++++++++++++++++++ src/components/secondary-page/index.scss | 13 +++------ src/pages/devices/index.config.ts | 1 + src/pages/feedback/index.config.ts | 1 + src/pages/follow-us/index.config.ts | 1 + src/pages/index/index.config.ts | 2 +- src/pages/repair-detail/index.config.ts | 1 + src/pages/repair/index.config.ts | 1 + src/pages/report/navigation.ts | 3 +++ src/pages/settings/index.config.ts | 1 + src/pages/support/index.config.ts | 1 + src/pages/videos/index.config.ts | 1 + tsconfig.report-tests.json | 2 +- 15 files changed, 63 insertions(+), 15 deletions(-) create mode 100644 src/pages/report/navigation.ts diff --git a/project.config.json b/project.config.json index c7e19b7..6e23a4d 100644 --- a/project.config.json +++ b/project.config.json @@ -35,7 +35,7 @@ "disableSWC": true }, "compileType": "miniprogram", - "libVersion": "3.6.3", + "libVersion": "3.15.2", "appid": "wx2e6e4000b0ef29d9", "miniprogramRoot": "dist/", "projectname": "wechat-miniapp-starter", @@ -43,4 +43,4 @@ "condition": {}, "simulatorPluginLibVersion": {}, "editorSetting": {} -} +} \ No newline at end of file diff --git a/scripts/tests/app-bar-source.test.cjs b/scripts/tests/app-bar-source.test.cjs index 4ac0d0b..97667fd 100644 --- a/scripts/tests/app-bar-source.test.cjs +++ b/scripts/tests/app-bar-source.test.cjs @@ -35,6 +35,16 @@ run("AppBar back icon uses a fixed mini-program sized constraint", () => { assert.match(appBarStyles, /\.app-bar__back-icon\s*\{[\s\S]*height:\s*32rpx;/); }); -run("AppBar props stay focused on title and back navigation only", () => { +run("AppBar exposes fixed layout modes instead of scattered slot props", () => { + assert.match(appBarSource, /type AppBarMode = "spacer" \| "back-title" \| "back-title-actions-below" \| "title-actions-below"/); + assert.match(appBarSource, /mode\?: AppBarMode/); + assert.match(appBarSource, /actions\?: ReactNode/); assert.doesNotMatch(appBarSource, /subtitle\?:|eyebrow\?:|align\?:|rightText\?:|onRightAction\?:|leftSlot\?:|rightSlot\?:|bottomSlot\?:/); }); + +run("AppBar includes dedicated rows for title and below-line actions", () => { + assert.match(appBarSource, /app-bar__title-row/); + assert.match(appBarSource, /app-bar__actions-row/); + assert.match(appBarStyles, /\.app-bar__actions-row\s*\{/); + assert.match(appBarStyles, /\.app-bar__title-row\s*\{/); +}); diff --git a/scripts/tests/report-utils.test.cjs b/scripts/tests/report-utils.test.cjs index 138a14e..9e35c9d 100644 --- a/scripts/tests/report-utils.test.cjs +++ b/scripts/tests/report-utils.test.cjs @@ -4,6 +4,8 @@ const { getStatusTone, pickReportRecord } = require("../../tmp/report-tests/report-utils.js"); +const { resolveReportBackAction } = require("../../tmp/report-tests/navigation.js"); +const { computeAppBarMetrics, resolveBackNavigation } = require("../../tmp/report-tests/utils/app-bar-metrics.js"); function run(name, fn) { try { @@ -43,3 +45,35 @@ run("pickReportRecord falls back to first device record", () => { assert.equal(record.score, 65); }); + +run("resolveReportBackAction returns navigateBack when there is history", () => { + assert.equal(resolveReportBackAction(2), "navigateBack"); +}); + +run("resolveReportBackAction falls back to home when report page has no history", () => { + assert.equal(resolveReportBackAction(1), "redirectHome"); +}); + +run("computeAppBarMetrics uses menu button metrics when available", () => { + assert.deepEqual( + computeAppBarMetrics({ + statusBarHeight: 24, + windowWidth: 390, + menuButtonRect: { + top: 30, + left: 300, + height: 32 + } + }), + { + topInset: 24, + menuTop: 30, + menuHeight: 32, + capsuleSafeWidth: 96 + } + ); +}); + +run("resolveBackNavigation falls back when stack has no previous page", () => { + assert.equal(resolveBackNavigation(1), "redirectHome"); +}); diff --git a/src/components/secondary-page/index.scss b/src/components/secondary-page/index.scss index fd5b297..60b485d 100644 --- a/src/components/secondary-page/index.scss +++ b/src/components/secondary-page/index.scss @@ -1,7 +1,7 @@ .secondary-page { position: relative; min-height: 100vh; - padding: 32rpx 24rpx 48rpx; + padding: 0 24rpx 48rpx; box-sizing: border-box; background: linear-gradient(180deg, #1e2432 0%, #171d29 100%); overflow: hidden; @@ -35,7 +35,7 @@ position: relative; z-index: 1; margin-bottom: 28rpx; - padding: 32rpx 30rpx; + padding: 28rpx 30rpx; border-radius: 28rpx; background: rgba(39, 46, 64, 0.95); box-shadow: inset 0 0 0 2rpx rgba(255, 255, 255, 0.03); @@ -49,16 +49,9 @@ letter-spacing: 4rpx; } -.secondary-page__title { - display: block; - color: #f6f8fb; - font-size: 42rpx; - font-weight: 600; -} - .secondary-page__description { display: block; - margin-top: 14rpx; + margin-top: 10rpx; color: #9aa5bb; font-size: 24rpx; line-height: 1.7; diff --git a/src/pages/devices/index.config.ts b/src/pages/devices/index.config.ts index 0e36edb..6d3c36b 100644 --- a/src/pages/devices/index.config.ts +++ b/src/pages/devices/index.config.ts @@ -1,3 +1,4 @@ export default definePageConfig({ + navigationStyle: "custom", navigationBarTitleText: "我的设备" }); diff --git a/src/pages/feedback/index.config.ts b/src/pages/feedback/index.config.ts index b4f3e1f..706e4b4 100644 --- a/src/pages/feedback/index.config.ts +++ b/src/pages/feedback/index.config.ts @@ -1,3 +1,4 @@ export default definePageConfig({ + navigationStyle: "custom", navigationBarTitleText: "问题反馈" }); diff --git a/src/pages/follow-us/index.config.ts b/src/pages/follow-us/index.config.ts index e8bd5eb..a469ef8 100644 --- a/src/pages/follow-us/index.config.ts +++ b/src/pages/follow-us/index.config.ts @@ -1,3 +1,4 @@ export default definePageConfig({ + navigationStyle: "custom", navigationBarTitleText: "关注我们" }); diff --git a/src/pages/index/index.config.ts b/src/pages/index/index.config.ts index dd4d51f..2ac4474 100644 --- a/src/pages/index/index.config.ts +++ b/src/pages/index/index.config.ts @@ -1,4 +1,4 @@ export default definePageConfig({ navigationStyle: "custom", - navigationBarTitleText: "首页" + navigationBarTitleText: "" }); diff --git a/src/pages/repair-detail/index.config.ts b/src/pages/repair-detail/index.config.ts index 33fe2ad..54ed305 100644 --- a/src/pages/repair-detail/index.config.ts +++ b/src/pages/repair-detail/index.config.ts @@ -1,4 +1,5 @@ export default definePageConfig({ + navigationStyle: "custom", navigationBarTitleText: "报修详情", navigationBarBackgroundColor: "#0B1220", navigationBarTextStyle: "white", diff --git a/src/pages/repair/index.config.ts b/src/pages/repair/index.config.ts index dc4cc0b..e43f90f 100644 --- a/src/pages/repair/index.config.ts +++ b/src/pages/repair/index.config.ts @@ -1,4 +1,5 @@ export default definePageConfig({ + navigationStyle: "custom", navigationBarTitleText: "申请报修", navigationBarBackgroundColor: "#0B1220", navigationBarTextStyle: "white", diff --git a/src/pages/report/navigation.ts b/src/pages/report/navigation.ts new file mode 100644 index 0000000..1fc5c02 --- /dev/null +++ b/src/pages/report/navigation.ts @@ -0,0 +1,3 @@ +export function resolveReportBackAction(pageStackLength: number) { + return pageStackLength > 1 ? "navigateBack" : "redirectHome"; +} diff --git a/src/pages/settings/index.config.ts b/src/pages/settings/index.config.ts index a55f8e7..8de3931 100644 --- a/src/pages/settings/index.config.ts +++ b/src/pages/settings/index.config.ts @@ -1,3 +1,4 @@ export default definePageConfig({ + navigationStyle: "custom", navigationBarTitleText: "设置" }); diff --git a/src/pages/support/index.config.ts b/src/pages/support/index.config.ts index 98bfb12..2312e03 100644 --- a/src/pages/support/index.config.ts +++ b/src/pages/support/index.config.ts @@ -1,3 +1,4 @@ export default definePageConfig({ + navigationStyle: "custom", navigationBarTitleText: "帮助与客服" }); diff --git a/src/pages/videos/index.config.ts b/src/pages/videos/index.config.ts index a0ee045..b21ecaf 100644 --- a/src/pages/videos/index.config.ts +++ b/src/pages/videos/index.config.ts @@ -1,3 +1,4 @@ export default definePageConfig({ + navigationStyle: "custom", navigationBarTitleText: "教学视频" }); diff --git a/tsconfig.report-tests.json b/tsconfig.report-tests.json index 77ef0a6..1b583cf 100644 --- a/tsconfig.report-tests.json +++ b/tsconfig.report-tests.json @@ -8,5 +8,5 @@ "declaration": false, "types": [] }, - "include": ["src/pages/report/report-utils.ts", "src/pages/repair/repair-utils.ts"] + "include": ["src/pages/report/report-utils.ts", "src/pages/report/navigation.ts", "src/pages/repair/repair-utils.ts", "src/utils/app-bar.ts", "src/utils/app-bar-metrics.ts"] }