|
|
@@ -55,49 +55,6 @@
|
|
|
accent-color="#FF8C42"
|
|
|
:dims="healthSubDims" />
|
|
|
|
|
|
- <!-- 指标告警:疾病风险+营养/氨基酸异常(仅显示异常项) -->
|
|
|
- <view class="section alert-card" v-if="isLoggedIn && bodyAbnormalData">
|
|
|
- <view class="section-header">
|
|
|
- <text class="section-title">⚠️ 指标告警</text>
|
|
|
- <text class="section-subtitle">仅显示异常指标</text>
|
|
|
- </view>
|
|
|
- <template v-if="!bodyAbnormalData.hasReport">
|
|
|
- <view class="alert-empty">
|
|
|
- <text class="alert-empty-text">上传菌群报告后查看异常指标</text>
|
|
|
- <button class="alert-upload-btn" @click="goToUploadReport">去上传</button>
|
|
|
- </view>
|
|
|
- </template>
|
|
|
- <template v-else>
|
|
|
- <!-- 疾病风险 -->
|
|
|
- <view class="alert-group" v-if="bodyAbnormalData.diseaseRisks && bodyAbnormalData.diseaseRisks.length > 0">
|
|
|
- <text class="alert-group-title">🩺 疾病风险</text>
|
|
|
- <view class="alert-item" v-for="(risk, idx) in bodyAbnormalData.diseaseRisks" :key="'dr' + idx">
|
|
|
- <text class="alert-item-name">{{ risk.name }}</text>
|
|
|
- <text :class="['alert-item-level', 'level-' + (risk.level === '高风险' ? 'high' : 'warn')]">{{ risk.level }}</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <!-- 主要营养素异常 -->
|
|
|
- <view class="alert-group" v-if="bodyAbnormalData.nutritionAbnormal && bodyAbnormalData.nutritionAbnormal.length > 0">
|
|
|
- <text class="alert-group-title">🥗 主要营养素</text>
|
|
|
- <view class="alert-item" v-for="(item, idx) in bodyAbnormalData.nutritionAbnormal" :key="'nt' + idx">
|
|
|
- <text class="alert-item-name">{{ item.name }}</text>
|
|
|
- <text class="alert-item-status">{{ item.status }}</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <!-- 氨基酸异常 -->
|
|
|
- <view class="alert-group" v-if="bodyAbnormalData.aminoAcidAbnormal && bodyAbnormalData.aminoAcidAbnormal.length > 0">
|
|
|
- <text class="alert-group-title">🧬 氨基酸</text>
|
|
|
- <view class="alert-item" v-for="(item, idx) in bodyAbnormalData.aminoAcidAbnormal" :key="'aa' + idx">
|
|
|
- <text class="alert-item-name">{{ item.name }}</text>
|
|
|
- <text class="alert-item-status">{{ item.status }}</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="alert-no-data" v-if="(!bodyAbnormalData.diseaseRisks || bodyAbnormalData.diseaseRisks.length === 0) && (!bodyAbnormalData.nutritionAbnormal || bodyAbnormalData.nutritionAbnormal.length === 0) && (!bodyAbnormalData.aminoAcidAbnormal || bodyAbnormalData.aminoAcidAbnormal.length === 0)">
|
|
|
- <text class="alert-no-data-text">暂无异常指标,保持健康状态</text>
|
|
|
- </view>
|
|
|
- </template>
|
|
|
- </view>
|
|
|
-
|
|
|
<!-- 功能入口 -->
|
|
|
<view class="func-section" v-if="sectionVisible('func_entries')">
|
|
|
<view class="func-grid">
|
|
|
@@ -152,7 +109,7 @@ import DimensionSubDims from '../../components/DimensionSubDims.vue'
|
|
|
import FloatingAvatar from '../../components/AIFloatingAvatar.vue'
|
|
|
import DimensionIntroCard from '../../components/DimensionIntroCard.vue'
|
|
|
import FamilyMemberStrip from '../../components/FamilyMemberStrip.vue'
|
|
|
-import { getVisibleSections, getEnergyOverview, getChildren, getFamilyEnergySandbox, getEnergySandbox, getFamilyMemberList, getDimensionOverview, getBodyAbnormalIndicators } from '../../utils/api.js'
|
|
|
+import { getVisibleSections, getEnergyOverview, getFamilyEnergySandbox, getEnergySandbox, getFamilyMemberList, getDimensionOverview } from '../../utils/api.js'
|
|
|
|
|
|
export default {
|
|
|
components: { TabTransition, FamilyEnergyBar, RadarChart, DimensionSubDims, FloatingAvatar, FamilyMemberStrip, DimensionIntroCard },
|
|
|
@@ -176,7 +133,6 @@ export default {
|
|
|
dualDimension: null,
|
|
|
visibleSections: [],
|
|
|
dimensionData: null,
|
|
|
- bodyAbnormalData: null,
|
|
|
/** Mock 平均值(7维):生长发育/睡眠质量/视力健康/免疫力/营养均衡/肠胃健康/运动活力 */
|
|
|
radarAvgScores: [72, 68, 75, 70, 73, 69, 71],
|
|
|
funcList: [
|
|
|
@@ -260,8 +216,6 @@ export default {
|
|
|
this.loadSectionConfig()
|
|
|
if (this.isLoggedIn) {
|
|
|
this.loadChildren()
|
|
|
- this.loadFamilyMembersVisible()
|
|
|
- this.loadBodyAbnormalData()
|
|
|
}
|
|
|
// 游客也能浏览活动和商品
|
|
|
// 游客也能浏览文章
|
|
|
@@ -289,9 +243,12 @@ export default {
|
|
|
},
|
|
|
loadChildren: function() {
|
|
|
var self = this
|
|
|
- getChildren().then(function(res) {
|
|
|
+ getFamilyMemberList({ visibleOnly: true }).then(function(res) {
|
|
|
if (res.code === 200 && res.data) {
|
|
|
- self.children = res.data
|
|
|
+ var raw = res.data || []
|
|
|
+ // 统一字段:familyMemberList 返回 id,getChildren 返回 memberId
|
|
|
+ self.children = raw.map(function(m) { return { id: m.id, memberId: m.id, name: m.nickname || m.name, nickname: m.nickname || m.name } })
|
|
|
+ self.familyMembersVisible = raw
|
|
|
var savedChildId = uni.getStorageSync('currentChildId')
|
|
|
var found = false
|
|
|
for (var i = 0; i < self.children.length; i++) {
|
|
|
@@ -312,9 +269,13 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
self.childrenChecked = true
|
|
|
+ self.membersChecked = true
|
|
|
}).catch(function(e) {
|
|
|
console.log('获取孩子列表失败', e)
|
|
|
+ self.children = []
|
|
|
+ self.familyMembersVisible = []
|
|
|
self.childrenChecked = true
|
|
|
+ self.membersChecked = true
|
|
|
})
|
|
|
},
|
|
|
loadDashboardData: function() {
|
|
|
@@ -392,17 +353,6 @@ export default {
|
|
|
this.activeChildName = child.name || child.nickname || '孩子'
|
|
|
this.loadDashboardData()
|
|
|
},
|
|
|
- loadFamilyMembersVisible: function() {
|
|
|
- var self = this
|
|
|
- getFamilyMemberList({ visibleOnly: true }).then(function(res) {
|
|
|
- self.familyMembersVisible = res.data || []
|
|
|
- self.membersChecked = true
|
|
|
- }).catch(function(e) {
|
|
|
- console.log('获取可见家庭成员失败', e)
|
|
|
- self.familyMembersVisible = []
|
|
|
- self.membersChecked = true
|
|
|
- })
|
|
|
- },
|
|
|
scrollToSection: function(section) {
|
|
|
uni.pageScrollTo({ selector: '#' + section, duration: 300 })
|
|
|
},
|
|
|
@@ -453,20 +403,6 @@ export default {
|
|
|
var id = this.activeChildId || uni.getStorageSync('currentChildId') || ''
|
|
|
uni.navigateTo({ url: '/pages/health/report-upload?memberId=' + id + '&from=body' })
|
|
|
},
|
|
|
- loadBodyAbnormalData: function() {
|
|
|
- var self = this
|
|
|
- var memberId = self.activeChildId || uni.getStorageSync('currentChildId') || ''
|
|
|
- if (!memberId) return
|
|
|
- getBodyAbnormalIndicators(memberId).then(function(res) {
|
|
|
- if (res.code === 200 && res.data) {
|
|
|
- self.bodyAbnormalData = res.data
|
|
|
- } else {
|
|
|
- self.bodyAbnormalData = null
|
|
|
- }
|
|
|
- }).catch(function() {
|
|
|
- self.bodyAbnormalData = null
|
|
|
- })
|
|
|
- },
|
|
|
_watchPageReady() {
|
|
|
var self = this
|
|
|
var unwatch = this.$watch(function() {
|
|
|
@@ -916,93 +852,4 @@ export default {
|
|
|
color: #9A3412;
|
|
|
font-weight: 500;
|
|
|
}
|
|
|
-
|
|
|
-/* ===== 指标告警卡片 ===== */
|
|
|
-.alert-card {
|
|
|
- background: #fff;
|
|
|
- border-radius: 20rpx;
|
|
|
- padding: 24rpx;
|
|
|
- margin: 16rpx 24rpx;
|
|
|
- box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
|
|
|
-}
|
|
|
-.section-subtitle {
|
|
|
- font-size: 22rpx;
|
|
|
- color: #999;
|
|
|
- margin-left: 12rpx;
|
|
|
-}
|
|
|
-.alert-group {
|
|
|
- margin-bottom: 16rpx;
|
|
|
-}
|
|
|
-.alert-group-title {
|
|
|
- font-size: 26rpx;
|
|
|
- font-weight: 600;
|
|
|
- color: #333;
|
|
|
- margin-bottom: 10rpx;
|
|
|
- display: block;
|
|
|
-}
|
|
|
-.alert-item {
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
- padding: 10rpx 0;
|
|
|
- border-bottom: 1rpx solid #f5f5f5;
|
|
|
-}
|
|
|
-.alert-item:last-child {
|
|
|
- border-bottom: none;
|
|
|
-}
|
|
|
-.alert-item-name {
|
|
|
- font-size: 24rpx;
|
|
|
- color: #555;
|
|
|
-}
|
|
|
-.alert-item-level {
|
|
|
- font-size: 22rpx;
|
|
|
- padding: 4rpx 16rpx;
|
|
|
- border-radius: 8rpx;
|
|
|
- font-weight: 500;
|
|
|
-}
|
|
|
-.alert-item-level.level-high {
|
|
|
- background: #FEE2E2;
|
|
|
- color: #DC2626;
|
|
|
-}
|
|
|
-.alert-item-level.level-warn {
|
|
|
- background: #FEF3C7;
|
|
|
- color: #D97706;
|
|
|
-}
|
|
|
-.alert-item-status {
|
|
|
- font-size: 22rpx;
|
|
|
- padding: 4rpx 16rpx;
|
|
|
- border-radius: 8rpx;
|
|
|
- background: #FEE2E2;
|
|
|
- color: #DC2626;
|
|
|
-}
|
|
|
-.alert-empty {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- align-items: center;
|
|
|
- padding: 30rpx 0;
|
|
|
-}
|
|
|
-.alert-empty-text {
|
|
|
- font-size: 24rpx;
|
|
|
- color: #999;
|
|
|
- margin-bottom: 20rpx;
|
|
|
-}
|
|
|
-.alert-upload-btn {
|
|
|
- background: linear-gradient(135deg, #FF8C42, #FFA366);
|
|
|
- color: #fff;
|
|
|
- font-size: 26rpx;
|
|
|
- font-weight: 600;
|
|
|
- border: none;
|
|
|
- border-radius: 40rpx;
|
|
|
- padding: 14rpx 60rpx;
|
|
|
- line-height: 1.6;
|
|
|
- margin: 0;
|
|
|
-}
|
|
|
-.alert-no-data {
|
|
|
- text-align: center;
|
|
|
- padding: 30rpx 0;
|
|
|
-}
|
|
|
-.alert-no-data-text {
|
|
|
- font-size: 24rpx;
|
|
|
- color: #999;
|
|
|
-}
|
|
|
</style>
|