Parcourir la source

fix(health): 健康首页最近记录默认展示全家报告

家长本人默认视角(未切换到具体成员)时最近记录按全家查询(memberId 传空),
避免最新上传/归属到其他成员的报告在首页不显示;切换到具体成员或孩子本人登录时仍按成员过滤。

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
liaoxg il y a 5 jours
Parent
commit
28e6d314ae
1 fichiers modifiés avec 7 ajouts et 2 suppressions
  1. 7 2
      cfc-frontend/pages/health-main/index.vue

+ 7 - 2
cfc-frontend/pages/health-main/index.vue

@@ -543,8 +543,13 @@ export default {
       try {
         var api = require('../../utils/api.js')
         var memberId = uni.getStorageSync('currentChildId') || uni.getStorageSync('currentMemberId') || uni.getStorageSync('userId') || ''
-        // 健康报告:传入当前用户memberId,返回当前用户的报告(size=3 仅返回最近 3 条)
-        api.getReportList(memberId, 3).then(function(res) {
+        // 家长本人默认视角(未切换到具体成员)→ 最近记录展示全家最新报告(memberId 传空),
+        // 避免最新上传/归属到其他成员的报告在首页不显示;切换到具体成员或孩子本人登录时展示该成员的报告
+        var currentView = uni.getStorageSync('currentView')
+        var currentRole = uni.getStorageSync('currentRole')
+        var reportMemberId = (currentView !== 'member' && currentRole !== 'child') ? '' : memberId
+        // 健康报告:memberId 为空时后端返回当前家庭全部报告(size=3 仅返回最近 3 条)
+        api.getReportList(reportMemberId, 3).then(function(res) {
           if (res.code === 200 && res.data) {
             var list = Array.isArray(res.data) ? res.data : (res.data.list || [])
             self.reports = list