feat(h5): 首页 feed 真接入 /meituan/feed+top-sales(渲染/翻页/缓存/三态/抢)

删 7 张写死 mock 卡改 CouponCard 动态渲染(随原生:feed-tag 只用 price_label/rank_label,去掉「比团购省」);三排序 tab 智能推荐/距离最近→feed、销量最高→top-sales(删 mock 残留 asc/desc);触底翻页 + 每 tab 5min 缓存 + loading/empty/degraded 三态 + 去重 + 切 tab 防竞态 + 未授权只切高亮不打接口;抢→referral-link([1,3])→SGBridge.openMeituan(deeplink||h5)。含原 H2a 定位空态 WIP 一并提交。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
guke
2026-06-30 10:18:45 +08:00
parent 674b8c5589
commit 6682f9d0d4
2 changed files with 357 additions and 159 deletions
+14
View File
@@ -56,3 +56,17 @@ def test_h5_bridge_has_get_location(client) -> None:
body = resp.text
assert "getLocation" in body
assert "116.404" in body and "39.928" in body # 浏览器 mock 北京兜底
def test_h5_home_feed_wired(client) -> None:
# H2b: 首页 feed 接真实美团端点 + 抢换链;mock 静态卡已移除
resp = client.get("/h5/home/index.html")
assert resp.status_code == 200
body = resp.text
assert "/api/v1/meituan/feed" in body # rec/distance
assert "/api/v1/meituan/top-sales" in body # 销量最高
assert "/api/v1/meituan/referral-link" in body # 抢
assert "HomeFeed" in body # feed 模块已挂
assert "茶百道" not in body # 写死的 mock 卡(店名)已移除
assert "chabaidao.png" not in body # 写死的 mock 头图已移除
assert "比团购省 5.5 元" not in body # 随原生:mock 卡的「比团购省」标签已删(渲染只用 price_label/rank_label)