fix(自主填报): 修正重提跳转按填报类型、补 wx:key 并清理废弃 API 调用

一、填报记录「重新提交」跳错表单(用户反馈)

records.vue 原先按 activeType(当前 tab)决定跳驻店还是跑店表单,
但列表请求无守卫:切 tab 会连发请求且响应顺序不保证,
旧响应回来会盖掉当前 tab 的数据,导致 tab 与实际数据错位。
此时点「重新提交」会拿 A 表的 id 去打开 B 表的表单
(两表 id 各自从 1 开始,撞号常见,故不报错、只静默进错页面)。

改法:把填报类型钉在记录上,而不是靠 tab 状态猜
- fetchList 拉到数据后给每条记录打 reportType
- 新增 recordType(item):优先取记录自带类型,异常数据回退当前 tab
- 归一化、筛选、卡片标题/副标题、展开详情形态、重新提交跳转全部改走它
- 列表请求加自增 listRequestId 守卫,丢弃过期响应(loading 同理)

二、visit.vue 缺 wx:key 告警

小程序 wx:key 只接受简单属性路径,模板字面量写法
(:key="`store-${idx}`")会被编译器静默丢弃,四处循环因此无 key。
按项目既有 _rowKey 模式改:
- 巡店列表 :key="item._rowKey",新增 buildStoreKey/ensureStoreKeys
  (重提与草稿的旧数据无该字段,加载时补齐;提交走显式白名单,不外泄)
- 照片 :key="photo",两个 picker :key="item.id"

三、getSystemInfoSync 废弃告警

该调用在 AppNavbar 的 render(getSafeTop)里,每渲染一次告警一次。
改为挂载时取一次并缓存,优先用新接口 uni.getWindowInfo,
取不到再回退旧接口;select.vue 同源调用一并处理。

注:uview 组件库内部 u-overlay/u-popup 的 mode 传 null 告警
(u-popup 的 position computed 无 else 分支)未改,
uni_modules 已被 gitignore 且会被依赖重装覆盖,属组件库问题。
This commit is contained in:
2026-10-12 13:47:03 +08:00
parent aff1e52e3e
commit 2ff8d42207
4 changed files with 97 additions and 23 deletions
+23 -3
View File
@@ -27,21 +27,41 @@ export default {
},
data() {
return {
currentPages: []
currentPages: [],
// 状态栏高度只在挂载时取一次:getSafeTop 在 render 中被调用,
// 每次都同步读系统信息会反复触发 wx.getSystemInfoSync 废弃告警。
safeTop: 0
}
},
methods: {
getSafeTop() {
const systemInfo = uni.getSystemInfoSync()
return systemInfo.statusBarHeight
return this.safeTop
},
back(){
if (this.currentPages.length === 1) uni.switchTab({url: '/pages/index/index'})
else uni.navigateBack()
},
// 优先用新接口,取不到时回退旧接口,避免旧接口的废弃告警
readSafeTop() {
try {
if (uni.getWindowInfo) {
const info = uni.getWindowInfo()
if (info && info.statusBarHeight !== undefined) return info.statusBarHeight
}
} catch (error) {
// ignore:新接口不可用时走下面的回退
}
try {
const systemInfo = uni.getSystemInfoSync()
return (systemInfo && systemInfo.statusBarHeight) || 0
} catch (error) {
return 0
}
}
},
mounted() {
this.currentPages = getCurrentPages()
this.safeTop = this.readSafeTop()
}
}
</script>