index.vue 69 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204
  1. <template>
  2. <view>
  3. <!-- 冷启动 splash overlay — 覆盖首页直到数据加载完毕(tab 切回时不显示) -->
  4. <view class="splash-overlay" :class="{'fade-out': splashOverlayFading}" v-if="splashOverlay || splashOverlayFading">
  5. <view class="splash-overlay-bg">
  6. <view class="bg-circle bg-circle-1"></view>
  7. <view class="bg-circle bg-circle-2"></view>
  8. <view class="bg-circle bg-circle-3"></view>
  9. </view>
  10. <view class="splash-overlay-body">
  11. <view class="splash-logo-wrap">
  12. <image class="splash-logo-img" src="/static/logo.png" mode="aspectFit" />
  13. </view>
  14. <text class="splash-brand-name">浠艾福</text>
  15. <text class="splash-brand-en">Care Family</text>
  16. <view class="splash-dims-row">
  17. <view class="splash-dim-item">
  18. <view class="splash-dim-circle" style="background:rgba(255,140,66,0.3);"><text class="splash-dim-icon">🌏</text></view>
  19. <text class="splash-dim-label">身</text>
  20. </view>
  21. <view class="splash-dim-item">
  22. <view class="splash-dim-circle" style="background:rgba(255,107,157,0.3);"><text class="splash-dim-icon">🔥</text></view>
  23. <text class="splash-dim-label">心</text>
  24. </view>
  25. <view class="splash-dim-item">
  26. <view class="splash-dim-circle" style="background:rgba(99,102,241,0.3);"><text class="splash-dim-icon">⚡</text></view>
  27. <text class="splash-dim-label">智</text>
  28. </view>
  29. <view class="splash-dim-item">
  30. <view class="splash-dim-circle" style="background:rgba(16,185,129,0.3);"><text class="splash-dim-icon">🌿</text></view>
  31. <text class="splash-dim-label">行</text>
  32. </view>
  33. <view class="splash-dim-item">
  34. <view class="splash-dim-circle" style="background:rgba(245,158,11,0.3);"><text class="splash-dim-icon">💧</text></view>
  35. <text class="splash-dim-label">富</text>
  36. </view>
  37. </view>
  38. <text class="splash-tagline">给全家的一站式幸福提案</text>
  39. <view class="splash-overlay-loading">
  40. <view class="splash-overlay-dot"></view>
  41. <view class="splash-overlay-dot"></view>
  42. <view class="splash-overlay-dot"></view>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 登录态 — 直接内嵌,保持底签可见 -->
  47. <view v-if="currentRole" class="logged-in-container">
  48. <!-- ① 了解区 — 自测大卡(首屏,引导"从了解开始") -->
  49. <view class="self-test-card" @click="goSelfTest">
  50. <view class="self-test-head">
  51. <text class="self-test-icon">⚡</text>
  52. <view class="self-test-info">
  53. <text class="self-test-title">{{ selfTestTitle }}</text>
  54. <text class="self-test-sub">{{ selfTestSub }}</text>
  55. <text v-if="pendingSurveys.length > 0" class="self-test-badge">有 {{ pendingSurveys.length }} 项调研待填</text>
  56. </view>
  57. <text class="self-test-arrow">›</text>
  58. </view>
  59. </view>
  60. <!-- ② 发现区 — 能量沙盘 — Canvas 五行星图(未测评时显示引导卡) -->
  61. <GateLock v-if="sandboxLocked && sandboxLockGate" :gate="sandboxLockGate" />
  62. <WuxingSandbox
  63. v-else-if="sandboxData"
  64. mode="live"
  65. :scores="familySandboxScores"
  66. :overallScore="familySandboxOverall"
  67. :members="familySandboxMembers"
  68. :personalData="sandboxPersonalData"
  69. :dimensions="energyDimensions"
  70. :totalEnergy="totalEnergy"
  71. :totalHealthIndex="totalHealthIndex"
  72. :currentView="currentSandboxView"
  73. :familyUnlocked="familyUnlocked"
  74. :memberCount="familyMembersVisible.length"
  75. @view-change="onSandboxViewChange"
  76. showDimensionBar
  77. starHeight="480rpx" />
  78. <!-- ② 发现区 — 上传报告 -->
  79. <FamilyFeed
  80. :items="familyFeed"
  81. :notices="notices"
  82. :showHeader="true" />
  83. <!-- ④ 内容区 — 推荐文章 -->
  84. <view v-if="showMemberEntry" class="member-entry" @click="goMembership">
  85. <view class="member-entry-icon-wrap">
  86. <text class="member-entry-icon">👑</text>
  87. </view>
  88. <view class="member-entry-texts">
  89. <text class="member-entry-title">{{ memberEntryTitle }}</text>
  90. <text class="member-entry-desc">{{ memberEntryDesc }}</text>
  91. </view>
  92. <view class="member-entry-btn">
  93. <text class="member-entry-btn-text">{{ memberEntryBtn }}</text>
  94. </view>
  95. </view>
  96. <!-- ④ 内容区 — 快捷功能入口(单排) -->
  97. <view class="section">
  98. <view class="quick-bar">
  99. <view class="quick-item" @click="navTo('/pages/tasks/tasks')">
  100. <view class="quick-icon" style="background:rgba(99,102,241,0.15)"><text>📋</text></view>
  101. <text class="quick-label">任务</text>
  102. </view>
  103. <view class="quick-item" @click="navTo('/pages/action-detail/interaction-log')">
  104. <view class="quick-icon" style="background:rgba(16,185,129,0.15)"><text>💬</text></view>
  105. <text class="quick-label">互动</text>
  106. </view>
  107. <view class="quick-item" @click="navTo('/pages/mind-detail/family-dashboard')">
  108. <view class="quick-icon" style="background:rgba(139,92,246,0.15)"><text>🏠</text></view>
  109. <text class="quick-label">天盘</text>
  110. </view>
  111. <view class="quick-item" @click="navTo('/pages/profile-extra/family-members')">
  112. <view class="quick-icon" style="background:rgba(245,158,11,0.15)"><text>👨‍👩‍👧‍👦</text></view>
  113. <text class="quick-label">成员</text>
  114. </view>
  115. <view class="quick-item" @click="navTo('/pages/discover/circles')">
  116. <view class="quick-icon" style="background:rgba(255,107,157,0.15)"><text>🤝</text></view>
  117. <text class="quick-label">圈子</text>
  118. </view>
  119. <view class="quick-item" @click="navTo('/pages/shop/index/index')">
  120. <view class="quick-icon" style="background:rgba(249,115,22,0.15)"><text>🛒</text></view>
  121. <text class="quick-label">商城</text>
  122. </view>
  123. </view>
  124. </view>
  125. <!-- ④ 内容区 — 家庭动态 -->
  126. <view v-if="hasPendingTasks" class="section">
  127. <view class="section-header">
  128. <text class="section-title">📝 我的任务</text>
  129. <text class="section-more" @click="navTo('/pages/tasks/tasks')">全部 ›</text>
  130. </view>
  131. <view class="task-quick-list">
  132. <view
  133. v-for="task in pendingTasks"
  134. :key="task.id"
  135. class="task-quick-item"
  136. >
  137. <view class="task-quick-info">
  138. <text class="task-quick-title line-clamp-1">{{ task.title }}</text>
  139. <text class="task-quick-meta">+{{ task.points }}分</text>
  140. </view>
  141. <button class="btn-quick-complete" @click="quickCompleteTask(task)">完成</button>
  142. </view>
  143. </view>
  144. </view>
  145. <!-- ③ 行动区 — 家庭挑战任务 -->
  146. <view class="section">
  147. <view class="section-header">
  148. <text class="section-title">🔥 家庭挑战</text>
  149. <text class="section-more" @click="goChallengeManage">管理 ›</text>
  150. </view>
  151. <FamilyChallengeCard
  152. v-for="ch in activeChallenges"
  153. :key="ch.id"
  154. :challenge="ch"
  155. :showCheckin="showCheckinBtn"
  156. @checkin="onChallengeCheckin"
  157. @respond="onChallengeRespond" />
  158. <view v-if="activeChallenges.length === 0" class="challenge-empty">
  159. <text class="challenge-empty-icon">🏆</text>
  160. <text class="challenge-empty-text">您还没有挑战,去添加吧</text>
  161. <button class="challenge-add-btn" @click="goChallengeManage">去添加</button>
  162. </view>
  163. </view>
  164. <!-- ③ 行动区 — 会员入口:非会员显示开通 / 快到期显示续费 -->
  165. <DailyTaskCard />
  166. <!-- ③ 行动区 — 我的任务(仅当有待完成时显示) -->
  167. <view class="section">
  168. <ReportUploadCard
  169. title="上传报告"
  170. desc="体检报告 · 菌群检测 · 认知测评 · 心理测评 · 情绪打卡"
  171. :tags="['体检报告', '菌群检测', '认知测评', '心理测评', '情绪打卡']"
  172. @click="goToUploadReport" />
  173. </view>
  174. <!-- ③ 行动区 — 今日任务 -->
  175. <view class="section">
  176. <view class="section-header">
  177. <text class="section-title">📖 推荐阅读</text>
  178. <text class="section-more" @click="goMoreArticles">更多 ›</text>
  179. </view>
  180. <ArticleBookshelf
  181. :articles="actionArticles"
  182. :isLoggedIn="true"
  183. @articleClick="goArticleDetail" />
  184. </view>
  185. <!-- ④ 内容区 — 推荐商品 -->
  186. <view class="section">
  187. <view class="section-header">
  188. <text class="section-title">🛍️ 推荐商品</text>
  189. <text class="section-more" @click="goMoreProducts">更多 ›</text>
  190. </view>
  191. <DimensionProducts
  192. :isLoggedIn="true"
  193. :showMore="false"
  194. @productClick="goProductDetail" />
  195. </view>
  196. <!-- 底部占位 -->
  197. <view class="bottom-spacer" style="height: 40rpx;"></view>
  198. </view>
  199. <!-- 未登录态 — 发现页/引流内容,直接内嵌,不跳转 -->
  200. <view v-else class="discover-container">
  201. <!-- 品牌 Hero 区 -->
  202. <view class="hero-section">
  203. <image class="hero-logo" src="/static/logo.png" mode="aspectFit" />
  204. <text class="hero-name">浠艾福</text>
  205. <text class="hero-slogan">给全家的一站式主动健康方案</text>
  206. <text class="hero-powered">亿图腾科技出品</text>
  207. <view class="hero-dims">
  208. <view class="hero-dim"><text class="hero-dim-emoji">🌏</text><text class="hero-dim-label">身·根基</text></view>
  209. <view class="hero-dim"><text class="hero-dim-emoji">⚡</text><text class="hero-dim-label">智·赋能</text></view>
  210. <view class="hero-dim"><text class="hero-dim-emoji">💧</text><text class="hero-dim-label">富·创富</text></view>
  211. <view class="hero-dim"><text class="hero-dim-emoji">🌿</text><text class="hero-dim-label">行·和谐</text></view>
  212. <view class="hero-dim"><text class="hero-dim-emoji">🔥</text><text class="hero-dim-label">心·大爱</text></view>
  213. </view>
  214. </view>
  215. <!-- 主动健康闭环 -->
  216. <view class="section">
  217. <view class="section-header">
  218. <text class="section-title">🔄 主动健康闭环</text>
  219. </view>
  220. <view class="loop-cards">
  221. <view class="loop-card">
  222. <view class="loop-card-icon loop-icon-indigo"><text>🔍</text></view>
  223. <text class="loop-card-name">提前识别</text>
  224. <text class="loop-card-desc">AI 多维评估,绘制健康基线</text>
  225. </view>
  226. <view class="loop-card">
  227. <view class="loop-card-icon loop-icon-green"><text>🛡️</text></view>
  228. <text class="loop-card-name">风险管控</text>
  229. <text class="loop-card-desc">分级管控,不让隐患成问题</text>
  230. </view>
  231. <view class="loop-card">
  232. <view class="loop-card-icon loop-icon-amber"><text>⚡</text></view>
  233. <text class="loop-card-name">主动干预</text>
  234. <text class="loop-card-desc">任务与能量追踪,融入日常</text>
  235. </view>
  236. <view class="loop-card">
  237. <view class="loop-card-icon loop-icon-red"><text>📊</text></view>
  238. <text class="loop-card-name">效果评估</text>
  239. <text class="loop-card-desc">档案记录轨迹,数据持续优化</text>
  240. </view>
  241. </view>
  242. </view>
  243. <!-- 五维能量 -->
  244. <view class="section">
  245. <view class="section-header">
  246. <text class="section-title">🌐 五维能量 · 五行相生</text>
  247. </view>
  248. <view class="dims-cards">
  249. <view class="dims-card-row">
  250. <view class="dims-card-item">
  251. <text class="dims-card-emoji">🌏</text>
  252. <text class="dims-card-name">身 · 根基永固</text>
  253. <text class="dims-card-desc">精准营养 · 健康报告 · 体质调理</text>
  254. </view>
  255. <view class="dims-card-item">
  256. <text class="dims-card-emoji">⚡</text>
  257. <text class="dims-card-name">智 · 赋能未来</text>
  258. <text class="dims-card-desc">心智测评 · 素质培养 · 成长档案</text>
  259. </view>
  260. </view>
  261. <view class="dims-card-row">
  262. <view class="dims-card-item">
  263. <text class="dims-card-emoji">💧</text>
  264. <text class="dims-card-name">富 · 利他创富</text>
  265. <text class="dims-card-desc">创客生态 · 积分奖励</text>
  266. </view>
  267. <view class="dims-card-item">
  268. <text class="dims-card-emoji">🌿</text>
  269. <text class="dims-card-name">行 · 人际和谐</text>
  270. <text class="dims-card-desc">亲子关系 · 夫妻情感 · 社交人脉</text>
  271. </view>
  272. </view>
  273. <view class="dims-card-row">
  274. <view class="dims-card-item dims-card-item-full">
  275. <text class="dims-card-emoji">🔥</text>
  276. <text class="dims-card-name">心 · 大爱相随</text>
  277. <text class="dims-card-desc">情绪疏导 · 关系心理学</text>
  278. </view>
  279. </view>
  280. </view>
  281. </view>
  282. <!-- 五行沙盘预览 -->
  283. <wuxing-sandbox mode="preview" badgeText="登录查看完整报告" @point-click="handleLogin" />
  284. <!-- 活动/商品推荐 -->
  285. <view class="recommend-section">
  286. <view class="section-header">
  287. <text class="section-title">🔥 热门推荐</text>
  288. <text class="section-more" @click="goShop">查看更多 ›</text>
  289. </view>
  290. <scroll-view scroll-x enable-flex show-scrollbar="false" class="type-filter-scroll">
  291. <view
  292. v-for="item in typeList"
  293. :key="item.value"
  294. :class="['filter-chip', currentType === item.value ? 'active' : '']"
  295. @click="onTypeChange(item.value)"
  296. >
  297. {{ item.label }}
  298. </view>
  299. </scroll-view>
  300. <view v-if="loading" class="loading-state">
  301. <text class="loading-text">加载中...</text>
  302. </view>
  303. <view v-else-if="products.length === 0" class="empty-state">
  304. <text class="empty-text">暂无商品,去商城看看吧</text>
  305. </view>
  306. <view v-else class="product-grid">
  307. <view
  308. v-for="item in products"
  309. :key="item.id"
  310. class="product-card"
  311. @click="goDetail(item.id)"
  312. >
  313. <image class="product-cover" :src="getImageUrl(item.coverImage) || '/static/default-product.png'" mode="aspectFill" />
  314. <view class="product-info">
  315. <text class="product-name">{{ item.name }}</text>
  316. <view class="product-price-row">
  317. <text class="product-price" v-if="item.price && item.price > 0">¥{{ (item.price / 100).toFixed(0) }}</text>
  318. <text class="product-price-free" v-else>免费</text>
  319. </view>
  320. </view>
  321. </view>
  322. </view>
  323. </view>
  324. <!-- 热门活动(无条件展示) -->
  325. <view class="section">
  326. <view class="section-header">
  327. <text class="section-title">🔥 热门活动</text>
  328. <text class="section-more" @click="goActivities">查看更多 ›</text>
  329. </view>
  330. <view v-if="dimensionActivities.length === 0" class="empty-state" style="padding: 40rpx 0;">
  331. <text class="empty-text">暂无活动</text>
  332. </view>
  333. <view class="activity-list" v-else>
  334. <view class="activity-card" v-for="act in dimensionActivities" :key="act.id" @click="goActivityDetail(act)">
  335. <image class="activity-cover" :src="getImageUrl(act.coverImage) || '/static/default-activity.png'" mode="aspectFill" />
  336. <view class="activity-info">
  337. <text class="activity-name line-clamp-1">{{ act.title }}</text>
  338. <view class="activity-meta">
  339. <text class="activity-time">{{ act.startTime }}</text>
  340. </view>
  341. <view class="activity-bottom">
  342. <text class="activity-status" :class="'status-' + (act.status || 'upcoming')">{{ act.status === 'ongoing' ? '进行中' : act.status === 'ended' ? '已结束' : '即将开始' }}</text>
  343. <text class="activity-fee" v-if="act.price && act.price > 0">¥{{ (act.price / 100).toFixed(0) }}</text>
  344. <text class="activity-fee fee-free" v-else>免费</text>
  345. </view>
  346. </view>
  347. </view>
  348. </view>
  349. </view>
  350. <!-- 推荐阅读(无条件展示) -->
  351. <view class="section">
  352. <view class="section-header">
  353. <text class="section-title">📖 推荐阅读</text>
  354. <text class="section-more" @click="goArticles">更多 ›</text>
  355. </view>
  356. <view class="article-list">
  357. <view v-if="articlesLoading" class="loading-state" style="padding: 40rpx 0;">
  358. <text class="loading-text">加载中...</text>
  359. </view>
  360. <!-- 无数据时显示占位卡片 -->
  361. <template v-else-if="indexArticles.length === 0">
  362. <view class="article-card" v-for="(item, i) in [1,2,3]" :key="i">
  363. <view class="article-category" :style="{ background: gradientColors[(i-1) % gradientColors.length] }">
  364. <text class="article-category-text">推荐文章</text>
  365. </view>
  366. <text class="article-title">暂无推荐文章</text>
  367. <text class="article-summary">精彩内容即将上线,敬请期待</text>
  368. <view class="article-meta">
  369. <view class="meta-item">
  370. <text class="meta-icon">&#x1F4D6;</text>
  371. <text class="meta-text">0</text>
  372. </view>
  373. <text class="article-date">--</text>
  374. </view>
  375. </view>
  376. </template>
  377. <!-- 有数据时显示文章卡片 -->
  378. <template v-else>
  379. <view class="article-card" v-for="article in indexArticles" :key="article.id" @click="goArticleDetail(article.id)">
  380. <view class="article-category" :style="{ background: article.categoryColor }">
  381. <text class="article-category-text">{{ article.category }}</text>
  382. </view>
  383. <text class="article-title">{{ article.title }}</text>
  384. <text class="article-summary">{{ article.summary }}</text>
  385. <view class="article-meta">
  386. <view class="meta-item">
  387. <text class="meta-icon">&#x1F4D6;</text>
  388. <text class="meta-text">{{ article.views }}</text>
  389. </view>
  390. <text class="article-date">{{ article.date }}</text>
  391. </view>
  392. </view>
  393. </template>
  394. </view>
  395. </view>
  396. <!-- 底部登录按钮 -->
  397. <view class="login-footer">
  398. <button class="login-btn" @click="handleLogin">登录 / 注册</button>
  399. </view>
  400. <!-- 底部占位 -->
  401. <view style="height: 120rpx;"></view>
  402. </view>
  403. </view>
  404. </template>
  405. <script>
  406. import store from '../../store/index.js'
  407. import WuxingSandbox from '../../components/wuxing-sandbox.vue'
  408. import GateLock from '../../components/gate-lock.vue'
  409. import FamilyFeed from '../../components/FamilyFeed.vue'
  410. import DimensionProducts from '../../components/DimensionProducts.vue'
  411. import ArticleBookshelf from '../../components/ArticleBookshelf.vue'
  412. import FamilyChallengeCard from '../../components/FamilyChallengeCard.vue'
  413. import DailyTaskCard from '../../components/daily-task-card.vue'
  414. import ReportUploadCard from '../../components/report-upload-card.vue'
  415. import { acceptParentInvite, productList, getActivityList, getFeaturedArticles, getEnergySandbox, getEnergyOverview, getFamilyMemberList, getChallengeList, switchToFamilyMember, getMyMembership, updateChallengeProgress, respondChallenge, getTodayTasks, completeTask as completeTaskApi, getTodayParentTasks, completeParentTask as completeParentTaskApi, getTaskHistory, getNotices, getNotificationList, getSurveyStatus, getSelfCheckStatus, getReferralCode } from '../../utils/api.js'
  416. import nav from '../../utils/nav.js'
  417. import config from '@/config.js'
  418. import { parseDate } from '../../utils/format.js'
  419. export default {
  420. components: {
  421. WuxingSandbox,
  422. GateLock,
  423. FamilyFeed,
  424. DimensionProducts,
  425. ArticleBookshelf,
  426. FamilyChallengeCard,
  427. DailyTaskCard,
  428. ReportUploadCard,
  429. },
  430. data() {
  431. // 从 storage 预取登录态/角色,确保首次渲染即正确(WeChat 渲染层/逻辑层分离架构下 onLoad 执行前已渲染)
  432. var _token = uni.getStorageSync('token')
  433. var _currentRole = ''
  434. if (_token) {
  435. _currentRole = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || ''
  436. }
  437. // 冷启动标记(由 App.vue onLaunch 设置,仅在冷启动时存在)
  438. var _isFirstLaunch = (uni.getStorageSync('_showSplashOverlay') === '1')
  439. return {
  440. currentRole: _currentRole,
  441. // splash loading overlay(冷启动时展示,数据加载完关闭)
  442. splashOverlay: _isFirstLaunch,
  443. splashOverlayFading: false,
  444. _splashReady: false,
  445. _watchPageReadyDone: false,
  446. pendingSurveys: [],
  447. selfCheckScore: null,
  448. selfCheckLoading: false,
  449. typeList: [
  450. { label: '全部', value: '' },
  451. { label: '活动', value: 'activity' },
  452. { label: '课程', value: 'course' },
  453. { label: '实物', value: 'physical' },
  454. { label: '数字', value: 'digital' },
  455. { label: '服务', value: 'service' }
  456. ],
  457. currentType: '',
  458. products: [],
  459. loading: false,
  460. dimensionActivities: [],
  461. indexArticles: [],
  462. articlesLoading: false,
  463. gradientColors: [
  464. 'linear-gradient(135deg, #10B981, #34D399)',
  465. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  466. 'linear-gradient(135deg, #8B5CF6, #C084FC)',
  467. 'linear-gradient(135deg, #F97316, #FB923C)',
  468. 'linear-gradient(135deg, #6366F1, #818CF8)'
  469. ],
  470. // 登录态数据
  471. familyMembersVisible: [],
  472. // 接口数据是否已检查(避免"暂无数据"闪烁)
  473. childrenChecked: false,
  474. membersChecked: false,
  475. selectedMemberId: null,
  476. sandboxData: null,
  477. sandboxPersonalData: null,
  478. sandboxFamilyData: null,
  479. sandboxLocked: false,
  480. sandboxLockGate: null,
  481. currentSandboxView: 'personal',
  482. familyUnlocked: false,
  483. energyDimensions: [],
  484. totalEnergy: 0,
  485. totalHealthIndex: 0,
  486. articles: [],
  487. children: [],
  488. currentChildId: null,
  489. activeChallenges: [],
  490. pendingTasks: [],
  491. familyFeed: [],
  492. notices: [],
  493. loggedInInitDone: false,
  494. // 会员状态(沙盘下方会员入口使用)
  495. isMember: false,
  496. isLifetime: false,
  497. membershipDays: 0,
  498. // 分享邀请码
  499. referralCode: '',
  500. referralCodeLoaded: false
  501. }
  502. },
  503. computed: {
  504. isFamilyAdmin: function() {
  505. if (!this.familyMembersVisible || this.familyMembersVisible.length === 0) return false
  506. return this.familyMembersVisible[0].isAdmin === true
  507. },
  508. sandboxScores: function() {
  509. var d = this.sandboxData || {}
  510. return {
  511. body: d.bodyScore || 0,
  512. mind: d.mindScore || 0,
  513. wisdom: d.wisdomScore || 0,
  514. action: d.actionScore || 0,
  515. wealth: d.wealthScore || 0
  516. }
  517. },
  518. familySandboxScores: function() {
  519. var d = this.sandboxFamilyData || {}
  520. return {
  521. body: d.bodyScore || 0,
  522. mind: d.mindScore || 0,
  523. wisdom: d.wisdomScore || 0,
  524. action: d.actionScore || 0,
  525. wealth: d.wealthScore || 0
  526. }
  527. },
  528. familySandboxOverall: function() {
  529. return this.sandboxFamilyData ? (this.sandboxFamilyData.overallScore || 0) : 0
  530. },
  531. familySandboxMembers: function() {
  532. return this.sandboxFamilyData ? (this.sandboxFamilyData.members || []) : []
  533. },
  534. hasPendingTasks: function() {
  535. return (this.pendingTasks && this.pendingTasks.length > 0)
  536. },
  537. actionArticles: function() {
  538. if (!this.articles || this.articles.length === 0) return []
  539. return this.articles.slice(0, 5)
  540. },
  541. // 会员入口显示:非会员显示开通;会员剩余≤30天显示续费
  542. showMemberEntry: function() {
  543. if (!this.isLoggedIn()) return false
  544. if (this.isLifetime) return false
  545. if (!this.isMember) return true
  546. return this.membershipDays > 0 && this.membershipDays <= 30
  547. },
  548. showCheckinBtn: function() {
  549. return (uni.getStorageSync('role') || 'parent') === 'child'
  550. },
  551. memberEntryTitle: function() {
  552. if (this.isLifetime) return '终身会员 · 永久有效'
  553. if (!this.isMember) return '开通会员,解锁全部特权'
  554. return '会员即将到期,续费恢复权益'
  555. },
  556. memberEntryDesc: function() {
  557. if (this.isLifetime) return '享全平台权益,无需续费'
  558. if (!this.isMember) return '享专属折扣 · 成长服务 · 规划指导'
  559. return '剩余 ' + this.membershipDays + ' 天,续费保持权益不中断'
  560. },
  561. memberEntryBtn: function() {
  562. if (this.isLifetime) return '已拥有'
  563. return this.isMember ? '立即续费' : '立即开通'
  564. },
  565. // 自测大卡:已有数据(沙盘解锁)显示"再次了解",否则显示引导文案
  566. selfTestTitle: function() {
  567. return this.sandboxData ? '再次了解 · 看看变化' : '先花 1 分钟,了解全家健康状况'
  568. },
  569. selfTestSub: function() {
  570. if (this.sandboxData) {
  571. if (this.selfCheckScore != null) {
  572. return '最近自检得分 ' + this.selfCheckScore + '/45 分 · 点击查看'
  573. }
  574. return '最近综合得分 ' + (this.sandboxData.overallScore || 0) + ' 分 · 点击查看'
  575. }
  576. return '15 题五维自检 · 约 20 秒'
  577. }
  578. },
  579. onLoad(options) {
  580. this._onLoadFired = true
  581. this._doInit(options)
  582. },
  583. onShow() {
  584. // splash overlay 已在 data() 中根据 storage 标记初始化,此处只需配置关闭条件
  585. if (this.splashOverlay) {
  586. uni.removeStorageSync('_showSplashOverlay')
  587. this._splashLoadCount = 0
  588. this._splashMinPassed = false
  589. var self = this
  590. // 最低展示 800ms
  591. setTimeout(function() {
  592. self._splashMinPassed = true
  593. self._tryHideSplash()
  594. }, 800)
  595. // 最多展示 5s
  596. setTimeout(function() {
  597. if (self.splashOverlay) self._hideSplashOverlay()
  598. }, 5000)
  599. }
  600. // 首次加载:onLoad 已触发 _doInit,此处跳过避免重复调用
  601. // 后续 onShow(切 Tab 返回):刷新易变数据(会员状态、今日任务、挑战列表)
  602. if (this._onLoadFired) {
  603. this._onLoadFired = false // 清标记,后续 onShow 走刷新路径
  604. } else {
  605. this._refreshOnShow()
  606. }
  607. // 定期调研待办角标(内部自检登录态,未登录静默清空)
  608. this._loadSurveyBadge()
  609. },
  610. methods: {
  611. _checkSplashReady() {
  612. this._splashLoadCount++
  613. this._tryHideSplash()
  614. },
  615. _tryHideSplash() {
  616. if (this.splashOverlayFading) return
  617. if (!this._splashMinPassed) return
  618. if (this.isLoggedIn()) {
  619. // 登录用户:等待子组件的 ready 信号
  620. if (this._splashReady) this._hideSplashOverlay()
  621. } else {
  622. // 游客:等待 3 个 API 全部返回
  623. if (this._splashLoadCount >= 3) this._hideSplashOverlay()
  624. }
  625. },
  626. _hideSplashOverlay() {
  627. if (this.splashOverlayFading) return
  628. this.splashOverlayFading = true
  629. var self = this
  630. setTimeout(function() {
  631. self.splashOverlay = false
  632. self.splashOverlayFading = false
  633. }, 400)
  634. },
  635. // ===== 登录态数据加载 =====
  636. loadLoggedInData: function() {
  637. this.loadFamilyData()
  638. this.loadReferralCode()
  639. },
  640. // 合并原 loadFamilyMembers + loadChildren:仅调用一次 getFamilyMemberList
  641. loadFamilyData: function() {
  642. var self = this
  643. getFamilyMemberList({ visibleOnly: true }).then(function(res) {
  644. if (res.code === 200 && res.data) {
  645. var arr = Array.isArray(res.data) ? res.data : (res.data.list || [])
  646. self.familyMembersVisible = arr
  647. // 过滤出孩子成员(effectiveRole 为 'child' 的成员)
  648. self.children = arr.filter(function(m) { return m.effectiveRole === 'child' })
  649. var savedChildId = uni.getStorageSync('currentChildId')
  650. if (savedChildId) {
  651. self.currentChildId = savedChildId
  652. }
  653. self.loadDimensionData()
  654. }
  655. self.childrenChecked = true
  656. self.membersChecked = true
  657. self.loadTodayTasks()
  658. self.loadFamilyFeed()
  659. self.loadNotices()
  660. self.loadNotifications()
  661. }).catch(function(e) {
  662. console.log('获取家庭成员失败', e)
  663. self.familyMembersVisible = []
  664. self.children = []
  665. self.childrenChecked = true
  666. self.membersChecked = true
  667. })
  668. },
  669. // loadChildren 已废弃:loadFamilyData 统一调用 getFamilyMemberList 一次,
  670. // 从响应中过滤出 effectiveRole==='child' 的成员赋给 this.children。
  671. // 删除了原 loadChildren 方法(调用 getChildren 会重复打 /api/family/member/list)。
  672. loadDimensionData: function() {
  673. this.loadSandboxData()
  674. this.loadEnergyOverview()
  675. this.loadActionArticles()
  676. this.loadChallenges()
  677. this.loadSelfCheckStatus()
  678. },
  679. loadEnergyOverview: function() {
  680. var memberId = this.currentChildId || uni.getStorageSync('currentMemberId')
  681. if (!memberId) return
  682. var self = this
  683. getEnergyOverview(memberId).then(function(res) {
  684. if (res && res.data) {
  685. self.energyDimensions = res.data.dimensions || []
  686. self.totalEnergy = res.data.totalEnergy || 0
  687. self.totalHealthIndex = res.data.totalHealthIndex || 0
  688. }
  689. }).catch(function(e) {
  690. console.log('获取能量概览失败', e)
  691. })
  692. },
  693. loadSandboxData: function() {
  694. var self = this
  695. var memberId = uni.getStorageSync('currentMemberId') || uni.getStorageSync('currentChildId') || null
  696. getEnergySandbox(this.currentSandboxView, memberId).then(function(res) {
  697. if (res && res.data) {
  698. var d = res.data
  699. if (d.locked) {
  700. // 未解锁:显示引导卡(GateLock 渲染自检引导按钮)
  701. self.sandboxLocked = true
  702. self.sandboxLockGate = d.gate || null
  703. self.sandboxData = null
  704. self.sandboxPersonalData = null
  705. self.sandboxFamilyData = null
  706. } else {
  707. self.sandboxLocked = false
  708. self.sandboxLockGate = null
  709. self.sandboxPersonalData = d.personalData || null
  710. self.sandboxFamilyData = d.familyData || null
  711. self.sandboxData = self.currentSandboxView === 'family' ? (d.familyData || null) : (d.personalData || null)
  712. self.familyUnlocked = d.familyUnlocked || false
  713. }
  714. self._splashReady = true
  715. self._tryHideSplash()
  716. }
  717. }).catch(function() {})
  718. },
  719. /** 切换沙盘个人/全家视角(本地切换,不重新请求) */
  720. onSandboxViewChange: function(view) {
  721. if (view === this.currentSandboxView) return
  722. this.currentSandboxView = view
  723. this.sandboxData = view === 'family' ? (this.sandboxFamilyData || null) : (this.sandboxPersonalData || null)
  724. },
  725. loadActionArticles: function() {
  726. var self = this
  727. getFeaturedArticles({ size: 5 }).then(function(res) {
  728. if (res.code === 200 && res.data) {
  729. var gradientColors = [
  730. 'linear-gradient(135deg, #10B981, #34D399)',
  731. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  732. 'linear-gradient(135deg, #8B5CF6, #C084FC)',
  733. 'linear-gradient(135deg, #F97316, #FB923C)',
  734. 'linear-gradient(135deg, #6366F1, #818CF8)'
  735. ]
  736. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  737. self.articles = list.map(function(item, index) {
  738. return {
  739. id: item.id,
  740. category: item.categoryName || '行动社交',
  741. categoryColor: gradientColors[index % gradientColors.length],
  742. title: item.title || '',
  743. summary: item.summary || '',
  744. dimensionWeights: item.dimensionWeights || null,
  745. views: item.viewCount ? String(item.viewCount) : '0',
  746. likes: '0',
  747. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  748. relatedDimensions: self.parseRelatedDimensions(item.relatedDimensions),
  749. coverImage: item.coverImage
  750. }
  751. })
  752. }
  753. }).catch(function() {})
  754. },
  755. loadChallenges: function() {
  756. var self = this
  757. getChallengeList({}).then(function(res) {
  758. if (res.code === 200 && Array.isArray(res.data)) {
  759. self.activeChallenges = res.data
  760. }
  761. }).catch(function() {
  762. self.activeChallenges = []
  763. })
  764. },
  765. loadTodayTasks: function() {
  766. var self = this
  767. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || 'parent'
  768. // 家长:家庭维度拉取(方案任务可能挂在任意成员,不只是当前孩子)
  769. if (role === 'parent') {
  770. getTodayTasks(null, { familyWide: true }).then(function(res) {
  771. if (res.code === 200 && Array.isArray(res.data)) {
  772. self.pendingTasks = res.data.filter(function(t) {
  773. return t.status === 'pending'
  774. })
  775. }
  776. }).catch(function() {
  777. self.pendingTasks = []
  778. })
  779. return
  780. }
  781. if (!self.currentChildId) {
  782. self.pendingTasks = []
  783. return
  784. }
  785. getTodayTasks(self.currentChildId).then(function(res) {
  786. if (res.code === 200 && Array.isArray(res.data)) {
  787. self.pendingTasks = res.data.filter(function(t) {
  788. return t.status === 'pending'
  789. })
  790. }
  791. }).catch(function() {
  792. self.pendingTasks = []
  793. })
  794. },
  795. loadFamilyFeed: function() {
  796. var self = this
  797. // 仅对第一个孩子拉取任务历史(避免 N 个孩子 N 次 /api/tasks/history 请求)
  798. var children = (self.children || []).filter(function(m) { return m.effectiveRole === 'child' })
  799. if (children.length === 0) {
  800. self.familyFeed = []
  801. return
  802. }
  803. var child = children[0]
  804. getTaskHistory(child.id, 1, 3).then(function(res) {
  805. var tasks = []
  806. if (res.code === 200) {
  807. var data = res.data
  808. tasks = (data && data.records) ? data.records : (Array.isArray(data) ? data : [])
  809. }
  810. var feed = tasks.filter(function(t) { return t.status === 'completed' }).map(function(t) {
  811. var points = t.pointsEarned || t.points || 0
  812. var timeStr = ''
  813. if (t.completedAt && typeof t.completedAt === 'string') {
  814. timeStr = t.completedAt.substring(11, 16)
  815. }
  816. return {
  817. text: '✅ ' + (child.nickname || '小名') + ' 完成「' + (t.title || '任务') + '」 +' + points + '分',
  818. time: timeStr,
  819. type: 'task'
  820. }
  821. })
  822. self.familyFeed = feed.slice(0, 10)
  823. }).catch(function() {
  824. self.familyFeed = []
  825. })
  826. },
  827. loadNotices: function() {
  828. var self = this
  829. getNotices().then(function(res) {
  830. if (res.code === 200 && res.data) {
  831. var notices = res.data.map(function(n) {
  832. var timeStr = ''
  833. if (n.createdAt) {
  834. var d = parseDate(n.createdAt)
  835. if (d) {
  836. timeStr = (d.getMonth() + 1) + '月' + d.getDate() + '日'
  837. }
  838. }
  839. return {
  840. text: '📢 ' + n.title,
  841. time: timeStr,
  842. type: 'notice',
  843. notice: n
  844. }
  845. })
  846. self.notices = notices
  847. // 合并 notices 到 familyFeed(优先显示)
  848. self.familyFeed = notices.concat(self.familyFeed).slice(0, 10)
  849. }
  850. }).catch(function() {})
  851. },
  852. // W3: 用户通知入动态(未读优先显示在 familyFeed 顶部)
  853. loadNotifications: function() {
  854. var self = this
  855. getNotificationList().then(function(res) {
  856. if (res.code === 200 && res.data) {
  857. var notifications = res.data.map(function(n) {
  858. var timeStr = ''
  859. if (n.createdAt) {
  860. var d = parseDate(n.createdAt)
  861. if (d) {
  862. timeStr = (d.getMonth() + 1) + '月' + d.getDate() + '日'
  863. }
  864. }
  865. return {
  866. text: '📬 ' + n.title,
  867. time: timeStr,
  868. type: 'notification',
  869. unread: (n.isRead === 0),
  870. notice: n
  871. }
  872. })
  873. var unread = notifications.filter(function(n) { return n.unread })
  874. var read = notifications.filter(function(n) { return !n.unread })
  875. // 未读在前,已读在后,合并到 familyFeed 顶部
  876. self.familyFeed = unread.concat(read, self.familyFeed).slice(0, 10)
  877. }
  878. }).catch(function() {})
  879. },
  880. quickCompleteTask: function(task) {
  881. var self = this
  882. var memberId = (task && task.familyMemberId) || self.currentChildId || uni.getStorageSync('currentMemberId')
  883. completeTaskApi(task.id, memberId, '').then(function(res) {
  884. if (res.code === 200) {
  885. uni.showToast({ title: '获得 ' + (res.data && res.data.pointsEarned || 0) + ' 积分', icon: 'success' })
  886. self.loadTodayTasks()
  887. } else {
  888. uni.showToast({ title: (res && res.message) || '完成失败', icon: 'none' })
  889. }
  890. }).catch(function() {
  891. uni.showToast({ title: '完成失败,请重试', icon: 'none' })
  892. })
  893. },
  894. onChallengeCheckin: function(payload) {
  895. var self = this
  896. updateChallengeProgress({ challengeId: payload.challengeId, delta: 1 }).then(function(res) {
  897. if (res && res.code === 200) {
  898. uni.showToast({ title: '打卡成功', icon: 'success' })
  899. self.loadChallenges()
  900. } else {
  901. uni.showToast({ title: (res && res.message) || '打卡失败', icon: 'none' })
  902. }
  903. }).catch(function() {
  904. uni.showToast({ title: '打卡失败,请重试', icon: 'none' })
  905. })
  906. },
  907. onChallengeRespond: function(payload) {
  908. var self = this
  909. respondChallenge({ challengeId: payload.challengeId, action: payload.action }).then(function(res) {
  910. if (res && res.code === 200) {
  911. uni.showToast({ title: payload.action === 'agree' ? '已同意' : '已拒绝', icon: 'success' })
  912. self.loadChallenges()
  913. } else {
  914. uni.showToast({ title: (res && res.message) || '操作失败', icon: 'none' })
  915. self.loadChallenges()
  916. }
  917. }).catch(function() {
  918. uni.showToast({ title: '操作失败,请重试', icon: 'none' })
  919. })
  920. },
  921. // loadFamilyMembers 已合并到 loadFamilyData(避免重复调用 /api/family/member/list)
  922. parseRelatedDimensions: function(val) {
  923. if (!val) return []
  924. if (Array.isArray(val)) return val
  925. if (typeof val === 'string') {
  926. try {
  927. var parsed = JSON.parse(val)
  928. return Array.isArray(parsed) ? parsed : []
  929. } catch (e) {
  930. return val.split(',').map(function(s) { return s.trim() }).filter(function(s) { return s })
  931. }
  932. }
  933. return []
  934. },
  935. onFamilyMemberSelect: function(member) {
  936. this.selectedMemberId = member.id
  937. },
  938. onFamilyMemberSwitch: function(member) {
  939. var self = this
  940. if (!member || !member.id) return
  941. switchToFamilyMember(member.id, member.source || 'family_member').then(function(res) {
  942. if (res.code === 200 && res.data) {
  943. store.commit('switchToMember', {
  944. memberId: res.data.memberId,
  945. effectiveRole: res.data.effectiveRole
  946. })
  947. uni.showToast({ title: '已切换到' + (member.nickname || '该成员'), icon: 'success' })
  948. setTimeout(function() {
  949. uni.reLaunch({ url: '/pages/index-home/index' })
  950. }, 1000)
  951. } else {
  952. uni.showToast({ title: res.message || '切换失败', icon: 'none' })
  953. }
  954. }).catch(function() {
  955. uni.showToast({ title: '切换失败', icon: 'none' })
  956. })
  957. },
  958. navTo: function(url) {
  959. nav.goPage(url)
  960. },
  961. goActivityDetail: function(act) {
  962. if (!act || !act.id) return
  963. uni.navigateTo({ url: '/pages/activity/activity-detail/activity-detail?id=' + act.id })
  964. },
  965. goMoreActivities: function() {
  966. uni.navigateTo({ url: '/pages/activity/index' })
  967. },
  968. goProductDetail: function(prod) {
  969. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + prod.id })
  970. },
  971. goMoreProducts: function() {
  972. uni.navigateTo({ url: '/pages/shop/index/index' })
  973. },
  974. goArticleDetail: function(article) {
  975. var id = article.id || article
  976. uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
  977. },
  978. goMoreArticles: function() {
  979. uni.navigateTo({ url: '/pages/article-center/index' })
  980. },
  981. goToUploadReport: function() {
  982. var id = this.currentChildId || ''
  983. uni.navigateTo({ url: '/pages/health/report-upload?memberId=' + id + '&from=index' })
  984. },
  985. // 定期调研待办角标(内部自检登录态,未登录静默清空)
  986. _loadSurveyBadge: function() {
  987. var self = this
  988. if (!this.isLoggedIn()) { self.pendingSurveys = []; return }
  989. getSurveyStatus({}).then(function(res) {
  990. var list = (res && res.code === 200 && res.data && res.data instanceof Array) ? res.data : []
  991. var pending = []
  992. for (var i = 0; i < list.length; i++) {
  993. if (list[i] && list[i].status === 'pending') pending.push(list[i])
  994. }
  995. self.pendingSurveys = pending
  996. }).catch(function() { self.pendingSurveys = [] })
  997. },
  998. goSelfTest: function() {
  999. var firstPending = null
  1000. for (var i = 0; i < this.pendingSurveys.length; i++) {
  1001. var s = this.pendingSurveys[i]
  1002. if (s && s.templateId) { firstPending = s; break }
  1003. }
  1004. if (firstPending) {
  1005. var url = '/pages/health/survey-questionnaire?templateId=' + firstPending.templateId +
  1006. '&templateTitle=' + encodeURIComponent(firstPending.title || '定期调研') +
  1007. '&templateDimension=' + encodeURIComponent(firstPending.dimension || '') +
  1008. '&periodStart=' + (firstPending.periodStart || '') +
  1009. '&periodEnd=' + (firstPending.periodEnd || '')
  1010. uni.navigateTo({ url: url })
  1011. } else {
  1012. // 无待填调研 → 进入五维自检中间页
  1013. uni.navigateTo({ url: '/pages/family/self-check-entry' })
  1014. }
  1015. },
  1016. loadSelfCheckStatus: function() {
  1017. var self = this
  1018. getSelfCheckStatus().then(function(res) {
  1019. if (res.code === 200 && res.data && res.data.lastResult) {
  1020. self.selfCheckScore = res.data.lastResult.totalScore
  1021. }
  1022. }).catch(function() {})
  1023. },
  1024. _doInit(options) {
  1025. options = options || {}
  1026. if (!this.isLoggedIn()) {
  1027. this.currentRole = ''
  1028. this.loadProducts()
  1029. this.loadDimensionActivities()
  1030. this.loadFeaturedArticles()
  1031. return
  1032. }
  1033. this.syncRoleAndTabBar()
  1034. if (options.inviteCode && options.type === 'parent_invite') {
  1035. this.handleParentInvite(options.inviteCode)
  1036. return
  1037. }
  1038. var storedCode = uni.getStorageSync('inviteCode')
  1039. var storedType = uni.getStorageSync('inviteType')
  1040. if (storedCode && storedType === 'parent_invite') {
  1041. this.handleParentInvite(storedCode)
  1042. uni.removeStorageSync('inviteCode')
  1043. uni.removeStorageSync('inviteType')
  1044. return
  1045. }
  1046. // 登录用户:直接在 TabBar 页面内联渲染,保持底签可见
  1047. if (!this.loggedInInitDone) {
  1048. // 首次加载:全量初始化(数据 + 会员状态),onShow 不再重复
  1049. this.loggedInInitDone = true
  1050. this.loadLoggedInData()
  1051. this.checkMemberStatus()
  1052. }
  1053. this._watchPageReady()
  1054. },
  1055. _refreshOnShow() {
  1056. // 切 Tab 返回:刷新家庭成员 + 沙盘 + 会员状态(loadFamilyData 内含任务/挑战刷新)
  1057. if (!this.isLoggedIn()) return
  1058. this.checkMemberStatus()
  1059. this.loadFamilyData()
  1060. },
  1061. _watchPageReady() {
  1062. if (this._watchPageReadyDone) return
  1063. this._watchPageReadyDone = true
  1064. var that = this
  1065. that.$watch('_splashReady', function(newVal) {
  1066. if (newVal) that._tryHideSplash()
  1067. })
  1068. },
  1069. isLoggedIn() {
  1070. return !!uni.getStorageSync('token')
  1071. },
  1072. // ===== 会员状态(沙盘下方会员入口) =====
  1073. checkMemberStatus: function() {
  1074. var that = this
  1075. getMyMembership().then(function(res) {
  1076. var m = res.data || {}
  1077. var level = m.memberLevel || m.levelCode || ''
  1078. that.isLifetime = (level === 'LIFETIME')
  1079. that.isMember = that.isLifetime || !!(level && level !== 'FREE')
  1080. var mem = m.membership || m
  1081. if (mem.daysRemaining != null) {
  1082. that.membershipDays = mem.daysRemaining
  1083. } else if (that.isLifetime) {
  1084. // 终身会员:永久有效,不显示剩余天数
  1085. that.membershipDays = 0
  1086. }
  1087. }).catch(function() {})
  1088. },
  1089. goMembership: function() {
  1090. uni.navigateTo({ url: '/pages/membership/upgrade' })
  1091. },
  1092. normalizeCurrentRole() {
  1093. const role = uni.getStorageSync('role') || 'parent'
  1094. const currentRole = uni.getStorageSync('currentRole')
  1095. if (!currentRole) {
  1096. return role
  1097. }
  1098. // 非规划师账号不允许落到规划师首页
  1099. if (currentRole === 'teacher' && role !== 'teacher') {
  1100. return role
  1101. }
  1102. // 只有家长账号允许切换到孩子视角
  1103. if (currentRole === 'child' && role !== 'parent') {
  1104. return role
  1105. }
  1106. return currentRole
  1107. },
  1108. syncRoleAndTabBar() {
  1109. this.currentRole = this.normalizeCurrentRole()
  1110. uni.setStorageSync('currentRole', this.currentRole)
  1111. },
  1112. // ===== 发现页 / 未登录态方法 =====
  1113. loadProducts: function() {
  1114. this.loading = true
  1115. var params = { page: 1, size: 10 }
  1116. if (this.currentType) {
  1117. params.productType = this.currentType
  1118. }
  1119. var self = this
  1120. productList(params).then(function(res) {
  1121. self.loading = false
  1122. if (res && res.code === 200) {
  1123. // res.data is the response wrapper, products are in res.data.data or res.data.records
  1124. var rawData = res.data && (Array.isArray(res.data) ? res.data : (res.data.data || res.data.records || []))
  1125. self.products = Array.isArray(rawData) ? rawData : []
  1126. }
  1127. self._checkSplashReady()
  1128. }).catch(function() {
  1129. self.loading = false
  1130. self._checkSplashReady()
  1131. })
  1132. },
  1133. loadDimensionActivities: function() {
  1134. var self = this
  1135. getActivityList({ dimensionCode: '', page: 1, size: 3 }).then(function(res) {
  1136. if (res && res.code === 200) {
  1137. // res.data is the response wrapper, activities are in res.data.data or res.data.records
  1138. var rawData = res.data && (Array.isArray(res.data) ? res.data : (res.data.data || res.data.records || []))
  1139. self.dimensionActivities = Array.isArray(rawData) ? rawData.slice(0, 3) : []
  1140. }
  1141. self._checkSplashReady()
  1142. }).catch(function() {
  1143. self._checkSplashReady()
  1144. })
  1145. },
  1146. loadFeaturedArticles: function() {
  1147. var self = this
  1148. this.articlesLoading = true
  1149. getFeaturedArticles({ size: 5 }).then(function(res) {
  1150. self.articlesLoading = false
  1151. if (res && res.code === 200) {
  1152. var gradientColors = [
  1153. 'linear-gradient(135deg, #10B981, #34D399)',
  1154. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  1155. 'linear-gradient(135deg, #8B5CF6, #C084FC)',
  1156. 'linear-gradient(135deg, #F97316, #FB923C)',
  1157. 'linear-gradient(135deg, #6366F1, #818CF8)'
  1158. ]
  1159. // res.data is the response wrapper, articles are in res.data.data
  1160. var rawList = res.data && (Array.isArray(res.data) ? res.data : (res.data.data || res.data.records || []))
  1161. var list = Array.isArray(rawList) ? rawList : []
  1162. self.indexArticles = list.map(function(item, index) {
  1163. return {
  1164. id: item.id,
  1165. category: item.categoryName || item.category || '热门文章',
  1166. categoryColor: gradientColors[index % gradientColors.length],
  1167. title: item.title || '',
  1168. summary: item.summary || '',
  1169. views: item.viewCount ? String(item.viewCount) : '0',
  1170. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  1171. coverImage: item.coverImage
  1172. }
  1173. })
  1174. }
  1175. self._checkSplashReady()
  1176. }).catch(function() {
  1177. self.articlesLoading = false
  1178. self._checkSplashReady()
  1179. })
  1180. },
  1181. goActivities: function() {
  1182. uni.navigateTo({ url: '/pages/activity/index' })
  1183. },
  1184. goChallengeManage: function() {
  1185. uni.navigateTo({ url: '/pages/health/challenge-manage' })
  1186. },
  1187. goArticles: function() {
  1188. uni.navigateTo({ url: '/pages/mind-detail/articles' })
  1189. },
  1190. goArticleDetail: function(article) {
  1191. var id = article && article.id ? article.id : article
  1192. uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
  1193. },
  1194. onTypeChange(value) {
  1195. this.currentType = value
  1196. this.loadProducts()
  1197. },
  1198. goShop() {
  1199. uni.navigateTo({ url: '/pages/shop/index/index' })
  1200. },
  1201. goDetail(id) {
  1202. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + id })
  1203. },
  1204. handleLogin() {
  1205. uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/index-home/index') })
  1206. },
  1207. async handleParentInvite(code) {
  1208. // 延迟显示,等待登录完成
  1209. setTimeout(async () => {
  1210. const hasToken = uni.getStorageSync('token')
  1211. if (!hasToken) {
  1212. // 未登录,先去登录
  1213. uni.reLaunch({
  1214. url: '/pages/login/login?inviteCode=' + code
  1215. })
  1216. return
  1217. }
  1218. // 已登录,显示确认框
  1219. uni.showModal({
  1220. title: '加入家庭',
  1221. content: '您已被邀请加入家庭,是否接受?',
  1222. success: async (res) => {
  1223. if (res.confirm) {
  1224. try {
  1225. uni.showLoading({ title: '加入中...' })
  1226. const result = await acceptParentInvite(code)
  1227. uni.hideLoading()
  1228. if (result.code === 200) {
  1229. const { role, token } = result.data
  1230. uni.setStorageSync('role', role)
  1231. uni.setStorageSync('token', token)
  1232. uni.showToast({ title: '加入成功', icon: 'success' })
  1233. // 刷新页面
  1234. setTimeout(() => {
  1235. uni.switchTab({ url: '/pages/index-home/index' })
  1236. }, 1500)
  1237. }
  1238. } catch (e) {
  1239. uni.hideLoading()
  1240. uni.showToast({ title: e.message || '加入失败', icon: 'none' })
  1241. }
  1242. }
  1243. }
  1244. })
  1245. }, 500)
  1246. },
  1247. /** 获取自己的邀请码用于分享 */
  1248. loadReferralCode: function() {
  1249. if (this.referralCodeLoaded || !this.isLoggedIn()) return
  1250. var self = this
  1251. getReferralCode().then(function(res) {
  1252. if (res && res.code === 200 && res.data) {
  1253. self.referralCode = res.data.referralCode || res.data.code || ''
  1254. }
  1255. }).catch(function() {})
  1256. self.referralCodeLoaded = true
  1257. },
  1258. getImageUrl: function(path) {
  1259. return config.API_BASE_URL + path
  1260. },
  1261. /** 转发给朋友/群 */
  1262. onShareAppMessage: function() {
  1263. var path = '/pages/index-home/index'
  1264. if (this.referralCode) {
  1265. path = path + '?inviteCode=' + this.referralCode
  1266. }
  1267. return {
  1268. title: '浠艾福 · 家庭五维幸福成长',
  1269. path: path,
  1270. imageUrl: '/static/share-cover.png'
  1271. }
  1272. },
  1273. /** 分享到朋友圈 */
  1274. onShareTimeline: function() {
  1275. var query = ''
  1276. if (this.referralCode) {
  1277. query = 'inviteCode=' + this.referralCode
  1278. }
  1279. return {
  1280. title: '浠艾福 · 家庭五维幸福成长',
  1281. query: query,
  1282. imageUrl: '/static/share-cover.png'
  1283. }
  1284. }
  1285. }
  1286. }
  1287. </script>
  1288. <style>
  1289. .discover-container {
  1290. min-height: 100vh;
  1291. background: #f5f7fa;
  1292. padding-bottom: 100rpx;
  1293. }
  1294. /* ===== 品牌 Hero 区 ===== */
  1295. .hero-section {
  1296. margin: 24rpx 30rpx 0;
  1297. padding: 40rpx 32rpx;
  1298. background: linear-gradient(160deg, #FFF7ED 0%, #FED7AA 60%, rgba(249,115,22,0.15) 100%);
  1299. border-radius: 24rpx;
  1300. text-align: center;
  1301. border: 1rpx solid rgba(249,115,22,0.12);
  1302. }
  1303. .hero-logo {
  1304. width: 100rpx;
  1305. height: 100rpx;
  1306. border-radius: 50rpx;
  1307. background: #fff;
  1308. box-shadow: 0 8rpx 24rpx rgba(249,115,22,0.18);
  1309. }
  1310. .hero-name {
  1311. display: block;
  1312. font-size: 48rpx;
  1313. font-weight: bold;
  1314. color: #7C2D12;
  1315. margin-top: 16rpx;
  1316. letter-spacing: 6rpx;
  1317. }
  1318. .hero-slogan {
  1319. display: block;
  1320. font-size: 26rpx;
  1321. color: #9A3412;
  1322. margin-top: 8rpx;
  1323. font-weight: 500;
  1324. }
  1325. .hero-powered {
  1326. display: block;
  1327. font-size: 20rpx;
  1328. color: rgba(124,45,18,0.45);
  1329. margin-top: 10rpx;
  1330. }
  1331. .hero-dims {
  1332. display: flex;
  1333. justify-content: center;
  1334. gap: 16rpx;
  1335. margin-top: 28rpx;
  1336. flex-wrap: wrap;
  1337. }
  1338. .hero-dim {
  1339. display: flex;
  1340. flex-direction: column;
  1341. align-items: center;
  1342. gap: 6rpx;
  1343. padding: 12rpx 16rpx;
  1344. background: rgba(255,255,255,0.7);
  1345. border-radius: 16rpx;
  1346. }
  1347. .hero-dim-emoji {
  1348. font-size: 32rpx;
  1349. }
  1350. .hero-dim-label {
  1351. font-size: 20rpx;
  1352. color: #7C2D12;
  1353. font-weight: 500;
  1354. white-space: nowrap;
  1355. }
  1356. /* ===== 主动健康闭环 ===== */
  1357. .loop-cards {
  1358. display: flex;
  1359. flex-wrap: wrap;
  1360. justify-content: center;
  1361. gap: 16rpx;
  1362. margin: 20rpx 30rpx;
  1363. }
  1364. .loop-card {
  1365. width: 47%;
  1366. background: #fff;
  1367. border-radius: 20rpx;
  1368. padding: 24rpx 20rpx;
  1369. text-align: center;
  1370. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1371. border: 1rpx solid #F3F4F6;
  1372. }
  1373. .loop-card-icon {
  1374. width: 72rpx;
  1375. height: 72rpx;
  1376. border-radius: 50%;
  1377. display: inline-flex;
  1378. align-items: center;
  1379. justify-content: center;
  1380. font-size: 34rpx;
  1381. margin-bottom: 12rpx;
  1382. }
  1383. .loop-icon-indigo { background: rgba(99,102,241,0.15); }
  1384. .loop-icon-green { background: rgba(16,185,129,0.15); }
  1385. .loop-icon-amber { background: rgba(245,158,11,0.15); }
  1386. .loop-icon-red { background: rgba(239,68,68,0.15); }
  1387. .loop-card-name {
  1388. display: block;
  1389. font-size: 28rpx;
  1390. font-weight: bold;
  1391. color: #1F2937;
  1392. margin-bottom: 6rpx;
  1393. }
  1394. .loop-card-desc {
  1395. display: block;
  1396. font-size: 22rpx;
  1397. color: #6B7280;
  1398. line-height: 1.5;
  1399. }
  1400. /* ===== 五维能量 ===== */
  1401. .dims-cards {
  1402. display: flex;
  1403. flex-direction: column;
  1404. gap: 16rpx;
  1405. margin: 20rpx 30rpx;
  1406. }
  1407. .dims-card-row {
  1408. display: flex;
  1409. flex-wrap: wrap;
  1410. gap: 16rpx;
  1411. }
  1412. .dims-card-item {
  1413. flex: 1;
  1414. min-width: 280rpx;
  1415. background: #fff;
  1416. border-radius: 20rpx;
  1417. padding: 24rpx 20rpx;
  1418. text-align: center;
  1419. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1420. border: 1rpx solid #F3F4F6;
  1421. }
  1422. .dims-card-item-full {
  1423. flex-basis: 100%;
  1424. }
  1425. .dims-card-emoji {
  1426. display: block;
  1427. font-size: 44rpx;
  1428. margin-bottom: 10rpx;
  1429. }
  1430. .dims-card-name {
  1431. display: block;
  1432. font-size: 28rpx;
  1433. font-weight: bold;
  1434. color: #1F2937;
  1435. margin-bottom: 6rpx;
  1436. }
  1437. .dims-card-desc {
  1438. display: block;
  1439. font-size: 22rpx;
  1440. color: #6B7280;
  1441. line-height: 1.5;
  1442. }
  1443. /* ===== 品牌定位语(保留旧样式,不再使用) ===== */
  1444. .brand-strap {
  1445. margin: 16rpx 30rpx 0;
  1446. padding: 20rpx 28rpx;
  1447. background: linear-gradient(135deg, #FFF7ED, rgba(249,115,22,0.10));
  1448. border-radius: 16rpx;
  1449. border-left: 4rpx solid #F97316;
  1450. }
  1451. .brand-strap-text {
  1452. font-size: 26rpx;
  1453. color: #9A3412;
  1454. font-weight: 500;
  1455. }
  1456. /* ===== 会员入口卡(能量沙盘下方) ===== */
  1457. .member-entry {
  1458. display: flex;
  1459. align-items: center;
  1460. margin: 20rpx 30rpx 0;
  1461. background: linear-gradient(135deg, #F97316, #FB923C);
  1462. border-radius: 20rpx;
  1463. padding: 24rpx 30rpx;
  1464. }
  1465. .member-entry-icon-wrap {
  1466. width: 64rpx;
  1467. height: 64rpx;
  1468. border-radius: 50%;
  1469. background: rgba(255,255,255,0.2);
  1470. display: flex;
  1471. align-items: center;
  1472. justify-content: center;
  1473. margin-right: 16rpx;
  1474. flex-shrink: 0;
  1475. }
  1476. .member-entry-icon {
  1477. font-size: 36rpx;
  1478. }
  1479. .member-entry-texts {
  1480. flex: 1;
  1481. display: flex;
  1482. flex-direction: column;
  1483. min-width: 0;
  1484. }
  1485. .member-entry-title {
  1486. font-size: 30rpx;
  1487. font-weight: bold;
  1488. color: #fff;
  1489. }
  1490. .member-entry-desc {
  1491. font-size: 22rpx;
  1492. color: rgba(255,255,255,0.85);
  1493. margin-top: 4rpx;
  1494. overflow: hidden;
  1495. text-overflow: ellipsis;
  1496. white-space: nowrap;
  1497. }
  1498. .member-entry-btn {
  1499. margin-left: 16rpx;
  1500. padding: 10rpx 24rpx;
  1501. background: #fff;
  1502. border-radius: 30rpx;
  1503. flex-shrink: 0;
  1504. }
  1505. .member-entry-btn-text {
  1506. font-size: 24rpx;
  1507. color: #F97316;
  1508. font-weight: bold;
  1509. }
  1510. /* ===== 推荐 ===== */
  1511. .recommend-section {
  1512. margin: 20rpx 30rpx;
  1513. }
  1514. .type-filter-scroll {
  1515. white-space: nowrap;
  1516. margin-bottom: 20rpx;
  1517. }
  1518. .filter-chip {
  1519. display: inline-block;
  1520. padding: 8rpx 24rpx;
  1521. font-size: 24rpx;
  1522. color: #666;
  1523. background: #f0f0f0;
  1524. border-radius: 30rpx;
  1525. margin-right: 16rpx;
  1526. }
  1527. .filter-chip.active {
  1528. background: #5B9BD5;
  1529. color: #fff;
  1530. }
  1531. .loading-state,
  1532. .empty-state {
  1533. display: flex;
  1534. justify-content: center;
  1535. padding: 60rpx 0;
  1536. }
  1537. .loading-text,
  1538. .empty-text {
  1539. font-size: 26rpx;
  1540. color: #999;
  1541. }
  1542. .product-grid {
  1543. display: flex;
  1544. flex-wrap: wrap;
  1545. justify-content: space-between;
  1546. }
  1547. .product-card {
  1548. width: 48%;
  1549. background: #fff;
  1550. border-radius: 16rpx;
  1551. overflow: hidden;
  1552. margin-bottom: 20rpx;
  1553. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  1554. }
  1555. .product-cover {
  1556. width: 100%;
  1557. height: 200rpx;
  1558. background: #f0f0f0;
  1559. }
  1560. .product-info {
  1561. padding: 14rpx;
  1562. }
  1563. .product-name {
  1564. display: block;
  1565. font-size: 26rpx;
  1566. color: #333;
  1567. margin-bottom: 10rpx;
  1568. overflow: hidden;
  1569. text-overflow: ellipsis;
  1570. white-space: nowrap;
  1571. }
  1572. .product-price-row {
  1573. display: flex;
  1574. align-items: baseline;
  1575. }
  1576. .product-price {
  1577. font-size: 28rpx;
  1578. color: #5B9BD5;
  1579. font-weight: bold;
  1580. margin-right: 10rpx;
  1581. }
  1582. .product-price-login {
  1583. font-size: 24rpx;
  1584. color: #999;
  1585. }
  1586. .product-member {
  1587. font-size: 20rpx;
  1588. color: #999;
  1589. }
  1590. /* ===== 五维全景幸福矩阵 ===== */
  1591. /* ===== 底部登录 ===== */
  1592. .login-footer {
  1593. margin: 40rpx 30rpx;
  1594. display: flex;
  1595. flex-direction: column;
  1596. align-items: center;
  1597. }
  1598. .login-btn {
  1599. width: 100%;
  1600. height: 88rpx;
  1601. line-height: 88rpx;
  1602. background: linear-gradient(135deg, #F97316, #FB923C);
  1603. color: #fff;
  1604. font-size: 32rpx;
  1605. font-weight: bold;
  1606. border-radius: 44rpx;
  1607. text-align: center;
  1608. border: none;
  1609. box-shadow: 0 8rpx 24rpx rgba(249,115,22,0.3);
  1610. }
  1611. .login-btn::after {
  1612. border: none;
  1613. }
  1614. .login-footer-text {
  1615. font-size: 22rpx;
  1616. color: #F97316;
  1617. margin-top: 16rpx;
  1618. font-weight: 500;
  1619. }
  1620. /* ===== 加载占位 ===== */
  1621. .loading-container {
  1622. display: flex;
  1623. justify-content: center;
  1624. align-items: center;
  1625. height: 100vh;
  1626. }
  1627. /* ===== 角色切换淡入淡出 ===== */
  1628. .role-switch-wrapper {
  1629. width: 100%;
  1630. min-height: 100vh;
  1631. }
  1632. .fade-enter-active,
  1633. .fade-leave-active {
  1634. transition: opacity 0.3s ease;
  1635. }
  1636. .fade-enter,
  1637. .fade-leave-to {
  1638. opacity: 0;
  1639. }
  1640. /* ===== 通用区块样式 ===== */
  1641. .section {
  1642. margin: 20rpx 30rpx;
  1643. }
  1644. .section-header {
  1645. display: flex;
  1646. justify-content: space-between;
  1647. align-items: center;
  1648. margin-bottom: 20rpx;
  1649. }
  1650. .section-title {
  1651. font-size: 30rpx;
  1652. font-weight: bold;
  1653. color: #333;
  1654. }
  1655. .section-more {
  1656. font-size: 24rpx;
  1657. color: #5B9BD5;
  1658. }
  1659. .empty-state {
  1660. display: flex;
  1661. justify-content: center;
  1662. padding: 60rpx 0;
  1663. }
  1664. .empty-text {
  1665. font-size: 26rpx;
  1666. color: #999;
  1667. }
  1668. /* ===== 活动列表 ===== */
  1669. .activity-list {
  1670. display: flex;
  1671. flex-direction: column;
  1672. gap: 16rpx;
  1673. }
  1674. .activity-card {
  1675. background: #fff;
  1676. border-radius: 16rpx;
  1677. overflow: hidden;
  1678. display: flex;
  1679. flex-direction: row;
  1680. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1681. }
  1682. .activity-card:active {
  1683. opacity: 0.8;
  1684. }
  1685. .activity-cover {
  1686. width: 200rpx;
  1687. height: 160rpx;
  1688. flex-shrink: 0;
  1689. background: #f0f0f0;
  1690. }
  1691. .activity-info {
  1692. flex: 1;
  1693. padding: 16rpx;
  1694. display: flex;
  1695. flex-direction: column;
  1696. justify-content: space-between;
  1697. }
  1698. .activity-name {
  1699. font-size: 28rpx;
  1700. font-weight: bold;
  1701. color: #333;
  1702. margin-bottom: 8rpx;
  1703. }
  1704. .line-clamp-1 {
  1705. overflow: hidden;
  1706. text-overflow: ellipsis;
  1707. white-space: nowrap;
  1708. }
  1709. .activity-meta {
  1710. display: flex;
  1711. align-items: center;
  1712. margin-bottom: 8rpx;
  1713. }
  1714. .activity-time {
  1715. font-size: 22rpx;
  1716. color: #999;
  1717. }
  1718. .activity-bottom {
  1719. display: flex;
  1720. align-items: center;
  1721. gap: 12rpx;
  1722. }
  1723. .activity-status {
  1724. font-size: 20rpx;
  1725. padding: 2rpx 10rpx;
  1726. border-radius: 8rpx;
  1727. background: #E8F5E9;
  1728. color: #2E7D32;
  1729. }
  1730. .activity-status.status-upcoming {
  1731. background: #E3F2FD;
  1732. color: #1565C0;
  1733. }
  1734. .activity-status.status-ended {
  1735. background: #F5F5F5;
  1736. color: #999;
  1737. }
  1738. .activity-fee {
  1739. font-size: 24rpx;
  1740. color: #F97316;
  1741. font-weight: bold;
  1742. }
  1743. .activity-fee.fee-free {
  1744. color: #4CAF50;
  1745. }
  1746. /* ===== 文章列表 ===== */
  1747. .article-list {
  1748. display: flex;
  1749. flex-direction: column;
  1750. gap: 16rpx;
  1751. }
  1752. .article-card {
  1753. background: #fff;
  1754. border-radius: 16rpx;
  1755. padding: 24rpx;
  1756. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1757. }
  1758. .article-card:active {
  1759. opacity: 0.8;
  1760. }
  1761. .article-category {
  1762. display: inline-block;
  1763. padding: 4rpx 14rpx;
  1764. border-radius: 8rpx;
  1765. margin-bottom: 10rpx;
  1766. }
  1767. .article-category-text {
  1768. font-size: 20rpx;
  1769. color: #fff;
  1770. }
  1771. .article-title {
  1772. display: block;
  1773. font-size: 28rpx;
  1774. font-weight: bold;
  1775. color: #333;
  1776. margin-bottom: 8rpx;
  1777. line-height: 1.4;
  1778. }
  1779. .article-summary {
  1780. display: block;
  1781. font-size: 24rpx;
  1782. color: #888;
  1783. line-height: 1.5;
  1784. margin-bottom: 12rpx;
  1785. overflow: hidden;
  1786. text-overflow: ellipsis;
  1787. display: -webkit-box;
  1788. -webkit-line-clamp: 2;
  1789. -webkit-box-orient: vertical;
  1790. }
  1791. .article-meta {
  1792. display: flex;
  1793. align-items: center;
  1794. gap: 16rpx;
  1795. }
  1796. .meta-item {
  1797. display: flex;
  1798. align-items: center;
  1799. gap: 4rpx;
  1800. }
  1801. .meta-icon {
  1802. font-size: 24rpx;
  1803. }
  1804. .meta-text {
  1805. font-size: 22rpx;
  1806. color: #999;
  1807. }
  1808. .article-date {
  1809. font-size: 22rpx;
  1810. color: #bbb;
  1811. }
  1812. /* ===== Splash Loading Overlay(冷启动蒙板,来自 merge splash.vue) ===== */
  1813. .splash-overlay {
  1814. position: fixed;
  1815. top: 0; left: 0; right: 0; bottom: 0;
  1816. z-index: 9999;
  1817. display: flex;
  1818. align-items: center;
  1819. justify-content: center;
  1820. background: linear-gradient(160deg, #FFF7ED 0%, #FFEDD5 50%, #FED7AA 100%);
  1821. overflow: hidden;
  1822. opacity: 1;
  1823. transition: opacity 0.4s ease;
  1824. }
  1825. .splash-overlay.fade-out {
  1826. opacity: 0;
  1827. pointer-events: none;
  1828. }
  1829. /* ---- bg circles from splash.vue ---- */
  1830. .splash-overlay-bg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; }
  1831. .bg-circle {
  1832. position: absolute;
  1833. border-radius: 50%;
  1834. opacity: 0.12;
  1835. }
  1836. .bg-circle-1 {
  1837. width: 400rpx; height: 400rpx;
  1838. background: #FF8C42;
  1839. top: -100rpx; right: -80rpx;
  1840. animation: splash-float-1 4s ease-in-out infinite;
  1841. }
  1842. .bg-circle-2 {
  1843. width: 280rpx; height: 280rpx;
  1844. background: #FF6B9D;
  1845. bottom: 80rpx; left: -60rpx;
  1846. animation: splash-float-2 5s ease-in-out infinite;
  1847. }
  1848. .bg-circle-3 {
  1849. width: 180rpx; height: 180rpx;
  1850. background: #6366F1;
  1851. top: 50%; right: -40rpx;
  1852. animation: splash-float-3 6s ease-in-out infinite;
  1853. }
  1854. @keyframes splash-float-1 {
  1855. 0%, 100% { transform: translateY(0) scale(1); }
  1856. 50% { transform: translateY(-30rpx) scale(1.05); }
  1857. }
  1858. @keyframes splash-float-2 {
  1859. 0%, 100% { transform: translateY(0) scale(1); }
  1860. 50% { transform: translateY(20rpx) scale(1.08); }
  1861. }
  1862. @keyframes splash-float-3 {
  1863. 0%, 100% { transform: translateY(0) rotate(0deg); }
  1864. 50% { transform: translateY(-20rpx) rotate(10deg); }
  1865. }
  1866. /* ---- body fade-in ---- */
  1867. .splash-overlay-body {
  1868. display: flex;
  1869. flex-direction: column;
  1870. align-items: center;
  1871. animation: splash-body-in 0.8s cubic-bezier(0.16,1,0.3,1) forwards;
  1872. }
  1873. @keyframes splash-body-in {
  1874. from { opacity: 0; transform: translateY(40rpx) scale(0.96); }
  1875. to { opacity: 1; transform: translateY(0) scale(1); }
  1876. }
  1877. /* ---- logo ---- */
  1878. .splash-logo-wrap {
  1879. width: 160rpx; height: 160rpx;
  1880. border-radius: 40rpx;
  1881. background: rgba(255,255,255,0.95);
  1882. display: flex; align-items: center; justify-content: center;
  1883. margin-bottom: 16rpx;
  1884. box-shadow: 0 8rpx 32rpx rgba(249,115,22,0.25);
  1885. animation: splash-logo-pulse 2.5s ease-in-out infinite;
  1886. }
  1887. @keyframes splash-logo-pulse {
  1888. 0%, 100% { box-shadow: 0 8rpx 32rpx rgba(249,115,22,0.25); }
  1889. 50% { box-shadow: 0 8rpx 48rpx rgba(249,115,22,0.45); }
  1890. }
  1891. .splash-logo-img { width: 100rpx; height: 100rpx; }
  1892. /* ---- brand ---- */
  1893. .splash-brand-name {
  1894. font-size: 64rpx; font-weight: 800;
  1895. color: #7C2D12;
  1896. letter-spacing: 10rpx;
  1897. margin-bottom: 2rpx;
  1898. }
  1899. .splash-brand-en {
  1900. font-size: 20rpx;
  1901. color: rgba(124,45,18,0.5);
  1902. letter-spacing: 6rpx;
  1903. margin-bottom: 30rpx;
  1904. }
  1905. .splash-tagline {
  1906. font-size: 26rpx;
  1907. color: rgba(124,45,18,0.7);
  1908. letter-spacing: 4rpx;
  1909. margin-top: 24rpx;
  1910. }
  1911. /* ---- dims row from splash.vue (rounded circles) ---- */
  1912. .splash-dims-row {
  1913. display: flex; flex-direction: row;
  1914. align-items: center; justify-content: center;
  1915. gap: 28rpx;
  1916. }
  1917. .splash-dim-item {
  1918. display: flex; flex-direction: column;
  1919. align-items: center; gap: 8rpx;
  1920. }
  1921. .splash-dim-circle {
  1922. width: 80rpx; height: 80rpx;
  1923. border-radius: 50%;
  1924. display: flex; align-items: center; justify-content: center;
  1925. }
  1926. .splash-dim-icon { font-size: 36rpx; line-height: 1; }
  1927. .splash-dim-label {
  1928. font-size: 22rpx; font-weight: 500;
  1929. color: rgba(124,45,18,0.75);
  1930. line-height: 1;
  1931. }
  1932. /* ---- staggered dim entry from splash.vue ---- */
  1933. .splash-dim-item:nth-child(1) { animation: splash-dim-in 0.5s ease 0.1s both; }
  1934. .splash-dim-item:nth-child(2) { animation: splash-dim-in 0.5s ease 0.2s both; }
  1935. .splash-dim-item:nth-child(3) { animation: splash-dim-in 0.5s ease 0.3s both; }
  1936. .splash-dim-item:nth-child(4) { animation: splash-dim-in 0.5s ease 0.4s both; }
  1937. .splash-dim-item:nth-child(5) { animation: splash-dim-in 0.5s ease 0.5s both; }
  1938. @keyframes splash-dim-in {
  1939. from { opacity: 0; transform: translateY(16rpx) scale(0.8); }
  1940. to { opacity: 1; transform: translateY(0) scale(1); }
  1941. }
  1942. /* ---- loading dots ---- */
  1943. .splash-overlay-loading {
  1944. position: absolute;
  1945. bottom: 120rpx;
  1946. left: 0; right: 0;
  1947. display: flex;
  1948. justify-content: center;
  1949. align-items: center;
  1950. gap: 12rpx;
  1951. }
  1952. .splash-overlay-dot {
  1953. width: 14rpx; height: 14rpx;
  1954. border-radius: 50%;
  1955. background: rgba(249,115,22,0.6);
  1956. animation: splash-dot-bounce 1.4s ease-in-out infinite both;
  1957. }
  1958. .splash-overlay-dot:nth-child(1) { animation-delay: -0.32s; }
  1959. .splash-overlay-dot:nth-child(2) { animation-delay: -0.16s; }
  1960. .splash-overlay-dot:nth-child(3) { animation-delay: 0s; }
  1961. @keyframes splash-dot-bounce {
  1962. 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  1963. 40% { transform: scale(1); opacity: 1; }
  1964. }
  1965. /* ---- 登录态内容布局 ---- */
  1966. .logged-in-container {
  1967. padding-bottom: 120rpx;
  1968. }
  1969. /* ===== ① 了解区 — 自测大卡(引导"从了解开始") ===== */
  1970. .self-test-card {
  1971. margin: 20rpx 30rpx 16rpx;
  1972. background: linear-gradient(135deg, #667eea, #764ba2);
  1973. border-radius: 20rpx;
  1974. padding: 24rpx 28rpx;
  1975. }
  1976. .self-test-head { display: flex; align-items: center; }
  1977. .self-test-icon { font-size: 40rpx; margin-right: 16rpx; }
  1978. .self-test-info { flex: 1; }
  1979. .self-test-title { font-size: 28rpx; font-weight: bold; color: #fff; display: block; }
  1980. .self-test-sub { font-size: 22rpx; color: rgba(255,255,255,0.8); display: block; margin-top: 4rpx; }
  1981. .self-test-arrow { font-size: 36rpx; color: rgba(255,255,255,0.7); }
  1982. /* ===== 快捷功能入口(单排,6个横向排列) ===== */
  1983. .quick-bar {
  1984. display: flex;
  1985. flex-direction: row;
  1986. justify-content: space-between;
  1987. align-items: center;
  1988. background: #fff;
  1989. border-radius: 20rpx;
  1990. padding: 20rpx 10rpx;
  1991. }
  1992. .quick-item {
  1993. flex: 1;
  1994. display: flex;
  1995. flex-direction: column;
  1996. align-items: center;
  1997. gap: 8rpx;
  1998. }
  1999. .quick-icon {
  2000. width: 80rpx;
  2001. height: 80rpx;
  2002. border-radius: 20rpx;
  2003. display: flex;
  2004. align-items: center;
  2005. justify-content: center;
  2006. }
  2007. .quick-icon text {
  2008. font-size: 36rpx;
  2009. }
  2010. .quick-item .quick-label {
  2011. font-size: 26rpx;
  2012. color: #666;
  2013. }
  2014. /* ===== 我的任务快捷列表 ===== */
  2015. .task-quick-list {
  2016. display: flex;
  2017. flex-direction: column;
  2018. gap: 12rpx;
  2019. }
  2020. .task-quick-item {
  2021. display: flex;
  2022. flex-direction: row;
  2023. align-items: center;
  2024. justify-content: space-between;
  2025. background: #fff;
  2026. border-radius: 16rpx;
  2027. padding: 18rpx 24rpx;
  2028. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  2029. }
  2030. .task-quick-info {
  2031. display: flex;
  2032. flex-direction: column;
  2033. min-width: 0;
  2034. flex: 1;
  2035. }
  2036. .task-quick-title {
  2037. font-size: 26rpx;
  2038. color: #333;
  2039. font-weight: 500;
  2040. line-height: 1.4;
  2041. }
  2042. .task-quick-meta {
  2043. font-size: 22rpx;
  2044. color: #F97316;
  2045. margin-top: 4rpx;
  2046. font-weight: bold;
  2047. }
  2048. .btn-quick-complete {
  2049. margin-left: 16rpx;
  2050. padding: 8rpx 24rpx;
  2051. background: linear-gradient(135deg, #F97316, #FB923C);
  2052. color: #fff;
  2053. font-size: 24rpx;
  2054. font-weight: bold;
  2055. border-radius: 20rpx;
  2056. border: none;
  2057. line-height: 1;
  2058. height: 44rpx;
  2059. flex-shrink: 0;
  2060. }
  2061. .btn-quick-complete::after {
  2062. border: none;
  2063. }
  2064. /* ===== 家庭挑战空态 ===== */
  2065. .challenge-empty {
  2066. display: flex;
  2067. flex-direction: column;
  2068. align-items: center;
  2069. padding: 40rpx 0 20rpx;
  2070. }
  2071. .challenge-empty-icon {
  2072. font-size: 64rpx;
  2073. margin-bottom: 12rpx;
  2074. line-height: 1;
  2075. }
  2076. .challenge-empty-text {
  2077. font-size: 26rpx;
  2078. color: #999;
  2079. margin-bottom: 20rpx;
  2080. }
  2081. .challenge-add-btn {
  2082. padding: 10rpx 32rpx;
  2083. background: linear-gradient(135deg, #F97316, #FB923C);
  2084. color: #fff;
  2085. font-size: 24rpx;
  2086. font-weight: bold;
  2087. border-radius: 24rpx;
  2088. border: none;
  2089. line-height: 1;
  2090. height: 48rpx;
  2091. }
  2092. .challenge-add-btn::after {
  2093. border: none;
  2094. }
  2095. .self-test-badge { display: inline-block; align-self: flex-start; margin-top: 8rpx; font-size: 20rpx; color: #F97316; background: rgba(249,115,22,0.1); padding: 4rpx 14rpx; border-radius: 999rpx; }
  2096. </style>