parent-index.vue 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218
  1. <template>
  2. <view class="container">
  3. <!-- 加载状态 -->
  4. <BaseLoading :loading="loading" text="正在加载..." />
  5. <template v-if="!loading">
  6. <!-- ===== a) 顶部 Banner ===== -->
  7. <!-- ===== 新手任务进度条(onboarding 置顶引导) ===== -->
  8. <OnboardingProgressBar ref="onboardingProgress" />
  9. <!-- ===== 家庭成员选择条 ===== -->
  10. <FamilyMemberStrip
  11. v-if="isLoggedIn"
  12. :members="familyMembersVisible"
  13. :selectedMemberId="selectedMemberId"
  14. :isParent="isFamilyAdmin"
  15. @select="onFamilyMemberSelect"
  16. @switch="onFamilyMemberSwitch"
  17. @removed="loadFamilyMembersVisible" />
  18. <!-- ===== 无家庭成员空状态引导卡 ===== -->
  19. <view class="empty-family-card" v-if="isLoggedIn && familyMembersVisible.length === 0">
  20. <view class="empty-family-icon">🏠</view>
  21. <text class="empty-family-title">创建我的家庭</text>
  22. <text class="empty-family-desc">添加家庭成员,开启五维能量之旅</text>
  23. <button class="empty-family-btn" @click="goAddMember">立即添加</button>
  24. </view>
  25. <!-- ===== 微行动卡片(P0:有效启动) ===== -->
  26. <MicroActionCard
  27. v-if="selectedMemberId && selectedChild && selectedChild.id"
  28. :memberId="selectedChild.id"
  29. @completed="onMicroActionCompleted" />
  30. <!-- ===== 健康预警横幅(P1-2) ===== -->
  31. <HealthAlertBanner
  32. v-if="selectedMemberId && selectedChild && selectedChild.id"
  33. :alerts="healthAlerts"
  34. @dismiss="onAlertDismiss" />
  35. <!-- ===== 家庭健康排行榜(P2-2) ===== -->
  36. <FamilyHealthRanking
  37. v-if="rankingMembers && rankingMembers.length > 0"
  38. :list="rankingMembers"
  39. :totalScore="rankingTotalScore" />
  40. <!-- ===== 家庭挑战区域 ===== -->
  41. <view class="challenge-section">
  42. <view class="challenge-section-header" @click="goToChallengeManage">
  43. <text class="challenge-section-title">家庭挑战</text>
  44. <text class="challenge-section-action">管理 →</text>
  45. </view>
  46. <FamilyChallengeCard
  47. v-for="ch in activeChallenges"
  48. :key="ch.id"
  49. :challenge="ch" />
  50. </view>
  51. <!-- ===== 健康圈入口(P3:社区扩散) ===== -->
  52. <view class="circle-entry-section">
  53. <!-- 有健康圈数据:显示排行榜预览 -->
  54. <PlayfulCard v-if="circleName && circleRankings.length > 0" variant="flat" shadow="sm" :clickable="true" @click="goToHealthCircle" class="circle-card-wide">
  55. <view class="circle-card-content">
  56. <view class="circle-header">
  57. <view class="circle-icon-wrap">
  58. <text class="circle-icon">🏅</text>
  59. </view>
  60. <view class="circle-header-body">
  61. <text class="circle-card-title">健康圈</text>
  62. <text class="circle-card-subtitle">{{ circleName }}</text>
  63. </view>
  64. </view>
  65. <view class="circle-ranking-preview">
  66. <view class="circle-rank-row" v-for="(item, idx) in circleRankings.slice(0, 3)" :key="idx">
  67. <text class="circle-rank-badge">{{ rankIcon(idx) }}</text>
  68. <text class="circle-rank-family">家庭 {{ idx + 1 }}</text>
  69. <text class="circle-rank-score">{{ item.totalScore || 0 }} 分</text>
  70. </view>
  71. </view>
  72. <view class="circle-action">
  73. <text class="circle-action-text">查看详情 →</text>
  74. </view>
  75. </view>
  76. </PlayfulCard>
  77. <!-- 无健康圈数据:邀请加入 -->
  78. <PlayfulCard v-else variant="flat" shadow="sm" :clickable="true" @click="goToHealthCircle" class="circle-card-wide circle-card-invite">
  79. <view class="circle-invite-content">
  80. <view class="circle-invite-icon">🏅</view>
  81. <text class="circle-invite-title">健康圈</text>
  82. <text class="circle-invite-desc">加入健康圈,和更多家庭一起健康打卡</text>
  83. <text class="circle-invite-cta">去看看 →</text>
  84. </view>
  85. </PlayfulCard>
  86. </view>
  87. <!-- ===== 五维家庭自检入口(P0-1/P0-2) ===== -->
  88. <view class="selfcheck-entry-section">
  89. <PlayfulCard variant="flat" shadow="sm" :clickable="true" @click="goToSelfCheck" class="selfcheck-card-wide">
  90. <view class="selfcheck-card-content">
  91. <view class="selfcheck-icon-wrap">
  92. <view class="selfcheck-icon-circle" style="background: #FF8C42;">
  93. <text class="selfcheck-icon-char">身</text>
  94. </view>
  95. <view class="selfcheck-icon-circle" style="background: #6366F1;">
  96. <text class="selfcheck-icon-char">智</text>
  97. </view>
  98. <view class="selfcheck-icon-circle" style="background: #F59E0B;">
  99. <text class="selfcheck-icon-char">富</text>
  100. </view>
  101. <view class="selfcheck-icon-circle" style="background: #10B981;">
  102. <text class="selfcheck-icon-char">行</text>
  103. </view>
  104. <view class="selfcheck-icon-circle" style="background: #FF6B9D;">
  105. <text class="selfcheck-icon-char">心</text>
  106. </view>
  107. </view>
  108. <view class="selfcheck-body">
  109. <text class="selfcheck-title">五维家庭自检</text>
  110. <text class="selfcheck-subtitle" v-if="selfCheckScore != null">
  111. 最近得分 {{ selfCheckScore }}/45 分
  112. </text>
  113. <text class="selfcheck-subtitle" v-else>
  114. 15题 · 5分钟 · 生成五行相生寻源建议
  115. </text>
  116. </view>
  117. <text class="selfcheck-arrow">→</text>
  118. </view>
  119. </PlayfulCard>
  120. </view>
  121. <!-- ===== 家庭成员关系图谱 ===== -->
  122. <FamilyRelationGraph
  123. v-if="familyMembersVisible.length > 0"
  124. dimensionCode="home"
  125. :selfId="selfMemberId"
  126. :members="familyMembersVisible"
  127. :energyMap="energyMapForGraph"
  128. :intimacyMap="intimacyMapForGraph"
  129. @memberTap="goMemberDetail" />
  130. <!-- 通关引导进度条 -->
  131. <GateGuideBar :unlockStatus="unlockStatus" />
  132. <!-- 能量沙盘 -->
  133. <GateLock v-if="sandboxLocked && sandboxLockGate" :gate="sandboxLockGate" />
  134. <WuxingSandbox
  135. v-else-if="sandboxData"
  136. mode="live"
  137. :scores="familySandboxScores"
  138. :overallScore="familySandboxOverall"
  139. :members="familySandboxMembers"
  140. :personalData="sandboxPersonalData"
  141. :dimensions="energyDimensions"
  142. :totalEnergy="totalEnergy"
  143. :totalHealthIndex="totalHealthIndex"
  144. :familyUnlocked="familyUnlocked"
  145. :currentView="currentSandboxView"
  146. starHeight="400rpx"
  147. showDimensionBar
  148. @view-change="onSandboxViewChange"
  149. @point-click="onDomainClick" />
  150. <!-- 能量数据加载失败兜底 -->
  151. <view class="error-state" v-if="errorEnergy && !sandboxData && !sandboxLocked" @click="loadData">
  152. <text class="error-state-text">家庭能量数据加载失败,点击重试</text>
  153. </view>
  154. <!-- ===== c) 成长数据 ===== -->
  155. <view class="stats-section animate-fade-in animate-stagger-5">
  156. <view class="section-title">成长数据</view>
  157. <view class="stats-row">
  158. <!-- 任务完成率:自己的 + 全家平均 -->
  159. <PlayfulCard variant="flat" shadow="sm" :clickable="true" @click="goToCompletionStats" class="stat-card-wide" padding="0">
  160. <view class="stat-card-content">
  161. <view class="stat-header">
  162. <view class="stat-icon-wrap stat-icon-orange">
  163. <text class="stat-icon-symbol">📋</text>
  164. </view>
  165. <view class="stat-body">
  166. <text class="stat-label-header">任务完成</text>
  167. </view>
  168. </view>
  169. <view class="stat-compare">
  170. <view class="stat-compare-row">
  171. <text class="compare-label">自己的</text>
  172. <text class="compare-value accent-color">{{ myCompletionRate }}%</text>
  173. </view>
  174. <view class="progress-bar-sm">
  175. <view class="progress-fill-sm" :style="{ width: myCompletionRate + '%' }"></view>
  176. </view>
  177. <view class="stat-compare-row">
  178. <text class="compare-label">全家平均</text>
  179. <text class="compare-value">{{ familyAvgCompletionRate }}%</text>
  180. </view>
  181. <view class="progress-bar-sm">
  182. <view class="progress-fill-sm muted" :style="{ width: familyAvgCompletionRate + '%' }"></view>
  183. </view>
  184. </view>
  185. <text class="stat-more">查看分析 ›</text>
  186. </view>
  187. </PlayfulCard>
  188. <!-- 成长积分:自己的 + 全家共 -->
  189. <PlayfulCard variant="flat" shadow="sm" :clickable="true" @click="goToRewards" class="stat-card-wide" padding="0">
  190. <view class="stat-card-content">
  191. <view class="stat-header">
  192. <view class="stat-icon-wrap stat-icon-gold">
  193. <text class="stat-icon-symbol">⭐</text>
  194. </view>
  195. <view class="stat-body">
  196. <text class="stat-label-header">成长积分</text>
  197. </view>
  198. </view>
  199. <view class="stat-compare">
  200. <view class="stat-compare-row">
  201. <text class="compare-label">自己的</text>
  202. <text class="compare-value gold-color">{{ myPoints }}</text>
  203. </view>
  204. <view class="stat-compare-row">
  205. <text class="compare-label">全家共</text>
  206. <text class="compare-value">{{ familyTotalPoints }}</text>
  207. </view>
  208. </view>
  209. <text class="stat-encourage" v-if="myPoints > 0">太棒了!</text>
  210. <text class="stat-encourage muted" v-else>开始赚星星吧</text>
  211. </view>
  212. </PlayfulCard>
  213. </view>
  214. </view>
  215. <!-- ===== d) 今日重点 ===== -->
  216. <view class="today-section animate-fade-in animate-stagger-7">
  217. <view class="section-title">📋 今日任务</view>
  218. <PlayfulCard variant="flat" class="today-card">
  219. <template slot="header">
  220. <view class="today-header">
  221. <text class="today-label">今日待完成</text>
  222. <text class="today-count">{{ pendingTasks.length }}项任务</text>
  223. </view>
  224. </template>
  225. <view class="task-list" v-if="pendingTasks.length > 0">
  226. <view class="task-item" v-for="task in pendingTasks.slice(0, 3)" :key="task.id">
  227. <view class="task-dot" :class="'dot-color-' + (task.id % 5)"></view>
  228. <text class="task-title">{{ task.title }}</text>
  229. </view>
  230. </view>
  231. <BaseEmpty v-else icon="🎉" title="今日任务已完成" description="太棒了!" :compact="true" />
  232. <view slot="actions" class="task-view-all" @click="goToTaskList">
  233. <text>查看全部</text>
  234. <text class="arrow">→</text>
  235. </view>
  236. </PlayfulCard>
  237. </view>
  238. <!-- ===== e) 成长里程碑 ===== -->
  239. <view class="milestone-section animate-fade-in animate-stagger-8">
  240. <view class="section-title">成长里程碑</view>
  241. <PlayfulCard variant="flat" class="milestone-card">
  242. <view class="milestone-item" v-if="selectedChild && selectedChild.streakDays >= 7">
  243. <view class="milestone-icon-wrap milestone-star">
  244. <text class="milestone-icon">🌟</text>
  245. </view>
  246. <text class="milestone-text">连续7天打卡</text>
  247. </view>
  248. <view class="milestone-item" v-if="selectedChild && selectedChild.streakDays >= 30">
  249. <view class="milestone-icon-wrap milestone-trophy">
  250. <text class="milestone-icon">🏆</text>
  251. </view>
  252. <text class="milestone-text">坚持一个月啦!</text>
  253. </view>
  254. <view class="milestone-item" v-if="(selectedChild && selectedChild.totalPoints) >= 1000">
  255. <view class="milestone-icon-wrap milestone-sparkle">
  256. <text class="milestone-icon">💫</text>
  257. </view>
  258. <text class="milestone-text">积分突破1000</text>
  259. </view>
  260. <BaseEmpty v-if="!hasMilestones" icon="🌱" title="开始养成好习惯" description="见证成长" :compact="true" />
  261. </PlayfulCard>
  262. </view>
  263. <!-- ===== f) 待处理事项 ===== -->
  264. <view class="pending-section animate-fade-in animate-stagger-9">
  265. <view class="section-title">📋 待处理事项</view>
  266. <view class="pending-grid">
  267. <view class="pending-card" @click="goToReview">
  268. <view class="pending-icon pending-icon--blue">
  269. <text class="pending-emoji">📝</text>
  270. </view>
  271. <view class="pending-info">
  272. <text class="pending-count accent-color">{{ pendingReviewTasks.length }}</text>
  273. <text class="pending-label">待审核任务</text>
  274. </view>
  275. </view>
  276. <view class="pending-card" @click="goToWishApprove">
  277. <view class="pending-icon pending-icon--pink">
  278. <text class="pending-emoji">💝</text>
  279. </view>
  280. <view class="pending-info">
  281. <text class="pending-count pink-color">{{ pendingReviewWishes.length }}</text>
  282. <text class="pending-label">待审批心愿</text>
  283. </view>
  284. </view>
  285. <view class="pending-card" @click="goToAssessmentReport">
  286. <view class="pending-icon pending-icon--green">
  287. <text class="pending-emoji">📊</text>
  288. </view>
  289. <view class="pending-info">
  290. <text class="pending-count teal-color">{{ hasNewReport ? '有新' : '暂无' }}</text>
  291. <text class="pending-label">最新测评报告</text>
  292. </view>
  293. </view>
  294. <view class="pending-card" @click="goToActivities">
  295. <view class="pending-icon pending-icon--orange">
  296. <text class="pending-emoji">🎉</text>
  297. </view>
  298. <view class="pending-info">
  299. <text class="pending-count orange-color">{{ hotActivityCount > 0 ? hotActivityCount : '暂无' }}</text>
  300. <text class="pending-label">活动推荐</text>
  301. </view>
  302. </view>
  303. </view>
  304. </view>
  305. <!-- ===== 重要关系(外部通讯录) ===== -->
  306. <view class="contact-section" v-if="!loading && familyMembersVisible.length > 0">
  307. <view class="contact-header">
  308. <text class="contact-section-title">重要关系</text>
  309. <view class="contact-header-right">
  310. <text class="contact-more" @click="loadContacts">刷新</text>
  311. <text class="contact-import-btn" @click="onShowImport">+ 导入</text>
  312. </view>
  313. </view>
  314. <scroll-view class="contact-scroll" scroll-x enable-flex>
  315. <view class="contact-scroll-inner">
  316. <view class="contact-card-wrap" v-for="item in contactList" :key="item.id" @click="onContactClick(item)">
  317. <ContactCard :contact="item" />
  318. </view>
  319. <view class="contact-card-wrap contact-add-card" @click="onShowImport">
  320. <view class="add-card-inner">
  321. <text class="add-card-icon">+</text>
  322. <text class="add-card-label">导入通讯录</text>
  323. </view>
  324. </view>
  325. </view>
  326. </scroll-view>
  327. <view class="contact-empty" v-if="contactList.length === 0">
  328. <text class="contact-empty-text">暂无重要联系人,点击导入添加</text>
  329. </view>
  330. </view>
  331. <!-- 导入联系人弹窗 -->
  332. <ContactImport
  333. :visible="showImportModal"
  334. @close="onCloseImport"
  335. @success="onImportSuccess" />
  336. <!-- 邀请码二维码弹窗 -->
  337. <view class="qr-code-modal" v-if="showQrCodeModal" @touchmove.stop.prevent @click="onCloseQrCodeModal">
  338. <view class="qr-code-modal-content" @click.stop>
  339. <view class="qr-code-modal-header">
  340. <text class="qr-code-modal-title">邀请二维码</text>
  341. <text class="qr-code-modal-close" @click="onCloseQrCodeModal">×</text>
  342. </view>
  343. <view class="qr-code-modal-body">
  344. <view class="qr-code-image-container">
  345. <image :src="(qrCodeData && qrCodeData.qrCodeBase64) || ''" class="qr-code-image" mode="aspectFit" />
  346. </view>
  347. <view class="qr-code-referral-code">
  348. <text class="qr-code-label">邀请码:</text>
  349. <text class="qr-code-code">{{ (qrCodeData && qrCodeData.referralCode) || '' }}</text>
  350. <text class="qr-code-copy" @click="onCopyReferralCode">复制</text>
  351. </view>
  352. </view>
  353. </view>
  354. </view>
  355. <!-- ===== 推荐商品+活动(混合信息流) ===== -->
  356. <RecommendedFeed
  357. :products="recommendedProducts"
  358. :activities="recommendedActivities"
  359. :loading="loadingProducts || loadingActivities"
  360. @itemClick="onFeedItemClick"
  361. @more="goMoreDiscover" />
  362. <view class="error-state" v-if="errorProducts || errorActivities">
  363. <text class="error-state-text">推荐加载失败</text>
  364. </view>
  365. <!-- ===== 推荐阅读(书册风格) ===== -->
  366. <ArticleBookshelf
  367. :articles="indexArticles"
  368. :loading="articlesLoading"
  369. :isLoggedIn="isLoggedIn"
  370. @articleClick="goArticleDetail"
  371. @moreArticles="goArticles"
  372. />
  373. <!-- ===== h) 待审核任务 ===== -->
  374. <view class="review-section animate-fade-in animate-stagger-11" v-if="pendingReviewTasks.length > 0">
  375. <view class="section-title">待审核任务</view>
  376. <PlayfulCard
  377. variant="flat"
  378. shadow="sm"
  379. class="review-card"
  380. v-for="task in pendingReviewTasks"
  381. :key="task.id"
  382. padding="0"
  383. >
  384. <view class="review-card-content">
  385. <view class="review-info">
  386. <text class="task-name">{{ task.title }}</text>
  387. <text class="task-child" v-if="task.childName">提供者: {{ task.childName }}</text>
  388. </view>
  389. <view class="review-actions">
  390. <PlayfulButton variant="success" size="xs" @click="approveTask(task.id)">通过</PlayfulButton>
  391. <PlayfulButton variant="error" size="xs" @click="rejectTask(task.id)">拒绝</PlayfulButton>
  392. </view>
  393. </view>
  394. </PlayfulCard>
  395. </view>
  396. <!-- ===== g) 快捷操作 ===== -->
  397. <view class="quick-section animate-fade-in animate-stagger-10">
  398. <view class="section-title">快捷操作</view>
  399. <PlayfulCard variant="flat" class="quick-card">
  400. <view class="quick-actions">
  401. <view class="action-item" @click="addTask">
  402. <view class="action-icon act-add">
  403. <text class="action-icon-text">➕</text>
  404. </view>
  405. <text class="action-label">添加任务</text>
  406. </view>
  407. <view class="action-item" @click="goToReview">
  408. <view class="action-icon act-review">
  409. <text class="action-icon-text">📋</text>
  410. </view>
  411. <text class="action-label">审核任务</text>
  412. </view>
  413. <view class="action-item" @click="manageChildren">
  414. <view class="action-icon act-child">
  415. <text class="action-icon-text">👨‍👩‍👧</text>
  416. </view>
  417. <text class="action-label">成员管理</text>
  418. </view>
  419. <view class="action-item" @click="goToRewards">
  420. <view class="action-icon act-reward">
  421. <text class="action-icon-text">🎁</text>
  422. </view>
  423. <text class="action-label">奖励中心</text>
  424. </view>
  425. <!-- Added: QR Code button -->
  426. <view class="action-item" @click="onShowQrCodeModal">
  427. <view class="action-icon act-invite">
  428. <text class="action-icon-text">📱</text>
  429. </view>
  430. <text class="action-label">邀请码</text>
  431. </view>
  432. </view>
  433. </PlayfulCard>
  434. </view>
  435. </template>
  436. <!-- ===== L1 即时反馈:Toast + 庆祝 ===== -->
  437. <FeedbackToast
  438. :visible="toastVisible"
  439. :text="toastText"
  440. :icon="toastIcon"
  441. :animating="toastAnimating" />
  442. <MilestoneCelebration
  443. :visible="celebrationVisible"
  444. :title="celebrationTitle"
  445. :subtitle="celebrationSubtitle"
  446. :particles="celebrationParticles"
  447. @dismiss="celebrationVisible = false" />
  448. <!-- ===== L2 深度反馈:每日健康小语 ===== -->
  449. <DailySummary
  450. v-if="selectedMemberId && selectedChild && selectedChild.id"
  451. :memberId="selectedChild.id"
  452. @dismiss="onDailySummaryDismiss" />
  453. </view>
  454. </template>
  455. <script>
  456. import { getFamilyMemberList, getChildren, getPendingReviewTasks, getPendingWishes, approveTask, rejectTask, getChildCompletionStats, getParentDashboard, getFamilyEnergySandbox, getEnergySandbox, getUnlockStatus, getEnergyOverview, getActivityList, getProductsByDomain, getContactList, getFeaturedArticles, getActiveAlerts, dismissAlert, getFamilyRanking, getChallengeList, getCircleRanking, getInviteQrCode, switchToFamilyMember, getSelfCheckStatus } from '../../utils/api.js'
  457. import store from '../../store/index.js'
  458. import PlayfulCard from '../../components/PlayfulCard.vue'
  459. import PlayfulButton from '../../components/PlayfulButton.vue'
  460. import BaseBadge from '../../components/BaseBadge.vue'
  461. import BaseEmpty from '../../components/BaseEmpty.vue'
  462. import BaseLoading from '../../components/BaseLoading.vue'
  463. import FamilyRelationGraph from '../../components/FamilyRelationGraph.vue'
  464. import WuxingSandbox from '../../components/wuxing-sandbox.vue'
  465. import ContactCard from '../../components/ContactCard.vue'
  466. import FamilyHealthRanking from '../../components/FamilyHealthRanking.vue'
  467. import FamilyChallengeCard from '../../components/FamilyChallengeCard.vue'
  468. import ContactImport from '../../components/ContactImport.vue'
  469. import RecommendedFeed from '../../components/RecommendedFeed.vue'
  470. import FamilyMemberStrip from '../../components/FamilyMemberStrip.vue'
  471. import MicroActionCard from '../../components/MicroActionCard.vue'
  472. import FeedbackToast from '../../components/FeedbackToast.vue'
  473. import MilestoneCelebration from '../../components/MilestoneCelebration.vue'
  474. import DailySummary from '../../components/DailySummary.vue'
  475. import HealthAlertBanner from '../../components/HealthAlertBanner.vue'
  476. import CircleRanking from '../../components/CircleRanking.vue'
  477. import ArticleBookshelf from '../../components/ArticleBookshelf.vue'
  478. import OnboardingProgressBar from '../../components/OnboardingProgressBar.vue'
  479. import GateLock from '../../components/gate-lock.vue'
  480. import GateGuideBar from '../../components/gate-guide-bar.vue'
  481. import feedbackEngine from '../../utils/feedback-engine.js'
  482. export default {
  483. components: { RecommendedFeed, PlayfulCard, PlayfulButton, BaseBadge, BaseEmpty, BaseLoading, FamilyRelationGraph, WuxingSandbox, ContactCard, ContactImport, FamilyMemberStrip, MicroActionCard, FeedbackToast, MilestoneCelebration, DailySummary, HealthAlertBanner, FamilyHealthRanking, FamilyChallengeCard, CircleRanking, ArticleBookshelf, OnboardingProgressBar, GateLock, GateGuideBar },
  484. data() {
  485. return {
  486. nickname: '',
  487. familyMembers: [],
  488. children: [],
  489. selectedChild: null,
  490. pendingReviewTasks: [],
  491. pendingReviewWishes: [],
  492. pendingWishesCount: 0,
  493. pendingTasks: [],
  494. hotActivityCount: 0,
  495. hasNewReport: false,
  496. myCompletionRate: 0,
  497. familyAvgCompletionRate: 0,
  498. myPoints: 0,
  499. familyTotalPoints: 0,
  500. // membershipText removed (no real function)
  501. loading: true,
  502. currentChildId: '',
  503. _initialLoadDone: false,
  504. _familyId: null,
  505. familyMembersVisible: [],
  506. selfMemberId: null,
  507. energyData: null,
  508. energyDimensions: [],
  509. totalEnergy: 0,
  510. totalHealthIndex: 0,
  511. recommendedActivities: [],
  512. recommendedProducts: [],
  513. sandboxData: null,
  514. sandboxPersonalData: null,
  515. sandboxFamilyData: null,
  516. errorEnergy: false,
  517. // 通关解锁状态
  518. sandboxLocked: false,
  519. sandboxLockGate: null,
  520. currentSandboxView: 'personal',
  521. familyUnlocked: false,
  522. familyLockGate: null,
  523. unlockStatus: null,
  524. errorTasks: false,
  525. errorActivities: false,
  526. errorProducts: false,
  527. loadingActivities: false,
  528. loadingProducts: false,
  529. contactList: [],
  530. showImportModal: false,
  531. // QR Code modal
  532. showQrCodeModal: false,
  533. qrCodeData: null,
  534. // 推荐阅读
  535. indexArticles: [],
  536. articlesLoading: false,
  537. isLoggedIn: false,
  538. gradientColors: [
  539. 'linear-gradient(135deg, #10B981, #34D399)',
  540. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  541. 'linear-gradient(135deg, #8B5CF6, #C084FC)',
  542. 'linear-gradient(135deg, #F97316, #FB923C)',
  543. 'linear-gradient(135deg, #6366F1, #818CF8)'
  544. ],
  545. selectedMemberId: null,
  546. // L1 即时反馈状态
  547. toastVisible: false,
  548. toastText: '',
  549. toastIcon: '✅',
  550. toastAnimating: false,
  551. celebrationVisible: false,
  552. celebrationTitle: '',
  553. celebrationSubtitle: '',
  554. celebrationParticles: [],
  555. // P1-2 健康预警
  556. healthAlerts: [],
  557. // P2-2 家庭互动
  558. rankingMembers: [],
  559. rankingTotalScore: 0,
  560. activeChallenges: [],
  561. // P3 健康圈(社区扩散)
  562. circleRankings: [],
  563. circleName: '',
  564. circleLoading: false,
  565. selfCheckScore: null
  566. }
  567. },
  568. computed: {
  569. isFamilyAdmin() {
  570. if (!this.familyMembersVisible || this.familyMembersVisible.length === 0) return false
  571. return this.familyMembersVisible[0].isAdmin === true
  572. },
  573. topPendingTasks() {
  574. return this.pendingTasks.slice(0, 3)
  575. },
  576. energyScores() {
  577. var d = this.energyData
  578. if (!d) return { body: 0, mind: 0, wisdom: 0, action: 0, wealth: 0 }
  579. return { body: d.bodyScore, mind: d.mindScore, wisdom: d.wisdomScore, action: d.actionScore, wealth: d.wealthScore }
  580. },
  581. energyOverall() {
  582. return this.energyData ? this.energyData.overallScore : 0
  583. },
  584. energyMembers() {
  585. return this.energyData ? this.energyData.members : []
  586. },
  587. sandboxScores() {
  588. if (!this.sandboxData) return { body: 0, mind: 0, wisdom: 0, action: 0, wealth: 0 }
  589. return {
  590. body: this.sandboxData.bodyScore || 0,
  591. mind: this.sandboxData.mindScore || 0,
  592. wisdom: this.sandboxData.wisdomScore || 0,
  593. action: this.sandboxData.actionScore || 0,
  594. wealth: this.sandboxData.wealthScore || 0
  595. }
  596. },
  597. familySandboxScores() {
  598. var d = this.sandboxFamilyData || {}
  599. return {
  600. body: d.bodyScore || 0,
  601. mind: d.mindScore || 0,
  602. wisdom: d.wisdomScore || 0,
  603. action: d.actionScore || 0,
  604. wealth: d.wealthScore || 0
  605. }
  606. },
  607. familySandboxOverall() {
  608. return this.sandboxFamilyData ? (this.sandboxFamilyData.overallScore || 0) : 0
  609. },
  610. familySandboxMembers() {
  611. return this.sandboxFamilyData ? (this.sandboxFamilyData.members || []) : []
  612. },
  613. greetingText() {
  614. const hour = new Date().getHours()
  615. if (hour < 6) return '夜深了'
  616. if (hour < 9) return '早上好'
  617. if (hour < 12) return '上午好'
  618. if (hour < 14) return '中午好'
  619. if (hour < 18) return '下午好'
  620. if (hour < 22) return '晚上好'
  621. return '夜深了'
  622. },
  623. hasMilestones() {
  624. const c = this.selectedChild
  625. if (!c) return false
  626. return (c.streakDays >= 7) || (c.streakDays >= 30) || (c.totalPoints >= 1000)
  627. },
  628. energyMapForGraph() {
  629. var map = {}
  630. if (this.sandboxData && this.sandboxData.members) {
  631. for (var i = 0; i < this.sandboxData.members.length; i++) {
  632. var m = this.sandboxData.members[i]
  633. map[m.memberId || m.id] = {
  634. bodyScore: m.bodyScore || 0,
  635. mindScore: m.mindScore || 0,
  636. actionScore: m.actionScore || 0
  637. }
  638. }
  639. }
  640. return map
  641. },
  642. intimacyMapForGraph() {
  643. return {}
  644. }
  645. },
  646. // 使用 mounted 而非 onLoad,因为本组件作为条件渲染子组件(v-if),
  647. // page 生命周期钩子(onLoad/onShow)可能在组件挂载前已触发完毕
  648. mounted() {
  649. if (uni.getStorageSync('token')) {
  650. this.isLoggedIn = true
  651. this.loadData()
  652. }
  653. },
  654. onShow() {
  655. // 首次 onShow 紧接 mounted 之后,跳过避免双重加载
  656. if (!this._initialLoadDone) {
  657. this._initialLoadDone = true
  658. return
  659. }
  660. const currentRole = uni.getStorageSync('currentRole') || 'parent'
  661. if (currentRole === 'child') {
  662. uni.reLaunch({ url: '/pages/home-pages/child-index' })
  663. return
  664. }
  665. if (uni.getStorageSync('token')) {
  666. this.isLoggedIn = true
  667. this.loadData()
  668. }
  669. if (this.$refs.onboardingProgress) {
  670. this.$refs.onboardingProgress.reload()
  671. }
  672. },
  673. onPullDownRefresh() {
  674. this.loadData().finally(() => {
  675. uni.stopPullDownRefresh()
  676. })
  677. },
  678. methods: {
  679. rankIcon: function(idx) {
  680. var medals = ['🥇', '🥈', '🥉']
  681. return medals[idx] || '#' + (idx + 1)
  682. },
  683. async loadData() {
  684. this.loading = true
  685. try {
  686. var userInfo = uni.getStorageSync('userInfo')
  687. this.nickname = (userInfo && userInfo.nickname) ? userInfo.nickname : ''
  688. this.selfMemberId = uni.getStorageSync('userId') || null
  689. // 优先使用仪表盘接口(包含孩子列表 + 统计数据)
  690. let dashboardLoaded = false
  691. var _membersVisibleSet = false
  692. try {
  693. const dashRes = await getParentDashboard()
  694. const dashData = dashRes.data || {}
  695. const dashChildren = dashData.children || []
  696. // 过滤:仅保留孩子角色成员,排除家长/本人
  697. var currentUserId = uni.getStorageSync('userId')
  698. var filteredChildren = dashChildren.filter(function(c) {
  699. return c && c.id && c.id !== currentUserId && (c.role === 'child' || c.memberType === 'child')
  700. })
  701. if (filteredChildren.length > 0) {
  702. this.children = filteredChildren
  703. // 不自动选孩子:默认显示家长自己,等待用户从 FamilyMemberStrip 选择
  704. this.familyAvgCompletionRate = dashData.avgCompletionRate || 0
  705. // 家长自身数据(积分 + 任务完成率)
  706. this.myPoints = dashData.parentPoints || 0
  707. this.myCompletionRate = dashData.parentCompletionRate || 0
  708. // 从仪表盘获取 familyId
  709. if (dashData.familyId) {
  710. this._familyId = dashData.familyId
  711. }
  712. dashboardLoaded = true
  713. }
  714. } catch (e) {
  715. console.log('获取仪表盘数据失败,降级到单独接口', e)
  716. }
  717. // 降级:使用原有单独接口
  718. if (!dashboardLoaded) {
  719. try {
  720. const currentUserId = uni.getStorageSync('userId')
  721. const membersRes = await getFamilyMemberList({ visibleOnly: true, includeFamily: true })
  722. const data = membersRes.data || {}
  723. const members = data.members || []
  724. const parents = members.filter(function(p) { return p.source === 'parent' && p.id && p.id !== currentUserId }).map(function(p) { return { ...p, role: 'parent' } })
  725. const children = members.filter(function(c) { return c.source !== 'parent' && c.id }).map(function(c) { return { ...c, role: 'child' } })
  726. this.familyMembers = [].concat(parents, children)
  727. // 同步设置 familyMembersVisible,避免 loadFamilyMembersVisible() 重复调用 getFamilyMemberList
  728. this.familyMembersVisible = members
  729. _membersVisibleSet = true
  730. // 不自动选孩子:默认显示家长自己,等待用户从 FamilyMemberStrip 选择
  731. // 保存 familyId 用于后续请求
  732. if (data.familyId) {
  733. this._familyId = data.familyId
  734. }
  735. } catch (e) {
  736. console.log('获取家庭成员失败', e)
  737. }
  738. if (this.children.length === 0) {
  739. try {
  740. const childrenRes = await getChildren()
  741. const rawChildren = childrenRes.data || []
  742. this.children = rawChildren
  743. // 不自动选孩子:默认显示家长自己,等待用户从 FamilyMemberStrip 选择
  744. } catch (e) {
  745. console.log('获取孩子列表失败', e)
  746. }
  747. }
  748. }
  749. const reviewRes = await getPendingReviewTasks()
  750. const allReviewTasks = reviewRes.data || []
  751. this.pendingReviewTasks = allReviewTasks.slice(0, 3)
  752. try {
  753. const wishRes = await getPendingWishes()
  754. this.pendingReviewWishes = wishRes.data || []
  755. } catch (e) {
  756. console.log('获取待处理心愿失败', e)
  757. this.pendingReviewWishes = []
  758. }
  759. const reviewMap = {}
  760. const wishMap = {}
  761. for (let i = 0; i < allReviewTasks.length; i++) {
  762. const task = allReviewTasks[i]
  763. const cid = task.memberId || task.assigneeId
  764. if (cid) {
  765. reviewMap[cid] = (reviewMap[cid] || 0) + 1
  766. }
  767. }
  768. for (let j = 0; j < (this.pendingReviewWishes || []).length; j++) {
  769. const wish = this.pendingReviewWishes[j]
  770. const cid = wish.memberId
  771. if (cid) {
  772. wishMap[cid] = (wishMap[cid] || 0) + 1
  773. }
  774. }
  775. this.children = this.children.map(function(c) {
  776. return {
  777. ...c,
  778. pendingReviewCount: reviewMap[c.id] || 0,
  779. pendingWishCount: wishMap[c.id] || 0
  780. }
  781. })
  782. // 计算全家总积分(家长 + 所有孩子)
  783. var totalPts = this.myPoints
  784. for (var pi = 0; pi < this.children.length; pi++) {
  785. totalPts += (this.children[pi].totalPoints || 0)
  786. }
  787. this.familyTotalPoints = totalPts
  788. // 如果仪表盘未加载到数据,降级:从孩子数据取近似值
  789. if (!dashboardLoaded) {
  790. // 降级:家长积分取自己的(从缓存或API),完成率取第一个孩子的
  791. const targetChild = this.selectedChild || (this.children.length > 0 ? this.children[0] : null)
  792. if (targetChild) {
  793. try {
  794. const statsRes = await getChildCompletionStats({ memberId: targetChild.id })
  795. if (statsRes && statsRes.data) {
  796. this.myCompletionRate = statsRes.data.completionRate || 0
  797. }
  798. } catch (e) {
  799. console.log('获取个人完成率失败', e)
  800. }
  801. userInfo = uni.getStorageSync('userInfo')
  802. this.myPoints = (userInfo && userInfo.totalPoints) || 0
  803. this.familyAvgCompletionRate = this.myCompletionRate
  804. }
  805. }
  806. // 待完成任务 - 优先使用后端返回的真实任务列表
  807. this.pendingTasks = []
  808. if (this.children.length > 0) {
  809. const targetChild = this.selectedChild || this.children[0]
  810. try {
  811. const r2 = await getChildCompletionStats({ memberId: targetChild.id })
  812. if (r2 && r2.data && r2.data.pendingTaskList && r2.data.pendingTaskList.length > 0) {
  813. this.pendingTasks = r2.data.pendingTaskList.slice(0, 3)
  814. } else if (r2 && r2.data && r2.data.pendingTasks > 0) {
  815. // 降级:只有数量没有列表时使用占位
  816. for (let k = 0; k < Math.min(r2.data.pendingTasks, 3); k++) {
  817. this.pendingTasks.push({ id: 'pending-' + k, title: '待完成任务' })
  818. }
  819. }
  820. } catch (e) {
  821. this.pendingTasks = []
  822. }
  823. }
  824. // 加载通关解锁状态
  825. try {
  826. var statusRes = await getUnlockStatus()
  827. if (statusRes && statusRes.data) {
  828. this.unlockStatus = statusRes.data
  829. }
  830. } catch (e) {
  831. console.log('获取通关解锁状态失败', e)
  832. }
  833. // 加载能量沙盘(含通关门禁)
  834. try {
  835. var memberId = uni.getStorageSync('currentMemberId') || uni.getStorageSync('currentChildId') || null
  836. var energyRes = await getEnergySandbox(this.currentSandboxView, memberId)
  837. if (energyRes && energyRes.data) {
  838. var ed = energyRes.data
  839. if (ed.locked) {
  840. this.sandboxLocked = true
  841. this.sandboxLockGate = ed.gate || null
  842. this.sandboxData = null
  843. this.sandboxPersonalData = null
  844. this.sandboxFamilyData = null
  845. this.energyData = null
  846. } else {
  847. this.sandboxLocked = false
  848. this.sandboxLockGate = null
  849. this.sandboxPersonalData = ed.personalData || null
  850. this.sandboxFamilyData = ed.familyData || null
  851. this.sandboxData = this.currentSandboxView === 'family' ? (ed.familyData || null) : (ed.personalData || null)
  852. this.energyData = ed.personalData || null
  853. this.familyUnlocked = ed.familyUnlocked || false
  854. this.familyLockGate = ed.familyGate || null
  855. }
  856. }
  857. } catch (e) {
  858. console.log('获取能量沙盘数据失败', e)
  859. this.energyData = null
  860. this.sandboxData = null
  861. this.errorEnergy = true
  862. }
  863. // 加载推荐活动
  864. this.loadRecommendedActivities()
  865. // 加载推荐商品
  866. this.loadRecommendedProducts()
  867. // 加载家庭成员可见列表(降级路径已在上面设置,此处跳过避免重复请求)
  868. if (!_membersVisibleSet) {
  869. this.loadFamilyMembersVisible()
  870. }
  871. this.loadSelfCheckStatus()
  872. // 加载健康预警(P1-2)
  873. this.loadAlerts()
  874. // 加载家庭健康互动(P2-2)
  875. this.loadFamilyInteraction()
  876. // 加载健康圈(P3:社区扩散)
  877. this.loadHealthCircle()
  878. // 加载外部联系人
  879. this.loadContacts()
  880. // 加载推荐阅读
  881. this.loadFeaturedArticles()
  882. // 加载五维能量概览(账本模式)
  883. var overviewChildId = this.currentChildId
  884. if (overviewChildId) {
  885. try {
  886. var overviewRes = await getEnergyOverview(overviewChildId)
  887. if (overviewRes && overviewRes.data) {
  888. this.energyDimensions = overviewRes.data.dimensions || []
  889. this.totalEnergy = overviewRes.data.totalEnergy || 0
  890. this.totalHealthIndex = overviewRes.data.totalHealthIndex || 0
  891. }
  892. } catch (e) {
  893. console.log('获取能量概览失败', e)
  894. }
  895. }
  896. } catch (e) {
  897. console.error('加载数据失败', e)
  898. } finally {
  899. this.loading = false
  900. this.$emit('ready')
  901. }
  902. },
  903. async approveTask(taskId) {
  904. try {
  905. await approveTask(taskId)
  906. uni.showToast({ title: '已通过', icon: 'success' })
  907. this.loadData()
  908. } catch (e) {
  909. uni.showToast({ title: '操作失败', icon: 'none' })
  910. }
  911. },
  912. async rejectTask(taskId) {
  913. try {
  914. await rejectTask(taskId)
  915. uni.showToast({ title: '已拒绝', icon: 'success' })
  916. this.loadData()
  917. } catch (e) {
  918. uni.showToast({ title: '操作失败', icon: 'none' })
  919. }
  920. },
  921. // 加载可见家庭成员
  922. async loadFamilyMembersVisible() {
  923. try {
  924. var res = await getFamilyMemberList({ visibleOnly: true })
  925. this.familyMembersVisible = res.data || []
  926. } catch (e) {
  927. console.log('获取可见家庭成员失败', e)
  928. this.familyMembersVisible = []
  929. }
  930. },
  931. // 成员选择
  932. goToCompletionStats() {
  933. if (this.children.length === 1) {
  934. uni.navigateTo({ url: '/pages/stats/completion-rate?memberId=' + this.children[0].id })
  935. } else {
  936. uni.navigateTo({ url: '/pages/stats/completion-rate?familyView=1' })
  937. }
  938. },
  939. onDomainClick(evt) {
  940. this.goToDomain(evt.code)
  941. },
  942. /** 切换沙盘个人/全家视角(本地切换,不重新请求) */
  943. onSandboxViewChange: function(view) {
  944. if (view === this.currentSandboxView) return
  945. this.currentSandboxView = view
  946. this.sandboxData = view === 'family' ? (this.sandboxFamilyData || null) : (this.sandboxPersonalData || null)
  947. },
  948. /** 单独加载沙盘数据(首次进入时使用,一次返回个人+全家) */
  949. loadSandboxData: async function() {
  950. try {
  951. var memberId = uni.getStorageSync('currentMemberId') || uni.getStorageSync('currentChildId') || null
  952. var energyRes = await getEnergySandbox(this.currentSandboxView, memberId)
  953. if (energyRes && energyRes.data) {
  954. var ed = energyRes.data
  955. if (ed.locked) {
  956. this.sandboxLocked = true
  957. this.sandboxLockGate = ed.gate || null
  958. this.sandboxData = null
  959. this.sandboxPersonalData = null
  960. this.sandboxFamilyData = null
  961. } else {
  962. this.sandboxLocked = false
  963. this.sandboxLockGate = null
  964. this.sandboxPersonalData = ed.personalData || null
  965. this.sandboxFamilyData = ed.familyData || null
  966. this.sandboxData = this.currentSandboxView === 'family' ? (ed.familyData || null) : (ed.personalData || null)
  967. this.familyUnlocked = ed.familyUnlocked || false
  968. this.familyLockGate = ed.familyGate || null
  969. }
  970. }
  971. } catch (e) {
  972. console.log('加载沙盘数据失败', e)
  973. }
  974. },
  975. goToDomain(code) {
  976. // 跳转到能量详情页
  977. var memberId = this.currentChildId
  978. if (!memberId || !code) return
  979. uni.navigateTo({
  980. url: '/pages/energy/detail?memberId=' + memberId + '&code=' + code
  981. })
  982. },
  983. onFamilyMemberSelect(member) {
  984. this.selectedMemberId = member.id
  985. // 选中的是孩子时,设置 selectedChild 以便子组件加载孩子数据
  986. var matched = this.children.find(function(c) { return c.id === member.id })
  987. if (matched) {
  988. this.selectedChild = matched
  989. this.currentChildId = matched.id
  990. } else {
  991. this.selectedChild = null
  992. this.currentChildId = ''
  993. }
  994. },
  995. async onFamilyMemberSwitch(member) {
  996. if (!member || !member.id) return
  997. try {
  998. var res = await switchToFamilyMember(member.id, member.source || 'family_member')
  999. if (res.code === 200 && res.data) {
  1000. store.commit('switchToMember', {
  1001. memberId: res.data.memberId,
  1002. effectiveRole: res.data.effectiveRole
  1003. })
  1004. uni.showToast({ title: '已切换到' + (member.nickname || '该成员'), icon: 'success' })
  1005. setTimeout(function() {
  1006. uni.reLaunch({ url: '/pages/index-home/index' })
  1007. }, 1000)
  1008. } else {
  1009. uni.showToast({ title: res.message || '切换失败', icon: 'none' })
  1010. }
  1011. } catch (e) {
  1012. uni.showToast({ title: '切换失败', icon: 'none' })
  1013. }
  1014. },
  1015. onMicroActionCompleted() {
  1016. this.loadData()
  1017. feedbackEngine.trigger('micro_action')
  1018. },
  1019. goAddMember() {
  1020. uni.navigateTo({ url: '/pages/family/add-member' })
  1021. },
  1022. onDailySummaryDismiss() {
  1023. // DailySummary 已关闭,无额外操作
  1024. },
  1025. loadAlerts: function() {
  1026. var memberId = this.selectedChild && this.selectedChild.id
  1027. if (!memberId) return
  1028. var self = this
  1029. getActiveAlerts({ memberId: memberId }).then(function(res) {
  1030. if (res.code === 200) {
  1031. self.healthAlerts = res.data || []
  1032. }
  1033. }).catch(function() {})
  1034. },
  1035. handleDismissAlert: function(alertId) {
  1036. var self = this
  1037. dismissAlert({ id: alertId }).then(function(res) {
  1038. if (res.code === 200) {
  1039. self.healthAlerts = self.healthAlerts.filter(function(a) { return a.id !== alertId })
  1040. }
  1041. }).catch(function() {})
  1042. },
  1043. loadFamilyInteraction: function() {
  1044. var familyId = this._familyId
  1045. if (!familyId) return
  1046. var self = this
  1047. getFamilyRanking({}).then(function(res) {
  1048. if (res.code === 200 && res.data) {
  1049. self.rankingMembers = res.data.members || []
  1050. self.rankingTotalScore = res.data.totalScore || 0
  1051. }
  1052. }).catch(function() {})
  1053. getChallengeList({}).then(function(res) {
  1054. if (res.code === 200 && Array.isArray(res.data)) {
  1055. self.activeChallenges = res.data
  1056. }
  1057. }).catch(function() {})
  1058. },
  1059. loadHealthCircle: function() {
  1060. var familyId = this._familyId
  1061. if (!familyId) return
  1062. var self = this
  1063. self.circleLoading = true
  1064. getCircleRanking({}).then(function(res) {
  1065. if (res.code === 200 && res.data) {
  1066. self.circleName = res.data.circleName || ''
  1067. self.circleRankings = res.data.rankings || []
  1068. }
  1069. }).catch(function() {
  1070. self.circleRankings = []
  1071. self.circleName = ''
  1072. }).finally(function() {
  1073. self.circleLoading = false
  1074. })
  1075. },
  1076. goToHealthCircle: function() {
  1077. uni.navigateTo({ url: '/pages/share/index' })
  1078. },
  1079. goToSelfCheck: function() {
  1080. uni.navigateTo({ url: '/pages/family/self-check-entry' })
  1081. },
  1082. loadSelfCheckStatus: function() {
  1083. var self = this
  1084. getSelfCheckStatus().then(function(res) {
  1085. if (res.code === 200 && res.data && res.data.lastResult) {
  1086. self.selfCheckScore = res.data.lastResult.totalScore
  1087. }
  1088. }).catch(function() {})
  1089. },
  1090. goMemberDetail(member) {
  1091. if (!member || !member.memberId) return
  1092. uni.navigateTo({
  1093. url: '/pages/member-detail/member-detail?memberId=' + member.memberId + '&memberType=' + (member.memberType || 'child') + '&entrySource=relation-graph'
  1094. })
  1095. },
  1096. addTask() { uni.navigateTo({ url: '/pages/tasks/create-task' }) },
  1097. goToChallengeManage() { uni.navigateTo({ url: '/pages/health/challenge-manage' }) },
  1098. goToReview() { uni.navigateTo({ url: '/pages/tasks/review' }) },
  1099. goToWishApprove() { uni.navigateTo({ url: '/pages/wishes/approve' }) },
  1100. goToAssessmentReport() { uni.navigateTo({ url: '/pages/assessment/report' }) },
  1101. goToActivities() { uni.navigateTo({ url: '/pages/activity/index' }) },
  1102. goToRewards() { uni.navigateTo({ url: '/pages/rewards/rewards' }) },
  1103. onFeedItemClick(item) {
  1104. if (item.type === 'product') {
  1105. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + item.id })
  1106. } else if (item.type === 'activity') {
  1107. uni.navigateTo({ url: '/pages/activity/activity-detail/activity-detail?id=' + item.id })
  1108. }
  1109. },
  1110. goMoreDiscover() {
  1111. uni.navigateTo({ url: '/pages/discover/index' })
  1112. },
  1113. loadRecommendedActivities() {
  1114. var self = this
  1115. getActivityList({ page: 1, size: 6 }).then(function(res) {
  1116. if (res && res.data) {
  1117. self.recommendedActivities = res.data.records || []
  1118. }
  1119. }).catch(function() {
  1120. self.errorActivities = true
  1121. })
  1122. },
  1123. loadRecommendedProducts() {
  1124. var self = this
  1125. getProductsByDomain('all', 1, 6).then(function(res) {
  1126. if (res && res.data) {
  1127. self.recommendedProducts = res.data.records || []
  1128. }
  1129. }).catch(function() {
  1130. self.errorProducts = true
  1131. })
  1132. },
  1133. goToTaskList() { uni.navigateTo({ url: '/pages/tasks/tasks' }) },
  1134. manageChildren() { uni.navigateTo({ url: '/pages/profile-extra/family-members' }) },
  1135. loadContacts: function() {
  1136. var self = this
  1137. getContactList({}).then(function(res) {
  1138. if (res.code === 200 && res.data) {
  1139. self.contactList = Array.isArray(res.data) ? res.data : []
  1140. }
  1141. }).catch(function(e) {
  1142. console.log('获取联系人失败', e)
  1143. })
  1144. },
  1145. onContactClick: function(item) {
  1146. uni.navigateTo({ url: '/pages/action-detail/contact-detail?id=' + item.id })
  1147. },
  1148. onShowImport: function() {
  1149. this.showImportModal = true
  1150. },
  1151. onCloseImport: function() {
  1152. this.showImportModal = false
  1153. },
  1154. onImportSuccess: function() {
  1155. this.showImportModal = false
  1156. this.loadContacts()
  1157. },
  1158. // QR Code modal methods
  1159. onShowQrCodeModal: async function() {
  1160. this.showQrCodeModal = true
  1161. this.qrCodeData = null
  1162. try {
  1163. const res = await this.getInviteQrCode()
  1164. if (res.code === 200) {
  1165. this.qrCodeData = res.data
  1166. }
  1167. } catch (e) {
  1168. console.error('获取二维码失败', e)
  1169. uni.showToast({ title: '获取二维码失败', icon: 'none' })
  1170. }
  1171. },
  1172. onCloseQrCodeModal: function() {
  1173. this.showQrCodeModal = false
  1174. this.qrCodeData = null
  1175. },
  1176. onCopyReferralCode: function() {
  1177. if (this.qrCodeData && this.qrCodeData.referralCode) {
  1178. uni.setClipboardData({
  1179. data: this.qrCodeData.referralCode,
  1180. success: () => {
  1181. uni.showToast({ title: '复制成功', icon: 'success' })
  1182. }
  1183. })
  1184. }
  1185. },
  1186. // 兼容旧引用
  1187. getInviteQrCode: function() {
  1188. return getInviteQrCode()
  1189. },
  1190. // ===== 推荐阅读 =====
  1191. loadFeaturedArticles: function() {
  1192. var self = this
  1193. this.articlesLoading = true
  1194. getFeaturedArticles({ size: 5 }).then(function(res) {
  1195. self.articlesLoading = false
  1196. if (res && res.code === 200) {
  1197. var rawList = res.data && (Array.isArray(res.data) ? res.data : (res.data.data || res.data.records || []))
  1198. var list = Array.isArray(rawList) ? rawList : []
  1199. self.indexArticles = list.map(function(item, index) {
  1200. return {
  1201. id: item.id,
  1202. category: item.categoryName || item.category || '热门文章',
  1203. categoryColor: self.gradientColors[index % self.gradientColors.length],
  1204. title: item.title || '',
  1205. summary: item.summary || '',
  1206. views: item.viewCount ? String(item.viewCount) : '0',
  1207. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  1208. coverImage: item.coverImage
  1209. }
  1210. })
  1211. }
  1212. }).catch(function() {
  1213. self.articlesLoading = false
  1214. })
  1215. },
  1216. goArticles: function() {
  1217. uni.navigateTo({ url: '/pages/mind-detail/articles' })
  1218. },
  1219. goArticleDetail: function(articleOrId) {
  1220. var id = typeof articleOrId === 'object' ? articleOrId.id : articleOrId
  1221. uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
  1222. }
  1223. }
  1224. }
  1225. </script>
  1226. <style scoped>
  1227. /* ========================================
  1228. Flat Card Design System — 家长端暖橙扁平
  1229. ======================================== */
  1230. .container {
  1231. padding: 32rpx;
  1232. background: var(--bg, #F5F9FC);
  1233. min-height: 100vh;
  1234. }
  1235. /* ========================================
  1236. 区块标题
  1237. ======================================== */
  1238. .section-title {
  1239. font-size: 32rpx;
  1240. font-weight: 700;
  1241. color: var(--text, #1E293B);
  1242. margin-bottom: var(--space-md);
  1243. }
  1244. /* ========================================
  1245. c) 成长数据
  1246. ======================================== */
  1247. .stats-section {
  1248. margin-bottom: 48rpx;
  1249. }
  1250. .stats-row {
  1251. display: flex;
  1252. gap: 16rpx;
  1253. }
  1254. .stat-card-wide {
  1255. flex: 1;
  1256. min-width: 0;
  1257. box-sizing: border-box;
  1258. }
  1259. .stat-card-content {
  1260. padding: 24rpx;
  1261. }
  1262. .stat-header {
  1263. display: flex;
  1264. align-items: center;
  1265. margin-bottom: 16rpx;
  1266. }
  1267. .stat-icon-wrap {
  1268. width: 56rpx;
  1269. height: 56rpx;
  1270. border-radius: var(--radius-sm, 12rpx);
  1271. display: flex;
  1272. align-items: center;
  1273. justify-content: center;
  1274. margin-right: 14rpx;
  1275. flex-shrink: 0;
  1276. }
  1277. .stat-icon-symbol {
  1278. font-size: 28rpx;
  1279. }
  1280. .stat-icon-orange { background: rgba(91, 155, 213, 0.12); }
  1281. .stat-icon-gold { background: rgba(245, 158, 11, 0.15); }
  1282. .stat-body {
  1283. flex: 1;
  1284. min-width: 0;
  1285. }
  1286. .stat-label-header {
  1287. font-size: 26rpx;
  1288. font-weight: 600;
  1289. color: var(--text, #1E293B);
  1290. }
  1291. /* 对比行布局 */
  1292. .stat-compare {
  1293. margin-bottom: 12rpx;
  1294. }
  1295. .stat-compare-row {
  1296. display: flex;
  1297. justify-content: space-between;
  1298. align-items: center;
  1299. margin-bottom: 4rpx;
  1300. }
  1301. .compare-label {
  1302. font-size: 22rpx;
  1303. color: var(--text-secondary, #64748B);
  1304. }
  1305. .compare-value {
  1306. font-size: 30rpx;
  1307. font-weight: 700;
  1308. }
  1309. /* 进度条 - 紧凑版 */
  1310. .progress-bar-sm {
  1311. height: 6rpx;
  1312. background: var(--border-light, #E2E8F0);
  1313. border-radius: 999rpx;
  1314. overflow: hidden;
  1315. margin-bottom: 8rpx;
  1316. }
  1317. .progress-fill-sm {
  1318. height: 100%;
  1319. background: linear-gradient(90deg, var(--color-primary, #5B9BD5), #F59E0B);
  1320. border-radius: 999rpx;
  1321. transition: width 0.3s ease;
  1322. }
  1323. .progress-fill-sm.muted {
  1324. background: linear-gradient(90deg, #94A3B8, #CBD5E1);
  1325. }
  1326. .accent-color { color: var(--color-primary, #5B9BD5); }
  1327. .gold-color { color: #F59E0B; }
  1328. .stat-more {
  1329. font-size: 22rpx;
  1330. color: var(--color-accent, #0EA5E9);
  1331. font-weight: 500;
  1332. display: block;
  1333. }
  1334. .stat-encourage {
  1335. font-size: 22rpx;
  1336. color: #10B981;
  1337. font-weight: 500;
  1338. margin-top: 8rpx;
  1339. display: block;
  1340. }
  1341. .stat-encourage.muted {
  1342. color: var(--muted, #94A3B8);
  1343. }
  1344. /* ========================================
  1345. d) 今日重点
  1346. ======================================== */
  1347. .today-section {
  1348. margin-bottom: 48rpx;
  1349. }
  1350. .today-card .today-header {
  1351. display: flex;
  1352. justify-content: space-between;
  1353. align-items: center;
  1354. }
  1355. .today-label {
  1356. font-size: 28rpx;
  1357. font-weight: 600;
  1358. color: var(--text, #1E293B);
  1359. }
  1360. .today-count {
  1361. font-size: 24rpx;
  1362. color: var(--color-primary, #5B9BD5);
  1363. font-weight: 600;
  1364. }
  1365. .task-list {
  1366. margin-bottom: 8rpx;
  1367. }
  1368. .task-item {
  1369. display: flex;
  1370. align-items: center;
  1371. padding: 18rpx 0;
  1372. border-bottom: 1rpx solid var(--border-light, #E2E8F0);
  1373. }
  1374. .task-item:last-child {
  1375. border-bottom: none;
  1376. }
  1377. .task-dot {
  1378. width: 14rpx;
  1379. height: 14rpx;
  1380. border-radius: 50%;
  1381. margin-right: 16rpx;
  1382. flex-shrink: 0;
  1383. }
  1384. .dot-color-0 { background: var(--color-primary, #5B9BD5); }
  1385. .dot-color-1 { background: #10B981; }
  1386. .dot-color-2 { background: var(--color-accent, #0EA5E9); }
  1387. .dot-color-3 { background: #F59E0B; }
  1388. .dot-color-4 { background: var(--color-error, #EF4444); }
  1389. .task-title {
  1390. font-size: 28rpx;
  1391. color: var(--text, #1E293B);
  1392. }
  1393. .task-view-all {
  1394. display: flex;
  1395. justify-content: flex-end;
  1396. align-items: center;
  1397. color: var(--text-secondary, #64748B);
  1398. font-size: 24rpx;
  1399. padding-top: 16rpx;
  1400. border-top: 1rpx solid var(--border-light, #E2E8F0);
  1401. }
  1402. .task-view-all .arrow {
  1403. margin-left: 8rpx;
  1404. }
  1405. /* ========================================
  1406. e) 成长里程碑
  1407. ======================================== */
  1408. .milestone-section {
  1409. margin-bottom: 48rpx;
  1410. }
  1411. .milestone-card {
  1412. padding: 24rpx !important;
  1413. }
  1414. .milestone-item {
  1415. display: flex;
  1416. align-items: center;
  1417. padding: 16rpx 0;
  1418. border-bottom: 1rpx solid var(--border-light, #E2E8F0);
  1419. }
  1420. .milestone-item:last-child {
  1421. border-bottom: none;
  1422. }
  1423. .milestone-icon-wrap {
  1424. width: 56rpx;
  1425. height: 56rpx;
  1426. border-radius: var(--radius-sm, 12rpx);
  1427. display: flex;
  1428. align-items: center;
  1429. justify-content: center;
  1430. margin-right: 16rpx;
  1431. flex-shrink: 0;
  1432. }
  1433. .milestone-icon {
  1434. font-size: 28rpx;
  1435. }
  1436. .milestone-star { background: rgba(245, 158, 11, 0.15); }
  1437. .milestone-trophy { background: rgba(91, 155, 213, 0.12); }
  1438. .milestone-sparkle { background: rgba(16, 185, 129, 0.12); }
  1439. .milestone-text {
  1440. font-size: 28rpx;
  1441. color: var(--text, #1E293B);
  1442. }
  1443. /* ========================================
  1444. f) 待处理事项
  1445. ======================================== */
  1446. .pending-section { margin-bottom: 48rpx; }
  1447. .pending-grid {
  1448. display: flex;
  1449. flex-wrap: wrap;
  1450. gap: 16rpx;
  1451. }
  1452. .pending-card {
  1453. background: #fff;
  1454. border-radius: 20rpx;
  1455. padding: 24rpx;
  1456. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1457. display: flex;
  1458. align-items: center;
  1459. width: calc(50% - 8rpx);
  1460. box-sizing: border-box;
  1461. }
  1462. .pending-card:active { opacity: 0.8; }
  1463. .pending-icon {
  1464. width: 72rpx; height: 72rpx;
  1465. border-radius: 16rpx;
  1466. display: flex; align-items: center; justify-content: center;
  1467. margin-right: 16rpx; flex-shrink: 0;
  1468. }
  1469. .pending-icon--blue { background: rgba(91,155,213,0.12); }
  1470. .pending-icon--pink { background: rgba(236,72,153,0.12); }
  1471. .pending-icon--green { background: rgba(16,185,129,0.12); }
  1472. .pending-icon--orange { background: rgba(249,115,22,0.12); }
  1473. .pending-emoji { font-size: 32rpx; }
  1474. .pending-info { flex: 1; min-width: 0; }
  1475. .pending-count { font-size: 36rpx; font-weight: 800; display: block; }
  1476. .pending-label { font-size: 22rpx; color: #666; margin-top: 4rpx; display: block; }
  1477. .pink-color { color: #EC4899; }
  1478. .orange-color { color: #F97316; }
  1479. /* ========================================
  1480. g) 成长建议
  1481. ======================================== */
  1482. .advice-section { margin-bottom: 48rpx; }
  1483. .advice-card { margin-bottom: 12rpx; }
  1484. .advice-content {
  1485. display: flex; align-items: center; padding: 24rpx;
  1486. }
  1487. .advice-icon-wrap {
  1488. width: 56rpx; height: 56rpx;
  1489. border-radius: 14rpx;
  1490. background: rgba(91,155,213,0.1);
  1491. display: flex; align-items: center; justify-content: center;
  1492. margin-right: 16rpx; flex-shrink: 0;
  1493. }
  1494. .advice-icon { font-size: 28rpx; }
  1495. .advice-text-wrap { flex: 1; min-width: 0; }
  1496. .advice-title { font-size: 28rpx; font-weight: 600; color: #333; display: block; }
  1497. .advice-desc { font-size: 24rpx; color: #999; margin-top: 4rpx; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  1498. .advice-arrow { font-size: 36rpx; color: #ccc; margin-left: 12rpx; }
  1499. /* ========================================
  1500. h) 待审核任务
  1501. ======================================== */
  1502. .review-section {
  1503. margin-bottom: 48rpx;
  1504. }
  1505. .review-card {
  1506. margin-bottom: 16rpx;
  1507. }
  1508. .review-card:last-child {
  1509. margin-bottom: 0;
  1510. }
  1511. .review-card-content {
  1512. display: flex;
  1513. justify-content: space-between;
  1514. align-items: center;
  1515. padding: 24rpx;
  1516. }
  1517. .review-info {
  1518. flex: 1;
  1519. min-width: 0;
  1520. }
  1521. .review-info .task-name {
  1522. font-size: 28rpx;
  1523. color: var(--text, #1E293B);
  1524. display: block;
  1525. margin-bottom: 4rpx;
  1526. }
  1527. .review-info .task-child {
  1528. font-size: 22rpx;
  1529. color: var(--muted, #94A3B8);
  1530. }
  1531. .review-actions {
  1532. display: flex;
  1533. gap: 12rpx;
  1534. flex-shrink: 0;
  1535. margin-left: 16rpx;
  1536. }
  1537. /* ========================================
  1538. g) 快捷操作
  1539. ======================================== */
  1540. .quick-section {
  1541. margin-bottom: 48rpx;
  1542. }
  1543. .quick-card {
  1544. padding: 16rpx 12rpx !important;
  1545. }
  1546. .quick-actions {
  1547. display: flex;
  1548. flex-wrap: wrap;
  1549. }
  1550. .action-item {
  1551. display: flex;
  1552. flex-direction: column;
  1553. align-items: center;
  1554. width: 20%;
  1555. margin-bottom: 12rpx;
  1556. transition: transform 0.15s ease;
  1557. }
  1558. .action-item:active {
  1559. transform: scale(0.92);
  1560. }
  1561. .action-icon {
  1562. width: 80rpx;
  1563. height: 80rpx;
  1564. border-radius: var(--radius-sm, 12rpx);
  1565. display: flex;
  1566. align-items: center;
  1567. justify-content: center;
  1568. margin-bottom: 10rpx;
  1569. }
  1570. .action-icon-text {
  1571. font-size: 32rpx;
  1572. }
  1573. .act-add { background: rgba(91, 155, 213, 0.12); }
  1574. .act-review { background: rgba(16, 185, 129, 0.12); }
  1575. .act-child { background: rgba(14, 165, 233, 0.12); }
  1576. .act-reward { background: rgba(245, 158, 11, 0.15); }
  1577. .act-invite { background: rgba(139, 92, 246, 0.12); }
  1578. .action-label {
  1579. font-size: 22rpx;
  1580. color: var(--text-secondary, #64748B);
  1581. font-weight: 500;
  1582. text-align: center;
  1583. }
  1584. /* ===== Error State ===== */
  1585. .error-state {
  1586. display: flex;
  1587. align-items: center;
  1588. justify-content: center;
  1589. padding: 32rpx 24rpx;
  1590. margin-bottom: 24rpx;
  1591. background: #FFF;
  1592. border-radius: 16rpx;
  1593. border: 1rpx dashed #E2E8F0;
  1594. }
  1595. .error-state-text {
  1596. font-size: 26rpx;
  1597. color: #94A3B8;
  1598. text-align: center;
  1599. }
  1600. /* ===== 重要关系(通讯录) ===== */
  1601. .contact-section {
  1602. margin: 20rpx 20rpx 0;
  1603. }
  1604. .contact-header {
  1605. display: flex;
  1606. justify-content: space-between;
  1607. align-items: center;
  1608. margin-bottom: 16rpx;
  1609. }
  1610. .contact-section-title {
  1611. font-size: 30rpx;
  1612. font-weight: 600;
  1613. color: #333;
  1614. }
  1615. .contact-header-right {
  1616. display: flex;
  1617. gap: 16rpx;
  1618. align-items: center;
  1619. }
  1620. .contact-more {
  1621. font-size: 24rpx;
  1622. color: #999;
  1623. }
  1624. .contact-import-btn {
  1625. font-size: 24rpx;
  1626. color: #F97316;
  1627. font-weight: 500;
  1628. }
  1629. .contact-scroll {
  1630. white-space: nowrap;
  1631. overflow: hidden;
  1632. }
  1633. .contact-scroll-inner {
  1634. display: flex;
  1635. flex-direction: row;
  1636. gap: 16rpx;
  1637. padding: 8rpx 0 16rpx;
  1638. }
  1639. .contact-card-wrap {
  1640. flex-shrink: 0;
  1641. width: 220rpx;
  1642. }
  1643. .contact-card-wrap:active {
  1644. opacity: 0.8;
  1645. }
  1646. .contact-add-card {
  1647. width: 160rpx;
  1648. }
  1649. .add-card-inner {
  1650. width: 160rpx;
  1651. height: 280rpx;
  1652. background: #fff;
  1653. border-radius: 16rpx;
  1654. border: 2rpx dashed #ddd;
  1655. display: flex;
  1656. flex-direction: column;
  1657. align-items: center;
  1658. justify-content: center;
  1659. gap: 12rpx;
  1660. }
  1661. .add-card-icon {
  1662. font-size: 48rpx;
  1663. color: #ccc;
  1664. }
  1665. .add-card-label {
  1666. font-size: 22rpx;
  1667. color: #999;
  1668. }
  1669. .contact-empty {
  1670. padding: 40rpx 0;
  1671. text-align: center;
  1672. }
  1673. .contact-empty-text {
  1674. font-size: 26rpx;
  1675. color: #ccc;
  1676. }
  1677. /* ===== 推荐阅读 ===== */
  1678. .article-section {
  1679. margin-bottom: 48rpx;
  1680. }
  1681. .article-header {
  1682. display: flex;
  1683. justify-content: space-between;
  1684. align-items: center;
  1685. margin-bottom: var(--space-md);
  1686. }
  1687. .article-more {
  1688. font-size: 26rpx;
  1689. color: var(--color-primary, #F97316);
  1690. }
  1691. .article-list {
  1692. display: flex;
  1693. flex-direction: column;
  1694. gap: 16rpx;
  1695. }
  1696. .article-card {
  1697. background: #fff;
  1698. border-radius: 16rpx;
  1699. padding: 24rpx;
  1700. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1701. }
  1702. .article-card:active {
  1703. opacity: 0.8;
  1704. }
  1705. .article-category {
  1706. display: inline-block;
  1707. padding: 4rpx 14rpx;
  1708. border-radius: 8rpx;
  1709. margin-bottom: 10rpx;
  1710. }
  1711. .article-category-text {
  1712. font-size: 20rpx;
  1713. color: #fff;
  1714. }
  1715. .article-title {
  1716. display: block;
  1717. font-size: 28rpx;
  1718. font-weight: bold;
  1719. color: #333;
  1720. margin-bottom: 8rpx;
  1721. line-height: 1.4;
  1722. }
  1723. .article-summary {
  1724. display: block;
  1725. font-size: 24rpx;
  1726. color: #888;
  1727. line-height: 1.5;
  1728. margin-bottom: 12rpx;
  1729. overflow: hidden;
  1730. text-overflow: ellipsis;
  1731. display: -webkit-box;
  1732. -webkit-line-clamp: 2;
  1733. -webkit-box-orient: vertical;
  1734. }
  1735. .article-meta {
  1736. display: flex;
  1737. align-items: center;
  1738. gap: 16rpx;
  1739. }
  1740. .meta-item {
  1741. display: flex;
  1742. align-items: center;
  1743. gap: 4rpx;
  1744. }
  1745. .meta-icon {
  1746. font-size: 24rpx;
  1747. }
  1748. .meta-text {
  1749. font-size: 22rpx;
  1750. color: #999;
  1751. }
  1752. .article-date {
  1753. font-size: 22rpx;
  1754. color: #bbb;
  1755. }
  1756. /* ===== 家庭挑战区域 ===== */
  1757. .challenge-section {
  1758. margin-bottom: 28rpx;
  1759. }
  1760. .challenge-section-header {
  1761. display: flex;
  1762. justify-content: space-between;
  1763. align-items: center;
  1764. margin: 0 20rpx 12rpx;
  1765. }
  1766. .challenge-section-title {
  1767. font-size: 32rpx;
  1768. font-weight: 700;
  1769. color: #1E293B;
  1770. }
  1771. .challenge-section-action {
  1772. font-size: 24rpx;
  1773. color: #10B981;
  1774. font-weight: 600;
  1775. }
  1776. /* ===== 健康圈入口卡片(P3:社区扩散) ===== */
  1777. .circle-entry-section {
  1778. margin: 0 20rpx 28rpx 20rpx;
  1779. }
  1780. .circle-card-wide {
  1781. width: 100%;
  1782. }
  1783. .circle-card-content {
  1784. padding: 24rpx;
  1785. display: flex;
  1786. flex-direction: column;
  1787. gap: 16rpx;
  1788. }
  1789. .circle-header {
  1790. display: flex;
  1791. align-items: center;
  1792. gap: 12rpx;
  1793. }
  1794. .circle-icon-wrap {
  1795. width: 56rpx;
  1796. height: 56rpx;
  1797. border-radius: 14rpx;
  1798. background: linear-gradient(135deg, #10B981, #34D399);
  1799. display: flex;
  1800. align-items: center;
  1801. justify-content: center;
  1802. }
  1803. .circle-icon {
  1804. font-size: 28rpx;
  1805. }
  1806. .circle-header-body {
  1807. flex: 1;
  1808. }
  1809. .circle-card-title {
  1810. display: block;
  1811. font-size: 28rpx;
  1812. font-weight: 700;
  1813. color: #1E293B;
  1814. line-height: 1.4;
  1815. }
  1816. .circle-card-subtitle {
  1817. display: block;
  1818. font-size: 22rpx;
  1819. color: #6B7280;
  1820. margin-top: 2rpx;
  1821. }
  1822. .circle-ranking-preview {
  1823. background: #F0FDF4;
  1824. border-radius: 12rpx;
  1825. padding: 16rpx;
  1826. display: flex;
  1827. flex-direction: column;
  1828. gap: 10rpx;
  1829. }
  1830. .circle-rank-row {
  1831. display: flex;
  1832. align-items: center;
  1833. gap: 10rpx;
  1834. }
  1835. .circle-rank-badge {
  1836. font-size: 24rpx;
  1837. width: 40rpx;
  1838. text-align: center;
  1839. }
  1840. .circle-rank-family {
  1841. flex: 1;
  1842. font-size: 24rpx;
  1843. color: #374151;
  1844. font-weight: 500;
  1845. }
  1846. .circle-rank-score {
  1847. font-size: 24rpx;
  1848. color: #F97316;
  1849. font-weight: 600;
  1850. }
  1851. .circle-action {
  1852. display: flex;
  1853. justify-content: flex-end;
  1854. }
  1855. .circle-action-text {
  1856. font-size: 24rpx;
  1857. color: #F97316;
  1858. font-weight: 500;
  1859. }
  1860. /* 无数据:邀请加入样式 */
  1861. .circle-card-invite {
  1862. background: linear-gradient(135deg, #F0FDF4, #ECFDF5);
  1863. }
  1864. .circle-invite-content {
  1865. padding: 32rpx 24rpx;
  1866. display: flex;
  1867. flex-direction: column;
  1868. align-items: center;
  1869. gap: 12rpx;
  1870. }
  1871. .circle-invite-icon {
  1872. font-size: 48rpx;
  1873. margin-bottom: 4rpx;
  1874. }
  1875. .circle-invite-title {
  1876. font-size: 30rpx;
  1877. font-weight: 700;
  1878. color: #065F46;
  1879. }
  1880. .circle-invite-desc {
  1881. font-size: 24rpx;
  1882. color: #6B7280;
  1883. text-align: center;
  1884. line-height: 1.5;
  1885. }
  1886. .circle-invite-cta {
  1887. font-size: 26rpx;
  1888. color: #F97316;
  1889. font-weight: 600;
  1890. margin-top: 4rpx;
  1891. }
  1892. /* ===== 五维家庭自检入口卡片(P0-1/P0-2) ===== */
  1893. .selfcheck-entry-section {
  1894. margin: 0 20rpx 28rpx 20rpx;
  1895. }
  1896. .selfcheck-card-wide {
  1897. width: 100%;
  1898. }
  1899. .selfcheck-card-content {
  1900. padding: 28rpx 24rpx;
  1901. display: flex;
  1902. align-items: center;
  1903. gap: 20rpx;
  1904. }
  1905. .selfcheck-icon-wrap {
  1906. display: flex;
  1907. flex-direction: row;
  1908. align-items: center;
  1909. flex-shrink: 0;
  1910. }
  1911. .selfcheck-icon-circle {
  1912. width: 52rpx;
  1913. height: 52rpx;
  1914. border-radius: 50%;
  1915. display: flex;
  1916. align-items: center;
  1917. justify-content: center;
  1918. margin-right: -10rpx;
  1919. border: 4rpx solid #fff;
  1920. box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.12);
  1921. }
  1922. .selfcheck-icon-circle:last-child {
  1923. margin-right: 0;
  1924. }
  1925. .selfcheck-icon-char {
  1926. font-size: 24rpx;
  1927. font-weight: 700;
  1928. color: #fff;
  1929. }
  1930. .selfcheck-body {
  1931. flex: 1;
  1932. }
  1933. .selfcheck-title {
  1934. display: block;
  1935. font-size: 30rpx;
  1936. font-weight: 700;
  1937. color: #1E293B;
  1938. line-height: 1.4;
  1939. }
  1940. .selfcheck-subtitle {
  1941. display: block;
  1942. font-size: 22rpx;
  1943. color: #6B7280;
  1944. margin-top: 4rpx;
  1945. }
  1946. .selfcheck-arrow {
  1947. font-size: 30rpx;
  1948. color: #F97316;
  1949. font-weight: 600;
  1950. flex-shrink: 0;
  1951. }
  1952. /* ===== 邀请码二维码弹窗 ===== */
  1953. .qr-code-modal {
  1954. position: fixed;
  1955. top: 0;
  1956. left: 0;
  1957. width: 100%;
  1958. height: 100%;
  1959. background: rgba(0, 0, 0, 0.6);
  1960. display: flex;
  1961. align-items: center;
  1962. justify-content: center;
  1963. z-index: 1000;
  1964. padding: 40rpx 20rpx;
  1965. box-sizing: border-box;
  1966. }
  1967. .qr-code-modal-content {
  1968. background: #fff;
  1969. border-radius: 20rpx;
  1970. padding: 40rpx 32rpx;
  1971. max-width: 600rpx;
  1972. width: 100%;
  1973. box-shadow: 0 10rpx 40rpx rgba(0, 0, 0, 0.2);
  1974. position: relative;
  1975. }
  1976. .qr-code-modal-header {
  1977. display: flex;
  1978. justify-content: space-between;
  1979. align-items: center;
  1980. margin-bottom: 32rpx;
  1981. }
  1982. .qr-code-modal-title {
  1983. font-size: 36rpx;
  1984. font-weight: 700;
  1985. color: #1E293B;
  1986. }
  1987. .qr-code-modal-close {
  1988. font-size: 48rpx;
  1989. color: #94A3B8;
  1990. line-height: 1;
  1991. padding: 8rpx;
  1992. cursor: pointer;
  1993. }
  1994. .qr-code-modal-body {
  1995. display: flex;
  1996. flex-direction: column;
  1997. align-items: center;
  1998. gap: 32rpx;
  1999. }
  2000. .qr-code-image-container {
  2001. width: 280rpx;
  2002. height: 280rpx;
  2003. display: flex;
  2004. align-items: center;
  2005. justify-content: center;
  2006. background: #f9fafb;
  2007. border-radius: 16rpx;
  2008. padding: 20rpx;
  2009. }
  2010. .qr-code-image {
  2011. width: 100%;
  2012. height: 100%;
  2013. object-fit: contain;
  2014. }
  2015. .qr-code-referral-code {
  2016. display: flex;
  2017. align-items: center;
  2018. gap: 16rpx;
  2019. padding: 24rpx;
  2020. background: #f9fafb;
  2021. border-radius: 16rpx;
  2022. width: 100%;
  2023. box-sizing: border-box;
  2024. }
  2025. .qr-code-label {
  2026. font-size: 26rpx;
  2027. color: #64748b;
  2028. font-weight: 500;
  2029. }
  2030. .qr-code-code {
  2031. flex: 1;
  2032. font-size: 32rpx;
  2033. font-weight: 700;
  2034. color: #1E293B;
  2035. word-break: break-all;
  2036. letter-spacing: 2rpx;
  2037. }
  2038. .qr-code-copy {
  2039. font-size: 24rpx;
  2040. color: #F97316;
  2041. font-weight: 500;
  2042. padding: 8rpx 16rpx;
  2043. background: #fff;
  2044. border-radius: 8rpx;
  2045. border: 1px solid #F97316;
  2046. cursor: pointer;
  2047. }
  2048. .qr-code-copy:active {
  2049. opacity: 0.8;
  2050. }
  2051. /* 无家庭成员空状态引导卡 */
  2052. .empty-family-card {
  2053. display: flex;
  2054. flex-direction: column;
  2055. align-items: center;
  2056. margin: 20rpx 24rpx;
  2057. padding: 48rpx 30rpx;
  2058. background: #fff;
  2059. border-radius: 24rpx;
  2060. border: 2rpx dashed #FED7AA;
  2061. }
  2062. .empty-family-icon {
  2063. font-size: 88rpx;
  2064. margin-bottom: 16rpx;
  2065. }
  2066. .empty-family-title {
  2067. font-size: 34rpx;
  2068. font-weight: 600;
  2069. color: #9A3412;
  2070. margin-bottom: 10rpx;
  2071. }
  2072. .empty-family-desc {
  2073. font-size: 26rpx;
  2074. color: #999;
  2075. margin-bottom: 28rpx;
  2076. }
  2077. .empty-family-btn {
  2078. width: 320rpx;
  2079. height: 80rpx;
  2080. line-height: 80rpx;
  2081. font-size: 30rpx;
  2082. font-weight: 600;
  2083. color: #fff;
  2084. background: linear-gradient(135deg, #F97316, #FF8C42);
  2085. border-radius: 40rpx;
  2086. border: none;
  2087. }
  2088. .empty-family-btn::after {
  2089. border: none;
  2090. }
  2091. </style>