From 61880d605f7efe3e8b1348e5e86d00c3f292d94c Mon Sep 17 00:00:00 2001 From: zerosaturation Date: Sun, 12 Apr 2026 21:53:08 +0800 Subject: [PATCH] =?UTF-8?q?feat=20:=E9=87=8D=E6=9E=84=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/pages/square/DESIGN.md | 713 +++++++++++++++ frontend/pages/square/square.vue.old | 1197 ++++++++++++++++++++++++++ 2 files changed, 1910 insertions(+) create mode 100644 frontend/pages/square/DESIGN.md create mode 100644 frontend/pages/square/square.vue.old diff --git a/frontend/pages/square/DESIGN.md b/frontend/pages/square/DESIGN.md new file mode 100644 index 0000000..5de0d43 --- /dev/null +++ b/frontend/pages/square/DESIGN.md @@ -0,0 +1,713 @@ +# `square.vue` 重构设计文档 + +## 一、背景 + +- **文件**:`frontend/pages/square/square.vue`(1196 行) +- **技术栈**:uni-app + Vue 3 Composition API(` +``` + +### 7.6 迁移步骤 + +``` +Step 1: 创建 config/gridLayout.js,定义网格规则 +Step 2: 使用调试工具 debug-grid.vue 调整参数,直到网格对齐背景图 +Step 3: 更新 config/cabin.js,使用动态生成的坐标 +Step 4: 测试 square.vue,确保功能正常 +Step 5: 删除旧的硬编码坐标数组 +``` + +### 7.7 优势对比 + +| 维度 | 旧方案(硬编码) | 新方案(网格系统) | +|------|-----------------|-------------------| +| 维护成本 | 高(72 个坐标手动维护) | 低(只需调整几个参数) | +| 扩展性 | 差(增加格子需重新计算) | 好(自动生成) | +| 背景图更换 | 需重新标注所有坐标 | 只需调整网格参数 | +| 视觉一致性 | 手动标注易出错 | 自动对齐,一致性高 | +| 调试效率 | 低(需反复测试) | 高(可视化调试工具) | + +### 7.8 推荐方案 + +根据你的需求,推荐使用 **方案 C(混合方案)**: +1. 使用规则网格自动生成大部分坐标 +2. 对个别需要微调的位置使用 `manualAdjustments` +3. 配合可视化调试工具快速调整参数 + +这样既保持了灵活性,又大幅降低了维护成本。 + +--- + +## 八、执行顺序 + +``` +Step 1: config/gridLayout.js(新增) +Step 2: config/cabin.js(重构,使用动态坐标) +Step 3: pages/square/debug-grid.vue(新增,调试工具) +Step 4: composables/useSwipe.js +Step 5: composables/useCabin.js +Step 6: composables/useDialogRotation.js +Step 7: composables/useBanner.js +Step 8: components/CabinItem.vue +Step 9: components/BannerCarousel.vue +Step 10: components/NavArrows.vue +Step 11: square.vue(重写) +Step 12: 功能验证 + iOS/Android 测试 +``` diff --git a/frontend/pages/square/square.vue.old b/frontend/pages/square/square.vue.old new file mode 100644 index 0000000..b5d4abb --- /dev/null +++ b/frontend/pages/square/square.vue.old @@ -0,0 +1,1197 @@ + + + + + \ No newline at end of file