|
|
@@ -287,12 +287,9 @@ export default {
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
- if (!found && self.children.length > 0) {
|
|
|
- self.activeChildId = self.children[0].childId
|
|
|
- self.activeChildName = self.children[0].name || self.children[0].nickname || '孩子'
|
|
|
- uni.setStorageSync('currentChildId', self.activeChildId)
|
|
|
- }
|
|
|
- if (self.activeChildId) {
|
|
|
+ // FIX: 不再自动选择第一个孩子。仅在用户通过 UserQuickEntry 切换时设置 activeChildId
|
|
|
+ // 默认情况下,页面显示当前登录用户自己的数据(由 API 根据 token 推断)
|
|
|
+ if (found) {
|
|
|
self.loadDashboardData()
|
|
|
}
|
|
|
self.loadContacts()
|
|
|
@@ -484,40 +481,24 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
if (item.page === 'health-dimensions') {
|
|
|
- if (!this.activeChildId) {
|
|
|
- uni.showToast({ title: '请先选择孩子', icon: 'none' })
|
|
|
- return
|
|
|
- }
|
|
|
- uni.navigateTo({ url: '/pages/body-detail/health-dimensions?childId=' + this.activeChildId })
|
|
|
+ uni.navigateTo({ url: '/pages/body-detail/health-dimensions?childId=' + (this.activeChildId || '') })
|
|
|
return
|
|
|
}
|
|
|
if (item.page) uni.navigateTo({ url: item.page })
|
|
|
},
|
|
|
goToHealthReport: function() {
|
|
|
- var id = this.activeChildId || uni.getStorageSync('currentChildId')
|
|
|
- if (!id) {
|
|
|
- uni.showToast({ title: '请先选择成员', icon: 'none' })
|
|
|
- return
|
|
|
- }
|
|
|
+ var id = this.activeChildId || uni.getStorageSync('currentChildId') || ''
|
|
|
uni.navigateTo({ url: '/pages/body-detail/health-report?childId=' + id })
|
|
|
},
|
|
|
goDimensionDetail: function(dimKey) {
|
|
|
uni.navigateTo({ url: '/pages/body/dimension-detail?dimension=' + dimKey + '&childId=' + this.activeChildId })
|
|
|
},
|
|
|
goToCheckin: function() {
|
|
|
- var id = this.activeChildId || uni.getStorageSync('currentChildId')
|
|
|
- if (!id) {
|
|
|
- uni.showToast({ title: '请先选择成员', icon: 'none' })
|
|
|
- return
|
|
|
- }
|
|
|
+ var id = this.activeChildId || uni.getStorageSync('currentChildId') || ''
|
|
|
uni.navigateTo({ url: '/pages/body-detail/checkin?childId=' + id })
|
|
|
},
|
|
|
goToNutritionProfile: function() {
|
|
|
- var id = this.activeChildId || uni.getStorageSync('currentChildId')
|
|
|
- if (!id) {
|
|
|
- uni.showToast({ title: '请先选择成员', icon: 'none' })
|
|
|
- return
|
|
|
- }
|
|
|
+ var id = this.activeChildId || uni.getStorageSync('currentChildId') || ''
|
|
|
uni.navigateTo({ url: '/pages/health/nutrition-profile?childId=' + id })
|
|
|
},
|
|
|
goToUploadReport: function() {
|