refactor(common): 移除公共组件中的 NutUI Button,改用 Taro 原生 Button

- `EmptyState` 和 `FixedButton` 两个组件全部替换 NutUI Button 为 Taro 原生 Button
- 解决空状态按钮在微信小程序端不可见的问题,确保按钮正常显示
- `FixedButton` 组件虽然未被调用,仍保留但调整实现,icon 由 prop 改为 children 渲染
- 统一主色使用 tailwind 的 `bg-red-500`,弃用原 NutUI primary 颜色
- 全局修复微信小程序原生 button 的 `::after` 灰色描边问题,在全局样式中设置 `button::after { border: none; }`
- NutUI Button 的引用文件数由 27 减至 25,`src/components/common/` 完全无 NutUI 依赖
- CMS 请求链路调整,所有 CMS 接口改用独立 `cmsRequest` 实现,确保请求正确
- 修正 `src/api/official` 的数据层,取消错误的 shop
This commit is contained in:
2026-08-11 11:12:23 +08:00
parent 6dd4ca9785
commit db1bc728f6
2 changed files with 27 additions and 1 deletions
+7 -1
View File
@@ -24,7 +24,13 @@
## 官网分包 official2026-08-11 落地)
- 位置 `src/official/`6 页:index/article/article-detail/about/message/mine+ `src/official/components/`OfficialTabBar/ArticleCard/SectionTitle),在 `src/app.config.ts``subpackages` 中 root=`official`。入口在 `src/pages/index/index.tsx` 搜索栏下的「企业官网」卡片。
- 数据层统一从 `@/api/official` 引入(re-export `src/api/cms/*`)。**内容请求走默认 shop-api`https://shop-api.websoft.top/api`),shop-api 已代理 `/cms` 前缀,不要另配 cms-api 域名**(避免小程序合法域名白名单成本)。租户靠 `TenantId` 请求头。
- 数据层统一从 `@/api/official` 引入(re-export `src/api/cms/*`)。租户靠 `TenantId` 请求头。
- **⚠️ CMS 请求链路(2026-08-11 修正,勿回退)**CMS 接口**不能**走 shop-api——`shop-api.websoft.top/api/cms/...` 返回 **404**shop-api 并未代理 `/cms`(早前"已代理"的判断是错的)。现全部走独立 `https://cms-api.websoft.top/api`
- `config/env.js` 三环境均有 `CMS_API_BASE_URL``config/app.ts` 导出 `CmsBaseUrl`
- `src/utils/cmsRequest.ts` 基于 request 封装、默认 baseUrl=CmsBaseUrlAPI 与 request 一致。
- `src/api/cms/` 下 34 个 `index.ts` 一律 `import cmsRequest`**新增 CMS 接口必须用 cmsRequest,不要用 request**。
- 需在小程序后台把 `cms-api.websoft.top` 加入 request 合法域名白名单。
- 批量替换技巧:macOS `sed``request\.(get|post)\(` 替换无效,改用 `perl -pi -e 's/request\.get/cmsRequest.get/g'`
- CMS 字段陷阱:文章封面 `image`(非 cover)、摘要 `overview`(非 summary)、`ARTICLE_STATUS.PUBLISHED = 0`0 才是已发布);留言内容字段是 `need`(非 content),小程序提交带 `source:'miniapp'`
- 微信原生 tabBar **不支持分包页面**,官网底部导航是自实现的 `OfficialTabBar`(用 `redirectTo`)。
- 品牌色统一 tokentailwind `brand` 色阶(600=`#185FA5`+ `app.scss``--brand-color/--brand-light`。富文本用 `.official-rich`(定义在 `app.scss`px 自动转 rpx)。