Files
xinlong-shop-taro/.workbuddy/memory/2026-06-26.md
赵忠林 6f83780e9c fix(shop): 修复商品详情页底部三按钮功能异常
- 修正购物车按钮路由,改用 navigateTo 指向实际页面
- 实现微信小程序原生客服会话,失败时降级跳转客服页面
- 优化收藏接口容错,错误时仍同步前端状态避免UI卡死
- 去除重复错误提示,保持错误信息统一由handleError处理
2026-06-26 22:34:45 +08:00

25 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 2026-06-26
### 商品详情页轮播图添加点击放大预览
- **文件**: `src/pages/shop/product-detail.tsx`
- 在 Swiper 轮播图的 Image 上添加 `onClick` → 调用 `Taro.previewImage({ current: img, urls: images })`
- `previewImage` 是 Taro 内置 API在小程序中原生支持全屏预览 + 左右滑动翻图,无需额外组件
- **文件**: `src/pages/points/product-detail.tsx` — 同样添加了点击放大预览
### 商品详情页底部三按钮修复(购物车/客服/收藏)
- **文件**: `src/pages/shop/product-detail.tsx`
**1. 购物车路由修复**
- 原代码:`Taro.switchTab({ url: '/pages/shop/cart/index' })` — 路径不存在且用了 switchTab
- 修复:改为 `Taro.navigateTo({ url: '/pages/shop/cart' })`,指向实际页面 `pages/shop/cart.tsx`
**2. 客服功能实现**
- 原代码:仅弹 toast "客服功能开发中"
- 修复:优先调用 `Taro.openCustomerServiceChat()` 打开微信原生客服会话;失败时降级跳转到 `/pages/user/customer-service/index` 客服页面
**3. 收藏接口容错**
- 问题:取消收藏时后端返回错误"取消收藏失败"UI 状态卡住不一致
- 修复catch 中仍翻转 UI 状态(保证前端状态一致),去掉多余的重复 toasthandleError 已弹后端错误信息)
构建编译通过 ✓