Ver código fonte

chore: auto bump version and changelog [skip ci]

iwt 3 meses atrás
pai
commit
94ed3529df

+ 39 - 5
cfc-frontend/pages/index/parent-index.vue

@@ -28,6 +28,18 @@
   :alerts="healthAlerts"
   @dismiss="onAlertDismiss" />
 
+<!-- ===== 家庭健康排行榜(P2-2) ===== -->
+<FamilyHealthRanking
+  v-if="rankingMembers && rankingMembers.length > 0"
+  :list="rankingMembers"
+  :totalScore="rankingTotalScore" />
+
+<!-- ===== 家庭挑战卡片(P2-2) ===== -->
+<FamilyChallengeCard
+  v-for="ch in activeChallenges"
+  :key="ch.id"
+  :challenge="ch" />
+
 <!-- ===== 家庭成员关系图谱 ===== -->
 <FamilyRelationGraph
   v-if="familyMembersVisible.length > 0"
@@ -383,7 +395,7 @@
 </template>
 
 <script>
-import { getFamilyMembers, getChildren, getPendingReviewTasks, getPendingWishes, approveTask, rejectTask, getChildCompletionStats, getParentDashboard, getFamilyEnergySandbox, getEnergyOverview, getVisibleFamilyMembers, getActivityList, getProductsByDomain, getContactList, getFeaturedArticles, getActiveAlerts, dismissAlert } from '../../utils/api.js'
+import { getFamilyMembers, getChildren, getPendingReviewTasks, getPendingWishes, approveTask, rejectTask, getChildCompletionStats, getParentDashboard, getFamilyEnergySandbox, getEnergyOverview, getVisibleFamilyMembers, getActivityList, getProductsByDomain, getContactList, getFeaturedArticles, getActiveAlerts, dismissAlert, getFamilyRanking, getChallengeList } from '../../utils/api.js'
 import PageBanner from '../../components/PageBanner.vue'
 import PlayfulCard from '../../components/PlayfulCard.vue'
 import PlayfulButton from '../../components/PlayfulButton.vue'
@@ -393,6 +405,8 @@ import BaseLoading from '../../components/BaseLoading.vue'
 import FamilyRelationGraph from '../../components/FamilyRelationGraph.vue'
 import WuxingSandbox from '../../components/wuxing-sandbox.vue'
 import ContactCard from '../../components/ContactCard.vue'
+import FamilyHealthRanking from '../../components/FamilyHealthRanking.vue'
+import FamilyChallengeCard from '../../components/FamilyChallengeCard.vue'
 import ContactImport from '../../components/ContactImport.vue'
 import RecommendedFeed from '../../components/RecommendedFeed.vue'
 import FamilyMemberStrip from '../../components/FamilyMemberStrip.vue'
@@ -404,7 +418,7 @@ import HealthAlertBanner from '../../components/HealthAlertBanner.vue'
 import feedbackEngine from '../../utils/feedback-engine.js'
 
 export default {
-  components: { PageBanner, RecommendedFeed, PlayfulCard, PlayfulButton, BaseBadge, BaseEmpty, BaseLoading, FamilyRelationGraph, WuxingSandbox, ContactCard, ContactImport, FamilyMemberStrip, MicroActionCard, FeedbackToast, MilestoneCelebration, DailySummary, HealthAlertBanner },
+  components: { PageBanner, RecommendedFeed, PlayfulCard, PlayfulButton, BaseBadge, BaseEmpty, BaseLoading, FamilyRelationGraph, WuxingSandbox, ContactCard, ContactImport, FamilyMemberStrip, MicroActionCard, FeedbackToast, MilestoneCelebration, DailySummary, HealthAlertBanner, FamilyHealthRanking, FamilyChallengeCard },
   data() {
     return {
       nickname: '',
@@ -465,7 +479,11 @@ export default {
       celebrationSubtitle: '',
       celebrationParticles: [],
       // P1-2 健康预警
-      healthAlerts: []
+      healthAlerts: [],
+      // P2-2 家庭互动
+      rankingMembers: [],
+      rankingTotalScore: 0,
+      activeChallenges: []
     }
   },
   computed: {
@@ -730,6 +748,8 @@ export default {
         this.loadFamilyMembersVisible()
         // 加载健康预警(P1-2)
         this.loadAlerts()
+        // 加载家庭健康互动(P2-2)
+        this.loadFamilyInteraction()
         // 加载外部联系人
         this.loadContacts()
         // 加载推荐阅读
@@ -821,9 +841,7 @@ export default {
         if (res.code === 200) {
           self.healthAlerts = res.data || []
         }
-      }).catch(function() {})
     },
-    onAlertDismiss: function(alertId) {
       var self = this
       dismissAlert({ id: alertId }).then(function(res) {
         if (res.code === 200) {
@@ -831,6 +849,22 @@ export default {
         }
       }).catch(function() {})
     },
+    loadFamilyInteraction: function() {
+      var familyId = this._familyId
+      if (!familyId) return
+      var self = this
+      getFamilyRanking({ familyId: familyId }).then(function(res) {
+        if (res.code === 200 && res.data) {
+          self.rankingMembers = res.data.members || []
+          self.rankingTotalScore = res.data.totalScore || 0
+        }
+      })
+      getChallengeList({ familyId: familyId }).then(function(res) {
+        if (res.code === 200 && Array.isArray(res.data)) {
+          self.activeChallenges = res.data
+        }
+      })
+    },
     goMemberDetail(member) {
       if (!member || !member.memberId) return
       uni.navigateTo({

+ 7 - 0
cfc-frontend/utils/api.js

@@ -1477,6 +1477,13 @@ export const getHealthScoreInfo = (data) => request('/api/health/score/info', 'P
 export const getHealthStreak = (data) => request('/api/health/score/streak', 'POST', data)
 export const getHealthTimeline = (data) => request('/api/health/timeline/list', 'POST', data)
 
+// ===== 家庭健康互动(P2-2 排行榜/点赞/挑战) =====
+export const getFamilyRanking = (data) => request('/api/health/family/ranking', 'POST', data)
+export const getChallengeList = (data) => request('/api/health/challenge/list', 'POST', data)
+export const getChallengeHistory = (data) => request('/api/health/challenge/history', 'POST', data)
+export const updateChallengeProgress = (data) => request('/api/health/challenge/progress', 'POST', data)
+export const sendLike = (data) => request('/api/health/interact/like', 'POST', data)
+
 // ===== 娲诲姩妯″潡锛堢淮搴︾瓫閫夛級 =====
 export const getActivityList = (data) => request('/api/activity/list', 'POST', data)
 export const getActivityDetail = (id) => request('/api/activity/detail', 'POST', { id })

+ 1 - 1
cfc-web/.last_build_commit

@@ -1 +1 @@
-3443be507e42a6a2cba8c2295c391e1304b83d0f
+7c870209dc630239e05c9612aaadd6cecf5aab88