index.vue 65 KB

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