COMPATIBILITY.md 5.61 KB

Phase 1 兼容性说明

避免合并组件后 CSS/JS 引用报错,实施时已做以下防护。

1. JS 依赖(微信依赖分析 / 上传)

文件 用途 防护
components/Popup/popup.helpers.js Popup footer 逻辑 已加入 project.config.json → packOptions.include
components/CalendarMonth/calendarMonth.helpers.js monthOnly 初始状态 同上
components/CalendarMonth/Calendar_Function_monthOnly.js 首页月历专用逻辑 同上
components/TechnicianSelectPopup/technicianSelect.helpers.js Phase 2 技师 idKey 逻辑 同上
components/SideSelectPopup/sideSelect.helpers.js Phase 2 dataSource 分支 同上
components/storePicker/storePicker.helpers.js Phase 2 pickerType/confirm 同上

与现有 customerInfo.pagination.js、Confirm/form.js 同一处理方式,避免 ignoreUploadUnusedFiles: true 误过滤。

2. 组件 json 显式注册 popup

子组件内使用 <popup> 时,除 app.json 全局注册外,在组件 json 内再次声明更稳妥:

  • packageEquity/components/OrderNoPopup/OrderNoPopup.json
  • tabIndex/components/recordingOrderPopup/recordingOrderPopup.json
  • tabMine/components/switchPopup/switchPopup.json
  • pages/tabMine/components/switchPopup/switchPopup.json

3. 静态资源(close 图标)

close 图标使用已上传并完成内容校验的 CDN 路径:

import { CLOSE_ICON_URL } from '../../utils/imageBase.js'
// CLOSE_ICON_URL → https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/components/images/close.png

公共组件图片统一通过 componentsImageUrl(name) 拼接 components/images/ CDN 路径,不要改用 rootImageUrl(name),两者目录语义不同。

涉及:Popup、CalendarMonth、tipsBottom。本地 components/images/close.png 及其 packOptions.include 已移除。

4. WXML 布尔属性

微信对无值布尔属性解析不一致,已改为显式写法:

monthOnly="{{ true }}"
show-close-icon="{{ true }}"

5. CalendarMonth monthOnly 选月

  • attached 读 this.properties.monthOnly / monType,设置 _monthOnlyMode,实例化 CalendarMonthOnly
  • monChoose / done:monthOnly 下固定走 this.properties.dateType(single)及 CalendarMonthOnly.done()
  • WXML:monthOnly 仅绑 active class;calender-view--monthOnly 单选四角圆角
  • close 图标:CLOSE_ICON_URL(CDN components/images/close.png)
  • helper 仅 getInitialDayType / resolveMonthOnly(calendarMonth.helpers.js)

6. Popup CSS 变体兼容

原组件 合并后 CSS class
tipsPopup footer-mode="none" .popup-slot--noneFooter(内边距)
tabPopup footer-mode="tips" .popup-footer--tips(按钮 28px + 取消边框)
默认 Popup footer-mode="default" 保持原 .popup-footer 样式

7. Popup data 默认值

showFooter / showTitleClose / slotClass 等在 data 中有初始值,attached 前 WXML 不会访问 undefined。

8. 全局组件下沉后页面 json

组件 注册位置 备注
order-confirm tabDate/pages/index/index.json 该页未在 app.json 注册,无线上入口;预约 Tab 用 DateScreen
date-picker tabDate/pages/detail/detail.json、pages/tabDateIndex/pages/tabDateIndex.json 可测;tabDate/pages/index 同 orphan 页,勿作回归入口
qr-box tabWorkOrder/pages/orderDetail、constructionOrderDetail

若新增页面使用上述标签,须在对应页 json 注册,不能仅依赖 app.json(已从全局移除)。

9. 编译自检清单

  1. 微信开发者工具 → 详情 → 本地设置 → 打开「将 JS 编译成 ES5」
  2. 编译后 Console 无 Component is not found / module not defined
  3. 预览上传前确认 packOptions.include 三项 helper 仍在
  4. 运行 npm run test:components(33/33)

11. Phase 2 合并要点

组件 新 prop 默认(向后兼容)
TechnicianSelectPopup idKey technicianId(工单页);repair 页显式 uuid
SideSelectPopup dataSource prop(父传 storeList);多店账号用 page
storePicker pickerType / merchantRangeListTotal 不传则 operatingShow 行为(confirm+search)

删除目录:ArtificerSelectPopup/、SideSelectByPagePopup/、staffDaily/upgradeStaffDaily 本地 storePicker/。

12. Phase 2.4 日历统一

模式 prop 行为
原全局 Calendar dayOnly=true(默认) 无日/月切换,仅日期选择
operatingShow 等 dayOnly="{{ false }}" 日/月切换 + range
绩效 monthOnly monthOnly=true 优先于 dayOnly,Phase 1 行为不变
  • app.json:"calendar": "/components/CalendarMonth/CalendarMonth"
  • 删除:components/Calendar/
  • 保留 API:resetData(date)、disabled、range 的 maxDayRange / maxDayRangeType

第三套日历(本批不合并)

tabDate/components/calendar/ 仅 apprManage 使用:

  • 内嵌 swiper 周历、spotMap、refresh()、bindselectDay
  • 与全局 CalendarMonth API/UI 不同,勿与 Phase 2.4 合并混淆
  • 后续若迁移需单独开 Phase 2.4b

10. 已知行为差异(非报错)

  • footer-mode="none" 关闭时仍会 triggerEvent('cancel')(原 tipsPopup 不触发);当前引用页未绑 bindcancel,无影响。
  • 全局 <popup> 默认 footerMode=default,旧页面无 footer 变体需求则行为不变。