|
@@ -159,6 +159,14 @@ export default {
|
|
|
goPage: function(url) {
|
|
goPage: function(url) {
|
|
|
uni.navigateTo({ url: 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) {
|
|
goReportDetail: function(report) {
|
|
|
if (report.id) {
|
|
if (report.id) {
|
|
|
uni.navigateTo({ url: '/pages/health/report-list?reportId=' + report.id })
|
|
uni.navigateTo({ url: '/pages/health/report-list?reportId=' + report.id })
|
|
@@ -168,10 +176,11 @@ export default {
|
|
|
},
|
|
},
|
|
|
loadHealthData: function() {
|
|
loadHealthData: function() {
|
|
|
var self = this
|
|
var self = this
|
|
|
|
|
+ var memberId = this.getMemberId()
|
|
|
try {
|
|
try {
|
|
|
var api = require('../../utils/api.js')
|
|
var api = require('../../utils/api.js')
|
|
|
- // 加载健康报告列表
|
|
|
|
|
- api.getReportList().then(function(res) {
|
|
|
|
|
|
|
+ // 加载健康报告列表(需要 memberId)
|
|
|
|
|
+ api.getReportList(memberId).then(function(res) {
|
|
|
if (res.code === 200 && res.data) {
|
|
if (res.code === 200 && res.data) {
|
|
|
var list = Array.isArray(res.data) ? res.data : (res.data.list || [])
|
|
var list = Array.isArray(res.data) ? res.data : (res.data.list || [])
|
|
|
self.reports = list
|
|
self.reports = list
|