فهرست منبع

fix(frontend): health tab getReportList 空 memberId → 从 store/storage 取当前用户ID

E2E Test Bot 1 ماه پیش
والد
کامیت
00f5cf8185
1فایلهای تغییر یافته به همراه11 افزوده شده و 2 حذف شده
  1. 11 2
      cfc-frontend/pages/health-main/index.vue

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

@@ -159,6 +159,14 @@ export default {
     goPage: function(url) {
       uni.navigateTo({ url: url })
     },
+    getMemberId: function() {
+      // 优先当前选中的孩子/成员,兜底用登录用户 ID
+      var store = this.$store
+      if (store && store.state && store.state.currentChildId) return store.state.currentChildId
+      if (store && store.state && store.state.currentMemberId) return store.state.currentMemberId
+      if (store && store.state && store.state.userId) return store.state.userId
+      return uni.getStorageSync('userId') || ''
+    },
     goReportDetail: function(report) {
       if (report.id) {
         uni.navigateTo({ url: '/pages/health/report-list?reportId=' + report.id })
@@ -168,10 +176,11 @@ export default {
     },
     loadHealthData: function() {
       var self = this
+      var memberId = this.getMemberId()
       try {
         var api = require('../../utils/api.js')
-        // 加载健康报告列表
-        api.getReportList().then(function(res) {
+        // 加载健康报告列表(需要 memberId)
+        api.getReportList(memberId).then(function(res) {
           if (res.code === 200 && res.data) {
             var list = Array.isArray(res.data) ? res.data : (res.data.list || [])
             self.reports = list