parent-index.vue 69 KB

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