index.vue 81 KB

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