fix: 修复动作卡片点击双触发导致跳 404

- 8 个页面 exercise-card 由 bind:tap 改为 catch:tap,拦截原生 tap 冒泡
  避免一次点击被『自定义事件 + 原生冒泡』触发两次,
  第二次 e.detail 无 id → navigateTo detail?id=undefined → 404
- 所有 onExercise 顶部加 id 守卫,无 id 直接 return
- exercise-card 点击前校验 exercise.id,缺失不触发
- detail onLoad 的 id 为空时直接显示空态,不再发起错误请求
This commit is contained in:
2026-07-22 15:30:28 +08:00
parent 70ff806042
commit 06bd96a473
17 changed files with 24 additions and 9 deletions

View File

@@ -86,6 +86,7 @@ Page({
},
onExercise(e) {
if (!e || !e.detail || !e.detail.id) return;
wx.navigateTo({ url: '/pages/detail/detail?id=' + encodeURIComponent(e.detail.id) });
}
});

View File

@@ -71,7 +71,7 @@
exercise="{{item}}"
score="{{item.score}}"
reason="{{item.reason}}"
bind:tap="onExercise" />
catch:tap="onExercise" />
</view>
</view>
<view wx:else class="empty">{{ loading ? '匹配中…' : '暂无匹配结果' }}</view>