|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
<template>
|
|
|
<view class="container">
|
|
<view class="container">
|
|
|
- <view v-if="!isLoggedIn">
|
|
|
|
|
|
|
+ <block v-if="!isLoggedIn">
|
|
|
<PageBanner theme="body" tagline="科学管理全家健康" quote="身体健康是幸福的基础" />
|
|
<PageBanner theme="body" tagline="科学管理全家健康" quote="身体健康是幸福的基础" />
|
|
|
<!-- 品牌定位语 -->
|
|
<!-- 品牌定位语 -->
|
|
|
<view class="brand-strap"><text class="brand-strap-text">科学管理全家健康数据</text></view>
|
|
<view class="brand-strap"><text class="brand-strap-text">科学管理全家健康数据</text></view>
|
|
@@ -67,7 +67,6 @@
|
|
|
<text class="demo-chart-tag">示例</text>
|
|
<text class="demo-chart-tag">示例</text>
|
|
|
</view>
|
|
</view>
|
|
|
<RadarChart :dimensions="demoCogDims" :scores="demoCogScores" fillColor="#6366F1" childName="示例" width="560" height="460" />
|
|
<RadarChart :dimensions="demoCogDims" :scores="demoCogScores" fillColor="#6366F1" childName="示例" width="560" height="460" />
|
|
|
- </view>
|
|
|
|
|
<!-- 五维健康体系 -->
|
|
<!-- 五维健康体系 -->
|
|
|
<view class="wuxing-section">
|
|
<view class="wuxing-section">
|
|
|
<view class="wuxing-title">身·心·智·行·富 · 看得见的健康闭环</view>
|
|
<view class="wuxing-title">身·心·智·行·富 · 看得见的健康闭环</view>
|
|
@@ -165,8 +164,8 @@
|
|
|
'每日打卡追踪身体/情绪/认知趋势'
|
|
'每日打卡追踪身体/情绪/认知趋势'
|
|
|
]" />
|
|
]" />
|
|
|
</view>
|
|
</view>
|
|
|
- </view>
|
|
|
|
|
- <view v-else>
|
|
|
|
|
|
|
+ </block>
|
|
|
|
|
+ <block v-else>
|
|
|
<PageBanner theme="body" tagline="看见·主动健康闭环" quote="采集→看见→行动" />
|
|
<PageBanner theme="body" tagline="看见·主动健康闭环" quote="采集→看见→行动" />
|
|
|
|
|
|
|
|
<view class="tab-bar">
|
|
<view class="tab-bar">
|
|
@@ -258,7 +257,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<ArticleBookshelf :articles="healthArticles" :isLoggedIn="true" @articleClick="goArticleDetail" @moreArticles="goMoreArticles" />
|
|
<ArticleBookshelf :articles="healthArticles" :isLoggedIn="true" @articleClick="goArticleDetail" @moreArticles="goMoreArticles" />
|
|
|
- </view>
|
|
|
|
|
|
|
+ </block>
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -315,6 +314,7 @@ export default {
|
|
|
emiFamilyData: [],
|
|
emiFamilyData: [],
|
|
|
relationshipData: [],
|
|
relationshipData: [],
|
|
|
energySandbox: null,
|
|
energySandbox: null,
|
|
|
|
|
+ wealthDetail: null,
|
|
|
childrenList: [],
|
|
childrenList: [],
|
|
|
relationshipEmpty: false
|
|
relationshipEmpty: false
|
|
|
}
|
|
}
|
|
@@ -339,34 +339,14 @@ export default {
|
|
|
return [{ label:'亲子信任',key:'parentTrust'},{ label:'亲子亲密度',key:'parentIntimacy'},{ label:'沟通质量',key:'communication'},{ label:'关系健康度',key:'healthStatus'},{ label:'最近互动',key:'lastInteraction' }]
|
|
return [{ label:'亲子信任',key:'parentTrust'},{ label:'亲子亲密度',key:'parentIntimacy'},{ label:'沟通质量',key:'communication'},{ label:'关系健康度',key:'healthStatus'},{ label:'最近互动',key:'lastInteraction' }]
|
|
|
}
|
|
}
|
|
|
if (this.currentTab === 'wealth') {
|
|
if (this.currentTab === 'wealth') {
|
|
|
- return [{ label:'身能量',key:'body'},{ label:'心能量',key:'mind'},{ label:'智能量',key:'wisdom'},{ label:'行能量',key:'action'},{ label:'富能量',key:'wealth' }]
|
|
|
|
|
|
|
+ var isChild = !!uni.getStorageSync('currentChildId')
|
|
|
|
|
+ if (isChild) {
|
|
|
|
|
+ return [{ label:'学业成绩',key:'education'},{ label:'社交筹码',key:'social'},{ label:'规则博弈',key:'points' }]
|
|
|
|
|
+ }
|
|
|
|
|
+ return [{ label:'金钱/收入',key:'income'},{ label:'社会成就',key:'achievement'},{ label:'资源网络',key:'network' }]
|
|
|
}
|
|
}
|
|
|
return [{ label:'生长发育',key:'growth'},{ label:'睡眠质量',key:'sleep'},{ label:'视力健康',key:'vision'},{ label:'免疫力',key:'immunity'},{ label:'营养均衡',key:'nutrition'},{ label:'肠胃健康',key:'gut'},{ label:'运动活力',key:'exercise' }]
|
|
return [{ label:'生长发育',key:'growth'},{ label:'睡眠质量',key:'sleep'},{ label:'视力健康',key:'vision'},{ label:'免疫力',key:'immunity'},{ label:'营养均衡',key:'nutrition'},{ label:'肠胃健康',key:'gut'},{ label:'运动活力',key:'exercise' }]
|
|
|
},
|
|
},
|
|
|
- _cognitiveScore: function(key) {
|
|
|
|
|
- if (!this.cognitiveData) return 0
|
|
|
|
|
- var v = this.cognitiveData[key]
|
|
|
|
|
- return (typeof v === 'number' && v > 0) ? v : 0
|
|
|
|
|
- },
|
|
|
|
|
- _emiScore: function(key) {
|
|
|
|
|
- if (!this.emiData) return 0
|
|
|
|
|
- var v = this.emiData[key]
|
|
|
|
|
- return (typeof v === 'number' && v > 0) ? v : 0
|
|
|
|
|
- },
|
|
|
|
|
- _relScore: function(key) {
|
|
|
|
|
- if (!this.relationshipData || this.relationshipData.length === 0) return 0
|
|
|
|
|
- var total = 0, count = 0
|
|
|
|
|
- for (var i = 0; i < this.relationshipData.length; i++) {
|
|
|
|
|
- var item = this.relationshipData[i]
|
|
|
|
|
- if (item[key] != null) { total += Number(item[key]); count++ }
|
|
|
|
|
- }
|
|
|
|
|
- return count > 0 ? Math.round(total / count) : 0
|
|
|
|
|
- },
|
|
|
|
|
- _wealthScore: function(key) {
|
|
|
|
|
- if (!this.energySandbox) return 0
|
|
|
|
|
- var v = this.energySandbox[key]
|
|
|
|
|
- return (typeof v === 'number' && v > 0) ? v : 0
|
|
|
|
|
- },
|
|
|
|
|
currentScores: function() {
|
|
currentScores: function() {
|
|
|
if (this.chartIsEmpty) {
|
|
if (this.chartIsEmpty) {
|
|
|
var dims = this.currentDimensions, scores = []
|
|
var dims = this.currentDimensions, scores = []
|
|
@@ -408,13 +388,13 @@ export default {
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|
|
|
if (this.currentTab === 'wealth') {
|
|
if (this.currentTab === 'wealth') {
|
|
|
- return [
|
|
|
|
|
- this._wealthScore('bodyScore'),
|
|
|
|
|
- this._wealthScore('mindScore'),
|
|
|
|
|
- this._wealthScore('wisdomScore'),
|
|
|
|
|
- this._wealthScore('actionScore'),
|
|
|
|
|
- this._wealthScore('wealthScore')
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ var d = this.wealthDetail
|
|
|
|
|
+ if (!d) return [0, 0, 0]
|
|
|
|
|
+ var isChild = !!uni.getStorageSync('currentChildId')
|
|
|
|
|
+ if (isChild) {
|
|
|
|
|
+ return [d.wealthEducation || 0, d.wealthSocial || 0, d.wealthPoints || 0]
|
|
|
|
|
+ }
|
|
|
|
|
+ return [d.wealthIncome || 0, d.wealthAchievement || 0, d.wealthNetwork || 0]
|
|
|
}
|
|
}
|
|
|
// body: fallback to demo
|
|
// body: fallback to demo
|
|
|
if (this.reports.length > 0) {
|
|
if (this.reports.length > 0) {
|
|
@@ -454,8 +434,13 @@ export default {
|
|
|
if (this.currentTab === 'relationship' && this.relationshipData.length > 0) {
|
|
if (this.currentTab === 'relationship' && this.relationshipData.length > 0) {
|
|
|
return [this._relScore('trustScore'), this._relScore('intimacyScore'), this._relScore('communicationScore'), this._relScore('totalScore'), 0]
|
|
return [this._relScore('trustScore'), this._relScore('intimacyScore'), this._relScore('communicationScore'), this._relScore('totalScore'), 0]
|
|
|
}
|
|
}
|
|
|
- if (this.currentTab === 'wealth' && this.energySandbox) {
|
|
|
|
|
- return [this._wealthScore('bodyScore'), this._wealthScore('mindScore'), this._wealthScore('wisdomScore'), this._wealthScore('actionScore'), this._wealthScore('wealthScore')]
|
|
|
|
|
|
|
+ if (this.currentTab === 'wealth' && this.wealthDetail) {
|
|
|
|
|
+ var d = this.wealthDetail
|
|
|
|
|
+ var isChild = !!uni.getStorageSync('currentChildId')
|
|
|
|
|
+ if (isChild) {
|
|
|
|
|
+ return [d.wealthEducation || 0, d.wealthSocial || 0, d.wealthPoints || 0]
|
|
|
|
|
+ }
|
|
|
|
|
+ return [d.wealthIncome || 0, d.wealthAchievement || 0, d.wealthNetwork || 0]
|
|
|
}
|
|
}
|
|
|
return []
|
|
return []
|
|
|
},
|
|
},
|
|
@@ -464,7 +449,7 @@ export default {
|
|
|
if (this.currentTab === 'cognitive') return !this.cognitiveData || !this.cognitiveData.overallScore
|
|
if (this.currentTab === 'cognitive') return !this.cognitiveData || !this.cognitiveData.overallScore
|
|
|
if (this.currentTab === 'mental') return !this.emiData || !this.emiData.overallScore
|
|
if (this.currentTab === 'mental') return !this.emiData || !this.emiData.overallScore
|
|
|
if (this.currentTab === 'relationship') return !this.relationshipData || this.relationshipData.length === 0
|
|
if (this.currentTab === 'relationship') return !this.relationshipData || this.relationshipData.length === 0
|
|
|
- if (this.currentTab === 'wealth') return !this.energySandbox
|
|
|
|
|
|
|
+ if (this.currentTab === 'wealth') return !this.wealthDetail
|
|
|
var quiz = this.quizzes.filter(function(q) { return q.code === this.currentTab }.bind(this))[0]
|
|
var quiz = this.quizzes.filter(function(q) { return q.code === this.currentTab }.bind(this))[0]
|
|
|
return !(quiz && quiz.score)
|
|
return !(quiz && quiz.score)
|
|
|
}
|
|
}
|
|
@@ -482,6 +467,30 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ _cognitiveScore: function(key) {
|
|
|
|
|
+ if (!this.cognitiveData) return 0
|
|
|
|
|
+ var v = this.cognitiveData[key]
|
|
|
|
|
+ return (typeof v === 'number' && v > 0) ? v : 0
|
|
|
|
|
+ },
|
|
|
|
|
+ _emiScore: function(key) {
|
|
|
|
|
+ if (!this.emiData) return 0
|
|
|
|
|
+ var v = this.emiData[key]
|
|
|
|
|
+ return (typeof v === 'number' && v > 0) ? v : 0
|
|
|
|
|
+ },
|
|
|
|
|
+ _relScore: function(key) {
|
|
|
|
|
+ if (!this.relationshipData || this.relationshipData.length === 0) return 0
|
|
|
|
|
+ var total = 0, count = 0
|
|
|
|
|
+ for (var i = 0; i < this.relationshipData.length; i++) {
|
|
|
|
|
+ var item = this.relationshipData[i]
|
|
|
|
|
+ if (item[key] != null) { total += Number(item[key]); count++ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return count > 0 ? Math.round(total / count) : 0
|
|
|
|
|
+ },
|
|
|
|
|
+ _wealthScore: function(key) {
|
|
|
|
|
+ if (!this.energySandbox) return 0
|
|
|
|
|
+ var v = this.energySandbox[key]
|
|
|
|
|
+ return (typeof v === 'number' && v > 0) ? v : 0
|
|
|
|
|
+ },
|
|
|
switchTab: function(code) { this.currentTab = code },
|
|
switchTab: function(code) { this.currentTab = code },
|
|
|
goPage: function(url) { uni.navigateTo({ url: url }) },
|
|
goPage: function(url) { uni.navigateTo({ url: url }) },
|
|
|
goQuiz: function(code) {
|
|
goQuiz: function(code) {
|
|
@@ -562,14 +571,15 @@ export default {
|
|
|
self.relationshipEmpty = true
|
|
self.relationshipEmpty = true
|
|
|
}
|
|
}
|
|
|
}).catch(function() { self.relationshipEmpty = true })
|
|
}).catch(function() { self.relationshipEmpty = true })
|
|
|
- // 财富能量沙盘(家庭五维)
|
|
|
|
|
- api.getFamilyEnergySandbox().then(function(res) {
|
|
|
|
|
- if (res && res.data && !res.data.locked && res.data.familyData) {
|
|
|
|
|
- self.energySandbox = res.data.familyData
|
|
|
|
|
- } else if (res && res.data && !res.data.locked && res.data.personalData) {
|
|
|
|
|
- self.energySandbox = res.data.personalData
|
|
|
|
|
- }
|
|
|
|
|
- }).catch(function() {})
|
|
|
|
|
|
|
+ // 财富子维度(富维度三子维度)
|
|
|
|
|
+ if (memberId) {
|
|
|
|
|
+ var memberType = uni.getStorageSync('currentChildId') ? 'child' : 'parent'
|
|
|
|
|
+ api.getWealthDetail(memberId, memberType).then(function(res) {
|
|
|
|
|
+ if (res.code === 200 && res.data) {
|
|
|
|
|
+ self.wealthDetail = res.data
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(function() {})
|
|
|
|
|
+ }
|
|
|
} catch (e) { console.error('加载健康数据失败', e) }
|
|
} catch (e) { console.error('加载健康数据失败', e) }
|
|
|
},
|
|
},
|
|
|
loadPlanList: function() {
|
|
loadPlanList: function() {
|