From 912087fa75e8ec6d36efbf6508281d5d1200c0b4 Mon Sep 17 00:00:00 2001 From: huangzhenbao <17818024429@163.com> Date: Mon, 9 Mar 2026 17:57:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=9B=AE=E5=BD=95=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layouts/admin/router/adminComponentMap.uts | 10 +- layouts/admin/router/adminRoutes.uts | 10 +- .../admin/docs/UNI_APP_X_PAGE_FIX_GUIDE.md | 22 +- .../mall/admin/marketing/integral/config.uvue | 264 ----------- .../mall/admin/marketing/integral/order.uvue | 412 ---------------- .../mall/admin/marketing/integral/record.uvue | 302 ------------ pages/mall/admin/marketing/points/config.uvue | 268 ++++++++++- pages/mall/admin/marketing/points/goods.uvue | 400 +++++++++++++++- pages/mall/admin/marketing/points/index.uvue | 446 +++++++++++++++--- .../marketing/{integral => points}/list.uvue | 0 pages/mall/admin/marketing/points/order.uvue | 421 ++++++++++++++++- .../index.uvue => points/product.uvue} | 0 pages/mall/admin/marketing/points/record.uvue | 306 +++++++++++- .../{integral => points}/statistic.uvue | 0 pages/mall/admin/marketing/points/stats.uvue | 350 +++++++++++++- .../product/product-management/index.uvue | 5 +- pages/mall/admin/错误信息.txt | 2 +- 17 files changed, 2085 insertions(+), 1133 deletions(-) delete mode 100644 pages/mall/admin/marketing/integral/config.uvue delete mode 100644 pages/mall/admin/marketing/integral/order.uvue delete mode 100644 pages/mall/admin/marketing/integral/record.uvue rename pages/mall/admin/marketing/{integral => points}/list.uvue (100%) rename pages/mall/admin/marketing/{integral/index.uvue => points/product.uvue} (100%) rename pages/mall/admin/marketing/{integral => points}/statistic.uvue (100%) diff --git a/layouts/admin/router/adminComponentMap.uts b/layouts/admin/router/adminComponentMap.uts index 96504f7b..80898f9e 100644 --- a/layouts/admin/router/adminComponentMap.uts +++ b/layouts/admin/router/adminComponentMap.uts @@ -48,11 +48,11 @@ import OrderConfig from '@/pages/mall/admin/order/order-configuration/index.uvue // --- 营销模块 --- import MarketingCouponList from '@/pages/mall/admin/marketing/coupon/list.uvue' import MarketingCouponUser from '@/pages/mall/admin/marketing/coupon/user.uvue' -import MarketingIntegralStatistic from '@/pages/mall/admin/marketing/integral/statistic.uvue' -import MarketingIntegralProduct from '@/pages/mall/admin/marketing/integral/list.uvue' -import MarketingIntegralOrder from '@/pages/mall/admin/marketing/integral/order.uvue' -import MarketingIntegralRecord from '@/pages/mall/admin/marketing/integral/record.uvue' -import MarketingIntegralConfig from '@/pages/mall/admin/marketing/integral/config.uvue' +import MarketingIntegralStatistic from '@/pages/mall/admin/marketing/points/statistic.uvue' +import MarketingIntegralProduct from '@/pages/mall/admin/marketing/points/list.uvue' +import MarketingIntegralOrder from '@/pages/mall/admin/marketing/points/order.uvue' +import MarketingIntegralRecord from '@/pages/mall/admin/marketing/points/record.uvue' +import MarketingIntegralConfig from '@/pages/mall/admin/marketing/points/config.uvue' import MarketingLotteryList from '@/pages/mall/admin/marketing/lottery/list.uvue' import MarketingLotteryConfig from '@/pages/mall/admin/marketing/lottery/config.uvue' import MarketingCombinationProduct from '@/pages/mall/admin/marketing/combination/product.uvue' diff --git a/layouts/admin/router/adminRoutes.uts b/layouts/admin/router/adminRoutes.uts index 97a25328..05acddd9 100644 --- a/layouts/admin/router/adminRoutes.uts +++ b/layouts/admin/router/adminRoutes.uts @@ -475,7 +475,7 @@ export const routes: RouteRecord[] = [ { id: 'marketing_integral_statistic', title: '积分统计', - path: '/pages/mall/admin/marketing/integral/statistic', + path: '/pages/mall/admin/marketing/points/statistic', componentKey: 'MarketingIntegralStatistic', parentId: 'marketing', groupId: 'marketing-integral', @@ -485,7 +485,7 @@ export const routes: RouteRecord[] = [ { id: 'marketing_integral_product', title: '积分商品', - path: '/pages/mall/admin/marketing/integral/product', + path: '/pages/mall/admin/marketing/points/product', componentKey: 'MarketingIntegralProduct', parentId: 'marketing', groupId: 'marketing-integral', @@ -495,7 +495,7 @@ export const routes: RouteRecord[] = [ { id: 'marketing_integral_order', title: '积分订单', - path: '/pages/mall/admin/marketing/integral/order', + path: '/pages/mall/admin/marketing/points/order', componentKey: 'MarketingIntegralOrder', parentId: 'marketing', groupId: 'marketing-integral', @@ -505,7 +505,7 @@ export const routes: RouteRecord[] = [ { id: 'marketing_integral_record', title: '积分记录', - path: '/pages/mall/admin/marketing/integral/record', + path: '/pages/mall/admin/marketing/points/record', componentKey: 'MarketingIntegralRecord', parentId: 'marketing', groupId: 'marketing-integral', @@ -515,7 +515,7 @@ export const routes: RouteRecord[] = [ { id: 'marketing_integral_config', title: '积分配置', - path: '/pages/mall/admin/marketing/integral/config', + path: '/pages/mall/admin/marketing/points/config', componentKey: 'MarketingIntegralConfig', parentId: 'marketing', groupId: 'marketing-integral', diff --git a/pages/mall/admin/docs/UNI_APP_X_PAGE_FIX_GUIDE.md b/pages/mall/admin/docs/UNI_APP_X_PAGE_FIX_GUIDE.md index c6940b84..e06080df 100644 --- a/pages/mall/admin/docs/UNI_APP_X_PAGE_FIX_GUIDE.md +++ b/pages/mall/admin/docs/UNI_APP_X_PAGE_FIX_GUIDE.md @@ -1,4 +1,4 @@ ---- +--- 🚧 注意: ⚠ 注意:当前使用 mock 数据,后续真实接口完成后替换 @@ -1947,6 +1947,23 @@ const iconMap: Record = { - **CRMEB 路由映射**: 1:1 复刻 CRMEB 的路由和菜单结构 - **双侧边栏布局**: 主侧边栏(一级) + 二级侧边栏(分组) + +## 🎯 阶段十八: Vue/Vite 编译失败导致的连锁依赖雪崩 (500 错误与动态导入阻断) + +### **原因三十二:SCSS 括号闭合错误引发的 ?import 连锁报错** + +- **现象**: + 1. 浏览器控制台出现核心组件的 SCSS 编译失败:GET /pages/mall/admin/product/product-management/index.uvue?...&lang.scss 500 + 2. 随后出现警告:[Vue warn]: Unhandled error during execution of async component loader + 3. 最终报错阻断页面级加载:TypeError: Failed to fetch dynamically imported module: /pages/mall/admin/homePage/index.uvue?import +- **原因**: + 在修改或合并页面(如整合目录结构)时,不慎破坏了 )。由于 Vite 处理 uni-app-x 时是按块编译的,CSS 预处理报错会导致服务端直接向该组件抛出 **500 错误**。 + 在 "内部路由/状态驱动" 模式下,我们的系统依赖 dminComponentMap.uts 全量静态扫描所有的管理页面。一旦链路树中的某个子节点(例如 product-management/index.uvue)发生了 500 编译失败,会导致整个模块依赖树发生雪崩。父级页面(如引了全局 Layout 的 homePage/index.uvue)会因为底层的依赖断裂,无法组装出正确的 JS 模块,最终导致 **动态导入失败** 的假象。 +- **解决方案**: + 1. **禁止盲目改路由**:**绝对不要**因为看到 homePage 报错就去重写 homePage 或者怀疑路由表配错了。 + 2. **顺藤摸瓜找源头**:沿着浏览器 Network 或者 Console 错误的最顶部往上翻,找到第一个且唯一一个抛出 500 的资源(在本例中是 lang.scss)。 + 3. **修复语法树**:回到那个触发 500 的文件,检查并修复 emplate、script、style 标签的闭锁以及其内部(特别是 SCSS 嵌套)的语法错误(如括号配对)。语法自洽后,整个异步组件树便会瞬间全量恢复正常。 +- **防止复发规范**: 当执行文件全局批量替换或目录大迁移后,切勿遗留未闭合的代码块。修复问题必须采用“由底向外”的收敛原则。 --- 这个指南现在涵盖了 uni-app-x 项目开发中最常见的 17 类问题(新增动态导入与语法遮蔽解析),为后续开发提供了完整的故障排除和最佳实践指导。 🚀 @@ -2188,4 +2205,5 @@ curl -i -X OPTIONS "http://192.168.1.61:9122/rest/v1/ml_coupon_templates?select= --- -这个指南现在涵盖了 uni-app-x 项目开发中最常见的 32 类问题(包含全局组件化最佳实践),为后续开发提供了完整的故障排除和标准化指导。 🚀 +这个指南现在涵盖了 uni-app-x 项目开发中最常见的 33 类问题(包含全局组件化最佳实践),为后续开发提供了完整的故障排除和标准化指导。 🚀 + diff --git a/pages/mall/admin/marketing/integral/config.uvue b/pages/mall/admin/marketing/integral/config.uvue deleted file mode 100644 index 744b22c0..00000000 --- a/pages/mall/admin/marketing/integral/config.uvue +++ /dev/null @@ -1,264 +0,0 @@ - - - - - - diff --git a/pages/mall/admin/marketing/integral/order.uvue b/pages/mall/admin/marketing/integral/order.uvue deleted file mode 100644 index d1d30dcf..00000000 --- a/pages/mall/admin/marketing/integral/order.uvue +++ /dev/null @@ -1,412 +0,0 @@ - - - - - - diff --git a/pages/mall/admin/marketing/integral/record.uvue b/pages/mall/admin/marketing/integral/record.uvue deleted file mode 100644 index 8d9157d0..00000000 --- a/pages/mall/admin/marketing/integral/record.uvue +++ /dev/null @@ -1,302 +0,0 @@ - - - - - - - diff --git a/pages/mall/admin/marketing/points/config.uvue b/pages/mall/admin/marketing/points/config.uvue index 5c525af3..744b22c0 100644 --- a/pages/mall/admin/marketing/points/config.uvue +++ b/pages/mall/admin/marketing/points/config.uvue @@ -1,24 +1,264 @@ - - diff --git a/pages/mall/admin/marketing/points/goods.uvue b/pages/mall/admin/marketing/points/goods.uvue index f1d13914..07283639 100644 --- a/pages/mall/admin/marketing/points/goods.uvue +++ b/pages/mall/admin/marketing/points/goods.uvue @@ -1,22 +1,398 @@ + diff --git a/pages/mall/admin/marketing/points/index.uvue b/pages/mall/admin/marketing/points/index.uvue index 025d071f..07283639 100644 --- a/pages/mall/admin/marketing/points/index.uvue +++ b/pages/mall/admin/marketing/points/index.uvue @@ -1,92 +1,398 @@ - + diff --git a/pages/mall/admin/marketing/integral/list.uvue b/pages/mall/admin/marketing/points/list.uvue similarity index 100% rename from pages/mall/admin/marketing/integral/list.uvue rename to pages/mall/admin/marketing/points/list.uvue diff --git a/pages/mall/admin/marketing/points/order.uvue b/pages/mall/admin/marketing/points/order.uvue index 2bdb5b0d..d1d30dcf 100644 --- a/pages/mall/admin/marketing/points/order.uvue +++ b/pages/mall/admin/marketing/points/order.uvue @@ -1,25 +1,412 @@ - - + diff --git a/pages/mall/admin/marketing/integral/index.uvue b/pages/mall/admin/marketing/points/product.uvue similarity index 100% rename from pages/mall/admin/marketing/integral/index.uvue rename to pages/mall/admin/marketing/points/product.uvue diff --git a/pages/mall/admin/marketing/points/record.uvue b/pages/mall/admin/marketing/points/record.uvue index 2383e7a2..8d9157d0 100644 --- a/pages/mall/admin/marketing/points/record.uvue +++ b/pages/mall/admin/marketing/points/record.uvue @@ -1,24 +1,302 @@ - - diff --git a/pages/mall/admin/marketing/integral/statistic.uvue b/pages/mall/admin/marketing/points/statistic.uvue similarity index 100% rename from pages/mall/admin/marketing/integral/statistic.uvue rename to pages/mall/admin/marketing/points/statistic.uvue diff --git a/pages/mall/admin/marketing/points/stats.uvue b/pages/mall/admin/marketing/points/stats.uvue index 640404d8..0f6a2b50 100644 --- a/pages/mall/admin/marketing/points/stats.uvue +++ b/pages/mall/admin/marketing/points/stats.uvue @@ -1,24 +1,348 @@ - - diff --git a/pages/mall/admin/product/product-management/index.uvue b/pages/mall/admin/product/product-management/index.uvue index 53d7b4ac..e42ab1be 100644 --- a/pages/mall/admin/product/product-management/index.uvue +++ b/pages/mall/admin/product/product-management/index.uvue @@ -524,8 +524,8 @@ function moveToRecycle(id: number) { .p-name-txt { font-size: 13px; line-height: 1.4; color: #333; } .activity-tags { -.op-divider { color: #e8e8e8; font-size: 12px; margin: 0 4px; } - + .op-divider { color: #e8e8e8; font-size: 12px; margin: 0 4px; } + } .more-dropdown { display: flex; flex-direction: row; @@ -561,4 +561,5 @@ function moveToRecycle(id: number) { &.disabled { color: #c0c4cc; background: #f5f7fa; } } } + diff --git a/pages/mall/admin/错误信息.txt b/pages/mall/admin/错误信息.txt index 01cb66fe..ec1a46e0 100644 --- a/pages/mall/admin/错误信息.txt +++ b/pages/mall/admin/错误信息.txt @@ -1,4 +1,4 @@ -GET http://localhost:5173/pages/mall/admin/marketing/coupon/list.uvue?import net::ERR_ABORTED 500 (Internal Server Error) +index.uvue:991 GET http://localhost:5173/pages/mall/admin/product/product-management/index.uvue?vue&type=style&index=0&scoped=6161a702&lang.scss net::ERR_ABORTED 500 (Internal Server Error) main.uts:16 [Vue warn]: Unhandled error during execution of async component loader at at