index.vue 81 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504
  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. // 默认 6 个快捷入口(未配置自定义快捷方式时使用)
  727. getDefaultQuickApps: function() {
  728. var defaultKeys = ['task', 'interaction', 'tiandi', 'members', 'circle', 'shop']
  729. var shown = []
  730. defaultKeys.forEach(function(key) {
  731. var app = findAppByKey(key)
  732. if (app) shown.push({ key: app.key, name: app.name, icon: app.icon, route: app.route, locked: 0 })
  733. })
  734. return shown
  735. },
  736. // 后端返回 myShortcuts(含 locked/sortOrder);未配置(myShortcuts 为空)时使用默认 6 个
  737. loadQuickApps: function() {
  738. var self = this
  739. getAppLibrary().then(function(res) {
  740. if (res.code === 200 && res.data) {
  741. self.myShortcuts = res.data.myShortcuts || []
  742. self.appUsage = res.data.usage || {}
  743. var shown = []
  744. if (!self.myShortcuts || self.myShortcuts.length === 0) {
  745. // 用户未配置:使用默认 6 个(不按频度重排)
  746. shown = self.getDefaultQuickApps()
  747. } else {
  748. // 已配置:锁定占位 + 频度填充
  749. var result = self.computeQuickApps(self.myShortcuts, self.appUsage)
  750. result.forEach(function(item) {
  751. var appKey = item.appKey
  752. var app = findAppByKey(appKey)
  753. if (app) {
  754. shown.push({
  755. key: app.key,
  756. name: app.name,
  757. icon: app.icon,
  758. route: app.route,
  759. locked: item.locked
  760. })
  761. }
  762. })
  763. }
  764. self.quickApps = shown
  765. self.quickLoaded = true
  766. }
  767. }).catch(function() {
  768. // 接口失败:回退到默认 6 个
  769. self.quickApps = self.getDefaultQuickApps()
  770. self.quickLoaded = true
  771. })
  772. },
  773. onQuickTap: function(app) {
  774. if (!app || !app.route) return
  775. // 记录进入次数(静默,失败不影响跳转)
  776. if (app.key) {
  777. reportAppEnter(app.key).catch(function() {})
  778. }
  779. this.navTo(app.route)
  780. },
  781. goAppLibrary: function() {
  782. uni.navigateTo({ url: '/pages/home/app-library' })
  783. },
  784. getQuickIconStyle: function(idx) {
  785. var palette = [
  786. 'rgba(99,102,241,0.15)',
  787. 'rgba(16,185,129,0.15)',
  788. 'rgba(139,92,246,0.15)',
  789. 'rgba(245,158,11,0.15)',
  790. 'rgba(255,107,157,0.15)',
  791. 'rgba(249,115,22,0.15)'
  792. ]
  793. return { background: palette[idx % palette.length] }
  794. },
  795. // ===== 登录态数据加载 =====
  796. loadLoggedInData: function() {
  797. this.loadFamilyData()
  798. this.loadReferralCode()
  799. this.loadQuickApps()
  800. },
  801. // 合并原 loadFamilyMembers + loadChildren:仅调用一次 getFamilyMemberList
  802. loadFamilyData: function() {
  803. var self = this
  804. getFamilyMemberList({ visibleOnly: true }).then(function(res) {
  805. if (res.code === 200 && res.data) {
  806. var arr = Array.isArray(res.data) ? res.data : (res.data.list || [])
  807. self.familyMembersVisible = arr
  808. // 过滤出孩子成员(effectiveRole 为 'child' 的成员)
  809. self.children = arr.filter(function(m) { return m.effectiveRole === 'child' })
  810. var savedChildId = uni.getStorageSync('currentChildId')
  811. if (savedChildId) {
  812. self.currentChildId = savedChildId
  813. }
  814. self.loadDimensionData()
  815. }
  816. self.childrenChecked = true
  817. self.membersChecked = true
  818. self.loadTodayTasks()
  819. self.loadFamilyFeed()
  820. self.loadNotices()
  821. self.loadNotifications()
  822. }).catch(function(e) {
  823. console.log('获取家庭成员失败', e)
  824. self.familyMembersVisible = []
  825. self.children = []
  826. self.childrenChecked = true
  827. self.membersChecked = true
  828. })
  829. },
  830. // loadChildren 已废弃:loadFamilyData 统一调用 getFamilyMemberList 一次,
  831. // 从响应中过滤出 effectiveRole==='child' 的成员赋给 this.children。
  832. // 删除了原 loadChildren 方法(调用 getChildren 会重复打 /api/family/member/list)。
  833. loadDimensionData: function() {
  834. this.loadSandboxData()
  835. this.loadEnergyOverview()
  836. this.loadActionArticles()
  837. this.loadChallenges()
  838. this.loadSelfCheckStatus()
  839. },
  840. loadEnergyOverview: function() {
  841. var memberId = this.currentChildId || uni.getStorageSync('currentMemberId')
  842. if (!memberId) return
  843. var self = this
  844. getEnergyOverview(memberId).then(function(res) {
  845. if (res && res.data) {
  846. self.energyDimensions = res.data.dimensions || []
  847. self.totalEnergy = res.data.totalEnergy || 0
  848. self.totalHealthIndex = res.data.totalHealthIndex || 0
  849. }
  850. }).catch(function(e) {
  851. console.log('获取能量概览失败', e)
  852. })
  853. },
  854. loadSandboxData: function() {
  855. var self = this
  856. var memberId = uni.getStorageSync('currentMemberId') || uni.getStorageSync('currentChildId') || null
  857. getEnergySandbox(this.currentSandboxView, memberId).then(function(res) {
  858. if (res && res.data) {
  859. var d = res.data
  860. if (d.locked) {
  861. // 未解锁:显示引导卡(GateLock 渲染自检引导按钮)
  862. self.sandboxLocked = true
  863. self.sandboxLockGate = d.gate || null
  864. self.sandboxData = null
  865. self.sandboxPersonalData = null
  866. self.sandboxFamilyData = null
  867. } else {
  868. self.sandboxLocked = false
  869. self.sandboxLockGate = null
  870. self.sandboxPersonalData = d.personalData || null
  871. self.sandboxFamilyData = d.familyData || null
  872. self.sandboxData = self.currentSandboxView === 'family' ? (d.familyData || null) : (d.personalData || null)
  873. self.familyUnlocked = d.familyUnlocked || false
  874. }
  875. self._splashReady = true
  876. self._tryHideSplash()
  877. }
  878. }).catch(function() {})
  879. },
  880. /** 切换沙盘个人/全家视角(本地切换,不重新请求) */
  881. onSandboxViewChange: function(view) {
  882. if (view === this.currentSandboxView) return
  883. this.currentSandboxView = view
  884. this.sandboxData = view === 'family' ? (this.sandboxFamilyData || null) : (this.sandboxPersonalData || null)
  885. },
  886. loadActionArticles: function() {
  887. var self = this
  888. getFeaturedArticles({ size: 5 }).then(function(res) {
  889. if (res.code === 200 && res.data) {
  890. var gradientColors = [
  891. 'linear-gradient(135deg, #10B981, #34D399)',
  892. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  893. 'linear-gradient(135deg, #8B5CF6, #C084FC)',
  894. 'linear-gradient(135deg, #F97316, #FB923C)',
  895. 'linear-gradient(135deg, #6366F1, #818CF8)'
  896. ]
  897. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  898. self.articles = list.map(function(item, index) {
  899. return {
  900. id: item.id,
  901. category: item.categoryName || '行动社交',
  902. categoryColor: gradientColors[index % gradientColors.length],
  903. title: item.title || '',
  904. summary: item.summary || '',
  905. dimensionWeights: item.dimensionWeights || null,
  906. views: item.viewCount ? String(item.viewCount) : '0',
  907. likes: '0',
  908. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  909. relatedDimensions: self.parseRelatedDimensions(item.relatedDimensions),
  910. coverImage: item.coverImage
  911. }
  912. })
  913. }
  914. }).catch(function() {})
  915. },
  916. loadChallenges: function() {
  917. var self = this
  918. getChallengeList({}).then(function(res) {
  919. if (res.code === 200 && Array.isArray(res.data)) {
  920. self.activeChallenges = res.data
  921. }
  922. }).catch(function() {
  923. self.activeChallenges = []
  924. })
  925. },
  926. loadTodayTasks: function() {
  927. var self = this
  928. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || 'parent'
  929. // 家长:家庭维度拉取(方案任务可能挂在任意成员,不只是当前孩子)
  930. if (role === 'parent') {
  931. getTodayTasks(null, { familyWide: true }).then(function(res) {
  932. if (res.code === 200 && Array.isArray(res.data)) {
  933. self.pendingTasks = res.data.filter(function(t) {
  934. return t.status === 'pending'
  935. })
  936. }
  937. }).catch(function() {
  938. self.pendingTasks = []
  939. })
  940. return
  941. }
  942. if (!self.currentChildId) {
  943. self.pendingTasks = []
  944. return
  945. }
  946. getTodayTasks(self.currentChildId).then(function(res) {
  947. if (res.code === 200 && Array.isArray(res.data)) {
  948. self.pendingTasks = res.data.filter(function(t) {
  949. return t.status === 'pending'
  950. })
  951. }
  952. }).catch(function() {
  953. self.pendingTasks = []
  954. })
  955. },
  956. loadFamilyFeed: function() {
  957. var self = this
  958. // 仅对第一个孩子拉取任务历史(避免 N 个孩子 N 次 /api/tasks/history 请求)
  959. var children = (self.children || []).filter(function(m) { return m.effectiveRole === 'child' })
  960. if (children.length === 0) {
  961. self.familyFeed = []
  962. return
  963. }
  964. var child = children[0]
  965. getTaskHistory(child.id, 1, 3).then(function(res) {
  966. var tasks = []
  967. if (res.code === 200) {
  968. var data = res.data
  969. tasks = (data && data.records) ? data.records : (Array.isArray(data) ? data : [])
  970. }
  971. var feed = tasks.filter(function(t) { return t.status === 'completed' }).map(function(t) {
  972. var points = t.pointsEarned || t.points || 0
  973. var timeStr = ''
  974. if (t.completedAt && typeof t.completedAt === 'string') {
  975. timeStr = t.completedAt.substring(11, 16)
  976. }
  977. return {
  978. text: '✅ ' + (child.nickname || '小名') + ' 完成「' + (t.title || '任务') + '」 +' + points + '分',
  979. time: timeStr,
  980. type: 'task'
  981. }
  982. })
  983. self.familyFeed = feed.slice(0, 10)
  984. }).catch(function() {
  985. self.familyFeed = []
  986. })
  987. },
  988. loadNotices: function() {
  989. var self = this
  990. getNotices().then(function(res) {
  991. if (res.code === 200 && res.data) {
  992. var notices = res.data.map(function(n) {
  993. var timeStr = ''
  994. if (n.createdAt) {
  995. var d = parseDate(n.createdAt)
  996. if (d) {
  997. timeStr = (d.getMonth() + 1) + '月' + d.getDate() + '日'
  998. }
  999. }
  1000. return {
  1001. text: '📢 ' + n.title,
  1002. time: timeStr,
  1003. type: 'notice',
  1004. notice: n
  1005. }
  1006. })
  1007. self.notices = notices
  1008. // 合并 notices 到 familyFeed(优先显示)
  1009. self.familyFeed = notices.concat(self.familyFeed).slice(0, 10)
  1010. }
  1011. }).catch(function() {})
  1012. },
  1013. // W3: 用户通知入动态(未读优先显示在 familyFeed 顶部)
  1014. loadNotifications: function() {
  1015. var self = this
  1016. getNotificationList().then(function(res) {
  1017. if (res.code === 200 && res.data) {
  1018. var notifications = res.data.map(function(n) {
  1019. var timeStr = ''
  1020. if (n.createdAt) {
  1021. var d = parseDate(n.createdAt)
  1022. if (d) {
  1023. timeStr = (d.getMonth() + 1) + '月' + d.getDate() + '日'
  1024. }
  1025. }
  1026. return {
  1027. text: '📬 ' + n.title,
  1028. time: timeStr,
  1029. type: 'notification',
  1030. unread: (n.isRead === 0),
  1031. notice: n
  1032. }
  1033. })
  1034. var unread = notifications.filter(function(n) { return n.unread })
  1035. var read = notifications.filter(function(n) { return !n.unread })
  1036. // 未读在前,已读在后,合并到 familyFeed 顶部
  1037. self.familyFeed = unread.concat(read, self.familyFeed).slice(0, 10)
  1038. }
  1039. }).catch(function() {})
  1040. },
  1041. quickCompleteTask: function(task) {
  1042. var self = this
  1043. var memberId = (task && task.familyMemberId) || self.currentChildId || uni.getStorageSync('currentMemberId')
  1044. completeTaskApi(task.id, memberId, '').then(function(res) {
  1045. if (res.code === 200) {
  1046. uni.showToast({ title: '获得 ' + (res.data && res.data.pointsEarned || 0) + ' 积分', icon: 'success' })
  1047. self.loadTodayTasks()
  1048. } else {
  1049. uni.showToast({ title: (res && res.message) || '完成失败', icon: 'none' })
  1050. }
  1051. }).catch(function() {
  1052. uni.showToast({ title: '完成失败,请重试', icon: 'none' })
  1053. })
  1054. },
  1055. onChallengeCheckin: function(payload) {
  1056. var self = this
  1057. updateChallengeProgress({ challengeId: payload.challengeId, delta: 1 }).then(function(res) {
  1058. if (res && res.code === 200) {
  1059. uni.showToast({ title: '打卡成功', icon: 'success' })
  1060. self.loadChallenges()
  1061. } else {
  1062. uni.showToast({ title: (res && res.message) || '打卡失败', icon: 'none' })
  1063. }
  1064. }).catch(function() {
  1065. uni.showToast({ title: '打卡失败,请重试', icon: 'none' })
  1066. })
  1067. },
  1068. onChallengeRespond: function(payload) {
  1069. var self = this
  1070. respondChallenge({ challengeId: payload.challengeId, action: payload.action }).then(function(res) {
  1071. if (res && res.code === 200) {
  1072. uni.showToast({ title: payload.action === 'agree' ? '已同意' : '已拒绝', icon: 'success' })
  1073. self.loadChallenges()
  1074. } else {
  1075. uni.showToast({ title: (res && res.message) || '操作失败', icon: 'none' })
  1076. self.loadChallenges()
  1077. }
  1078. }).catch(function() {
  1079. uni.showToast({ title: '操作失败,请重试', icon: 'none' })
  1080. })
  1081. },
  1082. // loadFamilyMembers 已合并到 loadFamilyData(避免重复调用 /api/family/member/list)
  1083. parseRelatedDimensions: function(val) {
  1084. if (!val) return []
  1085. if (Array.isArray(val)) return val
  1086. if (typeof val === 'string') {
  1087. try {
  1088. var parsed = JSON.parse(val)
  1089. return Array.isArray(parsed) ? parsed : []
  1090. } catch (e) {
  1091. return val.split(',').map(function(s) { return s.trim() }).filter(function(s) { return s })
  1092. }
  1093. }
  1094. return []
  1095. },
  1096. onFamilyMemberSelect: function(member) {
  1097. this.selectedMemberId = member.id
  1098. },
  1099. onFamilyMemberSwitch: function(member) {
  1100. var self = this
  1101. if (!member || !member.id) return
  1102. switchToFamilyMember(member.id, member.source || 'family_member').then(function(res) {
  1103. if (res.code === 200 && res.data) {
  1104. store.commit('switchToMember', {
  1105. memberId: res.data.memberId,
  1106. effectiveRole: res.data.effectiveRole
  1107. })
  1108. uni.showToast({ title: '已切换到' + (member.nickname || '该成员'), icon: 'success' })
  1109. setTimeout(function() {
  1110. uni.reLaunch({ url: '/pages/index-home/index' })
  1111. }, 1000)
  1112. } else {
  1113. uni.showToast({ title: res.message || '切换失败', icon: 'none' })
  1114. }
  1115. }).catch(function() {
  1116. uni.showToast({ title: '切换失败', icon: 'none' })
  1117. })
  1118. },
  1119. navTo: function(url) {
  1120. nav.goPage(url)
  1121. },
  1122. goActivityDetail: function(act) {
  1123. if (!act || !act.id) return
  1124. uni.navigateTo({ url: '/pages/activity/activity-detail/activity-detail?id=' + act.id })
  1125. },
  1126. goMoreActivities: function() {
  1127. uni.navigateTo({ url: '/pages/activity/index' })
  1128. },
  1129. goProductDetail: function(prod) {
  1130. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + prod.id })
  1131. },
  1132. goMoreProducts: function() {
  1133. uni.navigateTo({ url: '/pages/shop/index/index' })
  1134. },
  1135. goArticleDetail: function(article) {
  1136. var id = article.id || article
  1137. uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
  1138. },
  1139. goMoreArticles: function() {
  1140. uni.navigateTo({ url: '/pages/article-center/index' })
  1141. },
  1142. goToUploadReport: function() {
  1143. var id = this.currentChildId || ''
  1144. uni.navigateTo({ url: '/pages/health/report-upload?memberId=' + id + '&from=index' })
  1145. },
  1146. // 定期调研待办角标(内部自检登录态,未登录静默清空)
  1147. _loadSurveyBadge: function() {
  1148. var self = this
  1149. if (!this.isLoggedIn()) { self.pendingSurveys = []; return }
  1150. getSurveyStatus({}).then(function(res) {
  1151. var list = (res && res.code === 200 && res.data && res.data instanceof Array) ? res.data : []
  1152. var pending = []
  1153. for (var i = 0; i < list.length; i++) {
  1154. if (list[i] && list[i].status === 'pending') pending.push(list[i])
  1155. }
  1156. self.pendingSurveys = pending
  1157. }).catch(function() { self.pendingSurveys = [] })
  1158. },
  1159. goSelfTest: function() {
  1160. var firstPending = null
  1161. for (var i = 0; i < this.pendingSurveys.length; i++) {
  1162. var s = this.pendingSurveys[i]
  1163. if (s && s.templateId) { firstPending = s; break }
  1164. }
  1165. if (firstPending) {
  1166. var url = '/pages/health/survey-questionnaire?templateId=' + firstPending.templateId +
  1167. '&templateTitle=' + encodeURIComponent(firstPending.title || '定期调研') +
  1168. '&templateDimension=' + encodeURIComponent(firstPending.dimension || '') +
  1169. '&periodStart=' + (firstPending.periodStart || '') +
  1170. '&periodEnd=' + (firstPending.periodEnd || '')
  1171. uni.navigateTo({ url: url })
  1172. } else {
  1173. // 无待填调研 → 进入五维自检中间页
  1174. uni.navigateTo({ url: '/pages/family/self-check-entry' })
  1175. }
  1176. },
  1177. // ===== Next Best Action 引导条点击 =====
  1178. onGuideTap: function(action) {
  1179. if (!action) return
  1180. switch (action.type) {
  1181. case 'self-check':
  1182. this.goSelfTest()
  1183. break
  1184. case 'survey':
  1185. // 跳转到第一个待填调研
  1186. if (this.pendingSurveys && this.pendingSurveys.length > 0) {
  1187. var s = this.pendingSurveys[0]
  1188. uni.navigateTo({
  1189. url: '/pages/health/survey-questionnaire?templateId=' + s.templateId +
  1190. '&templateTitle=' + encodeURIComponent(s.title || '定期调研') +
  1191. '&templateDimension=' + encodeURIComponent(s.dimension || '') +
  1192. '&periodStart=' + (s.periodStart || '') +
  1193. '&periodEnd=' + (s.periodEnd || '')
  1194. })
  1195. }
  1196. break
  1197. case 'add-member':
  1198. this.navTo('/pages/profile-extra/family-members')
  1199. break
  1200. case 'task':
  1201. this.navTo('/pages/tasks/tasks')
  1202. break
  1203. case 'notice':
  1204. this.navTo('/pages/profile/profile')
  1205. break
  1206. case 'default':
  1207. this.navTo('/pages/tasks/tasks')
  1208. break
  1209. }
  1210. },
  1211. loadSelfCheckStatus: function() {
  1212. var self = this
  1213. getSelfCheckStatus().then(function(res) {
  1214. if (res.code === 200 && res.data && res.data.lastResult) {
  1215. self.selfCheckScore = res.data.lastResult.totalScore
  1216. }
  1217. }).catch(function() {})
  1218. },
  1219. _doInit(options) {
  1220. options = options || {}
  1221. if (!this.isLoggedIn()) {
  1222. this.currentRole = ''
  1223. this.loadDimensionActivities()
  1224. this.loadFeaturedArticles()
  1225. return
  1226. }
  1227. this.syncRoleAndTabBar()
  1228. if (options.inviteCode && options.type === 'parent_invite') {
  1229. this.handleParentInvite(options.inviteCode)
  1230. return
  1231. }
  1232. var storedCode = uni.getStorageSync('inviteCode')
  1233. var storedType = uni.getStorageSync('inviteType')
  1234. if (storedCode && storedType === 'parent_invite') {
  1235. this.handleParentInvite(storedCode)
  1236. uni.removeStorageSync('inviteCode')
  1237. uni.removeStorageSync('inviteType')
  1238. return
  1239. }
  1240. // 登录用户:直接在 TabBar 页面内联渲染,保持底签可见
  1241. if (!this.loggedInInitDone) {
  1242. // 首次加载:全量初始化(数据 + 会员状态),onShow 不再重复
  1243. this.loggedInInitDone = true
  1244. this.loadLoggedInData()
  1245. this.checkMemberStatus()
  1246. }
  1247. this._watchPageReady()
  1248. this._maybeShowOnboardingGuide()
  1249. },
  1250. _refreshOnShow() {
  1251. // 切 Tab 返回:刷新家庭成员 + 沙盘 + 会员状态(loadFamilyData 内含任务/挑战刷新)
  1252. if (!this.isLoggedIn()) {
  1253. this.currentRole = ''
  1254. return
  1255. }
  1256. // 登录态可能在后台发生变化(如从登录页 switchTab 返回),
  1257. // 必须在此重新同步 currentRole,否则 v-if="currentRole" 无法切换到登录视图
  1258. this.syncRoleAndTabBar()
  1259. this.checkMemberStatus()
  1260. this.loadFamilyData()
  1261. },
  1262. _watchPageReady() {
  1263. if (this._watchPageReadyDone) return
  1264. this._watchPageReadyDone = true
  1265. var that = this
  1266. that.$watch('_splashReady', function(newVal) {
  1267. if (newVal) that._tryHideSplash()
  1268. })
  1269. },
  1270. // 首次登录引导浮层:异步拉取配置并按版本号判断是否展示
  1271. _maybeShowOnboardingGuide() {
  1272. if (this.showOnboardingGuide) return
  1273. if (this._onboardingGuideAttempted) return
  1274. this._onboardingGuideAttempted = true
  1275. var self = this
  1276. getGuideConfig().then(function(res) {
  1277. var cfg = (res && res.data) ? res.data : null
  1278. var cfgVersion = cfg ? (cfg.version || '1.0') : '1.0'
  1279. // 检查启用
  1280. if (cfg && cfg.enabled === false) return
  1281. // 检查位置(index-home 对应 'home' 位置)
  1282. if (cfg && cfg.positions && cfg.positions.indexOf('home') === -1) return
  1283. // 比较版本
  1284. var stored = uni.getStorageSync('_onboardingDone')
  1285. var seenVersion = '0.0'
  1286. if (stored) {
  1287. try {
  1288. var obj = typeof stored === 'string' ? JSON.parse(stored) : stored
  1289. if (obj && obj.version) seenVersion = obj.version
  1290. } catch (e) {}
  1291. }
  1292. if (self._compareVersion(seenVersion, cfgVersion) >= 0) return
  1293. setTimeout(function() {
  1294. if (!self.isLoggedIn()) return
  1295. self.showOnboardingGuide = true
  1296. }, 600)
  1297. }).catch(function() {
  1298. // 接口失败走旧逻辑
  1299. var stored = uni.getStorageSync('_onboardingDone')
  1300. if (stored) {
  1301. try {
  1302. var obj = typeof stored === 'string' ? JSON.parse(stored) : stored
  1303. if (obj && obj.version && self._compareVersion(obj.version, '1.0') >= 0) return
  1304. } catch (e) {}
  1305. }
  1306. setTimeout(function() {
  1307. if (!self.isLoggedIn()) return
  1308. self.showOnboardingGuide = true
  1309. }, 600)
  1310. })
  1311. },
  1312. closeOnboardingGuide() {
  1313. this.showOnboardingGuide = false
  1314. },
  1315. loadGuidePopup() {
  1316. var self = this
  1317. if (self._guidePopupAttempted) return
  1318. self._guidePopupAttempted = true
  1319. getGuidePopupList().then(function(res) {
  1320. var arr = (res && res.data) || []
  1321. if (arr && arr.length > 0) {
  1322. self.guidePopup = arr[0]
  1323. self.showGuidePopup = true
  1324. }
  1325. }).catch(function() {})
  1326. },
  1327. handleGuidePopupDone(payload) {
  1328. var popup = payload && payload.popup
  1329. var buttonClicked = payload && payload.buttonClicked
  1330. if (popup && popup.id) {
  1331. consumeGuidePopup(popup.id, buttonClicked)
  1332. }
  1333. this.showGuidePopup = false
  1334. if (buttonClicked && payload && payload.btnAction) {
  1335. uni.navigateTo({ url: payload.btnAction })
  1336. }
  1337. },
  1338. isLoggedIn() {
  1339. return !!uni.getStorageSync('token')
  1340. },
  1341. // 版本比较:返回 >0 表示 v1 > v2,0 相等,<0 表示 v1 < v2
  1342. _compareVersion: function(v1, v2) {
  1343. var parts1 = String(v1).split('.')
  1344. var parts2 = String(v2).split('.')
  1345. for (var i = 0; i < Math.max(parts1.length, parts2.length); i++) {
  1346. var n1 = parseInt(parts1[i] || '0', 10)
  1347. var n2 = parseInt(parts2[i] || '0', 10)
  1348. if (n1 !== n2) return n1 - n2
  1349. }
  1350. return 0
  1351. },
  1352. // ===== 会员状态(沙盘下方会员入口) =====
  1353. checkMemberStatus: function() {
  1354. var that = this
  1355. getMyMembership().then(function(res) {
  1356. var m = res.data || {}
  1357. var level = m.memberLevel || m.levelCode || ''
  1358. that.isLifetime = (level === 'LIFETIME')
  1359. that.isMember = that.isLifetime || !!(level && level !== 'FREE')
  1360. var mem = m.membership || m
  1361. if (mem.daysRemaining != null) {
  1362. that.membershipDays = mem.daysRemaining
  1363. } else if (that.isLifetime) {
  1364. // 终身会员:永久有效,不显示剩余天数
  1365. that.membershipDays = 0
  1366. }
  1367. }).catch(function() {})
  1368. },
  1369. goMembership: function() {
  1370. uni.navigateTo({ url: '/pages/membership/upgrade' })
  1371. },
  1372. normalizeCurrentRole() {
  1373. const role = uni.getStorageSync('role') || 'parent'
  1374. const currentRole = uni.getStorageSync('currentRole')
  1375. if (!currentRole) {
  1376. return role
  1377. }
  1378. // 非规划师账号不允许落到规划师首页
  1379. if (currentRole === 'teacher' && role !== 'teacher') {
  1380. return role
  1381. }
  1382. // 只有家长账号允许切换到孩子视角
  1383. if (currentRole === 'child' && role !== 'parent') {
  1384. return role
  1385. }
  1386. return currentRole
  1387. },
  1388. syncRoleAndTabBar() {
  1389. this.currentRole = this.normalizeCurrentRole()
  1390. uni.setStorageSync('currentRole', this.currentRole)
  1391. },
  1392. // ===== 发现页 / 未登录态方法 =====
  1393. loadDimensionActivities: function() {
  1394. var self = this
  1395. getActivityList({ dimensionCode: '', page: 1, size: 3 }).then(function(res) {
  1396. if (res && res.code === 200) {
  1397. // res.data is the response wrapper, activities are in res.data.data or res.data.records
  1398. var rawData = res.data && (Array.isArray(res.data) ? res.data : (res.data.data || res.data.records || []))
  1399. self.dimensionActivities = Array.isArray(rawData) ? rawData.slice(0, 3) : []
  1400. }
  1401. self._checkSplashReady()
  1402. }).catch(function() {
  1403. self._checkSplashReady()
  1404. })
  1405. },
  1406. loadFeaturedArticles: function() {
  1407. var self = this
  1408. this.articlesLoading = true
  1409. getFeaturedArticles({ size: 5 }).then(function(res) {
  1410. self.articlesLoading = false
  1411. if (res && res.code === 200) {
  1412. var gradientColors = [
  1413. 'linear-gradient(135deg, #10B981, #34D399)',
  1414. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  1415. 'linear-gradient(135deg, #8B5CF6, #C084FC)',
  1416. 'linear-gradient(135deg, #F97316, #FB923C)',
  1417. 'linear-gradient(135deg, #6366F1, #818CF8)'
  1418. ]
  1419. // res.data is the response wrapper, articles are in res.data.data
  1420. var rawList = res.data && (Array.isArray(res.data) ? res.data : (res.data.data || res.data.records || []))
  1421. var list = Array.isArray(rawList) ? rawList : []
  1422. self.indexArticles = list.map(function(item, index) {
  1423. return {
  1424. id: item.id,
  1425. category: item.categoryName || item.category || '热门文章',
  1426. categoryColor: gradientColors[index % gradientColors.length],
  1427. title: item.title || '',
  1428. summary: item.summary || '',
  1429. views: item.viewCount ? String(item.viewCount) : '0',
  1430. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  1431. coverImage: item.coverImage
  1432. }
  1433. })
  1434. }
  1435. self._checkSplashReady()
  1436. }).catch(function() {
  1437. self.articlesLoading = false
  1438. self._checkSplashReady()
  1439. })
  1440. },
  1441. goActivities: function() {
  1442. uni.navigateTo({ url: '/pages/activity/index' })
  1443. },
  1444. goChallengeManage: function() {
  1445. uni.navigateTo({ url: '/pages/health/challenge-manage' })
  1446. },
  1447. goArticles: function() {
  1448. uni.navigateTo({ url: '/pages/article-center/index' })
  1449. },
  1450. goArticleDetail: function(article) {
  1451. var id = article && article.id ? article.id : article
  1452. uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
  1453. },
  1454. handleLogin() {
  1455. uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/index-home/index') })
  1456. },
  1457. async handleParentInvite(code) {
  1458. // 延迟显示,等待登录完成
  1459. setTimeout(async () => {
  1460. const hasToken = uni.getStorageSync('token')
  1461. if (!hasToken) {
  1462. // 未登录,先去登录
  1463. uni.reLaunch({
  1464. url: '/pages/login/login?inviteCode=' + code
  1465. })
  1466. return
  1467. }
  1468. // 已登录,显示确认框
  1469. uni.showModal({
  1470. title: '加入家庭',
  1471. content: '您已被邀请加入家庭,是否接受?',
  1472. success: async (res) => {
  1473. if (res.confirm) {
  1474. try {
  1475. uni.showLoading({ title: '加入中...' })
  1476. const result = await acceptParentInvite(code)
  1477. uni.hideLoading()
  1478. if (result.code === 200) {
  1479. const { role, token } = result.data
  1480. uni.setStorageSync('role', role)
  1481. uni.setStorageSync('token', token)
  1482. uni.showToast({ title: '加入成功', icon: 'success' })
  1483. // 刷新页面
  1484. setTimeout(() => {
  1485. uni.switchTab({ url: '/pages/index-home/index' })
  1486. }, 1500)
  1487. }
  1488. } catch (e) {
  1489. uni.hideLoading()
  1490. uni.showToast({ title: e.message || '加入失败', icon: 'none' })
  1491. }
  1492. }
  1493. }
  1494. })
  1495. }, 500)
  1496. },
  1497. /** 获取自己的邀请码用于分享 */
  1498. loadReferralCode: function() {
  1499. if (this.referralCodeLoaded || !this.isLoggedIn()) return
  1500. var self = this
  1501. getReferralCode().then(function(res) {
  1502. self.referralCode = extractReferralCode(res)
  1503. }).catch(function() {})
  1504. self.referralCodeLoaded = true
  1505. },
  1506. getImageUrl: function(path) {
  1507. return config.API_BASE_URL + path
  1508. },
  1509. /** 转发给朋友/群(不指定 imageUrl,微信自动截取当前页面截图作缩略图;static/share-cover.png 不存在会导致卡片空白) */
  1510. onShareAppMessage: function() {
  1511. var path = '/pages/index-home/index'
  1512. if (this.referralCode) {
  1513. path = path + '?refCode=' + this.referralCode
  1514. }
  1515. return {
  1516. title: '浠艾福 · 家庭五维幸福成长',
  1517. path: path
  1518. }
  1519. },
  1520. /** 分享到朋友圈 */
  1521. onShareTimeline: function() {
  1522. var query = ''
  1523. if (this.referralCode) {
  1524. query = 'refCode=' + this.referralCode
  1525. }
  1526. return {
  1527. title: '浠艾福 · 家庭五维幸福成长',
  1528. query: query
  1529. }
  1530. }
  1531. }
  1532. }
  1533. </script>
  1534. <style>
  1535. .discover-container {
  1536. min-height: 100vh;
  1537. background: #f5f7fa;
  1538. padding-bottom: 100rpx;
  1539. }
  1540. /* ===== 品牌 Hero 区 ===== */
  1541. .hero-section {
  1542. margin: 24rpx 30rpx 0;
  1543. padding: 40rpx 32rpx;
  1544. background: linear-gradient(160deg, #FFF7ED 0%, #FED7AA 60%, rgba(249,115,22,0.15) 100%);
  1545. border-radius: 24rpx;
  1546. text-align: center;
  1547. border: 1rpx solid rgba(249,115,22,0.12);
  1548. }
  1549. .hero-logo {
  1550. width: 100rpx;
  1551. height: 100rpx;
  1552. border-radius: 50rpx;
  1553. background: #fff;
  1554. box-shadow: 0 8rpx 24rpx rgba(249,115,22,0.18);
  1555. }
  1556. .hero-name {
  1557. display: block;
  1558. font-size: 48rpx;
  1559. font-weight: bold;
  1560. color: #7C2D12;
  1561. margin-top: 16rpx;
  1562. letter-spacing: 6rpx;
  1563. }
  1564. .hero-identity {
  1565. display: block;
  1566. font-size: 28rpx;
  1567. font-weight: 600;
  1568. color: #C2410C;
  1569. margin-top: 12rpx;
  1570. letter-spacing: 2rpx;
  1571. }
  1572. .hero-slogan {
  1573. display: block;
  1574. font-size: 26rpx;
  1575. color: #9A3412;
  1576. margin-top: 8rpx;
  1577. font-weight: 500;
  1578. }
  1579. .hero-powered {
  1580. display: block;
  1581. font-size: 20rpx;
  1582. color: rgba(124,45,18,0.45);
  1583. margin-top: 10rpx;
  1584. }
  1585. .hero-dims {
  1586. display: flex;
  1587. justify-content: center;
  1588. gap: 16rpx;
  1589. margin-top: 28rpx;
  1590. flex-wrap: wrap;
  1591. }
  1592. .hero-dim {
  1593. display: flex;
  1594. flex-direction: column;
  1595. align-items: center;
  1596. gap: 6rpx;
  1597. padding: 12rpx 16rpx;
  1598. background: rgba(255,255,255,0.7);
  1599. border-radius: 16rpx;
  1600. }
  1601. .hero-dim-emoji {
  1602. font-size: 32rpx;
  1603. }
  1604. .hero-dim-label {
  1605. font-size: 20rpx;
  1606. color: #7C2D12;
  1607. font-weight: 500;
  1608. white-space: nowrap;
  1609. }
  1610. /* ===== 未登录态 Hero 副标语 / CTA ===== */
  1611. .hero-sub-slogan {
  1612. display: block;
  1613. font-size: 22rpx;
  1614. color: #EA580C;
  1615. margin-top: 18rpx;
  1616. font-weight: 500;
  1617. }
  1618. .hero-cta-btn {
  1619. margin: 28rpx auto 0;
  1620. display: block;
  1621. width: 420rpx;
  1622. height: 80rpx;
  1623. line-height: 80rpx;
  1624. background: linear-gradient(135deg, #F97316, #FB923C);
  1625. color: #fff;
  1626. font-size: 28rpx;
  1627. font-weight: bold;
  1628. border-radius: 40rpx;
  1629. text-align: center;
  1630. border: none;
  1631. box-shadow: 0 8rpx 20rpx rgba(249,115,22,0.3);
  1632. }
  1633. .hero-cta-btn::after {
  1634. border: none;
  1635. }
  1636. /* ===== 价值主张(为什么选择浠艾福) ===== */
  1637. .value-prop-section {
  1638. margin: 24rpx 30rpx 0;
  1639. }
  1640. .value-prop-title {
  1641. display: block;
  1642. font-size: 32rpx;
  1643. font-weight: bold;
  1644. color: #333;
  1645. text-align: center;
  1646. margin-bottom: 20rpx;
  1647. }
  1648. .value-prop-grid {
  1649. display: flex;
  1650. flex-wrap: wrap;
  1651. justify-content: space-between;
  1652. }
  1653. .value-prop-card {
  1654. width: 48.5%;
  1655. box-sizing: border-box;
  1656. background: #fff;
  1657. border-radius: 20rpx;
  1658. padding: 22rpx;
  1659. margin-bottom: 16rpx;
  1660. box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.05);
  1661. display: flex;
  1662. flex-direction: row;
  1663. align-items: flex-start;
  1664. }
  1665. .value-prop-icon {
  1666. font-size: 40rpx;
  1667. line-height: 1.3;
  1668. margin-right: 12rpx;
  1669. flex-shrink: 0;
  1670. }
  1671. .value-prop-texts {
  1672. display: flex;
  1673. flex-direction: column;
  1674. flex: 1;
  1675. min-width: 0;
  1676. }
  1677. .value-prop-name {
  1678. font-size: 28rpx;
  1679. font-weight: bold;
  1680. color: #333;
  1681. }
  1682. .value-prop-desc {
  1683. font-size: 22rpx;
  1684. color: #999;
  1685. margin-top: 8rpx;
  1686. line-height: 1.5;
  1687. }
  1688. /* ===== 三步上手 ===== */
  1689. .how-it-works {
  1690. margin: 32rpx 30rpx 0;
  1691. padding: 32rpx 24rpx;
  1692. background: #fff;
  1693. border-radius: 24rpx;
  1694. box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.04);
  1695. }
  1696. .how-it-works-title {
  1697. display: block;
  1698. font-size: 32rpx;
  1699. font-weight: bold;
  1700. color: #333;
  1701. text-align: center;
  1702. margin-bottom: 28rpx;
  1703. }
  1704. .step-row {
  1705. display: flex;
  1706. align-items: flex-start;
  1707. justify-content: space-between;
  1708. }
  1709. .step-item {
  1710. display: flex;
  1711. flex-direction: column;
  1712. align-items: center;
  1713. flex: 1;
  1714. min-width: 0;
  1715. }
  1716. .step-num {
  1717. width: 48rpx;
  1718. height: 48rpx;
  1719. line-height: 48rpx;
  1720. border-radius: 50%;
  1721. background: linear-gradient(135deg, #F97316, #FB923C);
  1722. color: #fff;
  1723. font-size: 26rpx;
  1724. font-weight: bold;
  1725. text-align: center;
  1726. box-shadow: 0 4rpx 12rpx rgba(249,115,22,0.3);
  1727. }
  1728. .step-name {
  1729. font-size: 24rpx;
  1730. color: #333;
  1731. font-weight: 500;
  1732. margin-top: 12rpx;
  1733. text-align: center;
  1734. }
  1735. .step-sub {
  1736. font-size: 20rpx;
  1737. color: #999;
  1738. margin-top: 4rpx;
  1739. text-align: center;
  1740. }
  1741. .step-arrow {
  1742. font-size: 28rpx;
  1743. color: #F97316;
  1744. line-height: 1;
  1745. align-self: center;
  1746. padding: 0 6rpx;
  1747. }
  1748. /* ===== 品牌定位语(保留旧样式,不再使用) ===== */
  1749. .brand-strap {
  1750. margin: 16rpx 30rpx 0;
  1751. padding: 20rpx 28rpx;
  1752. background: linear-gradient(135deg, #FFF7ED, rgba(249,115,22,0.10));
  1753. border-radius: 16rpx;
  1754. border-left: 4rpx solid #F97316;
  1755. }
  1756. .brand-strap-text {
  1757. font-size: 26rpx;
  1758. color: #9A3412;
  1759. font-weight: 500;
  1760. }
  1761. /* ===== 会员入口卡(能量沙盘下方) ===== */
  1762. .member-entry {
  1763. display: flex;
  1764. align-items: center;
  1765. margin: 20rpx 30rpx 0;
  1766. background: linear-gradient(135deg, #F97316, #FB923C);
  1767. border-radius: 20rpx;
  1768. padding: 24rpx 30rpx;
  1769. }
  1770. .member-entry-icon-wrap {
  1771. width: 64rpx;
  1772. height: 64rpx;
  1773. border-radius: 50%;
  1774. background: rgba(255,255,255,0.2);
  1775. display: flex;
  1776. align-items: center;
  1777. justify-content: center;
  1778. margin-right: 16rpx;
  1779. flex-shrink: 0;
  1780. }
  1781. .member-entry-icon {
  1782. font-size: 36rpx;
  1783. }
  1784. .member-entry-texts {
  1785. flex: 1;
  1786. display: flex;
  1787. flex-direction: column;
  1788. min-width: 0;
  1789. }
  1790. .member-entry-title {
  1791. font-size: 30rpx;
  1792. font-weight: bold;
  1793. color: #fff;
  1794. }
  1795. .member-entry-desc {
  1796. font-size: 22rpx;
  1797. color: rgba(255,255,255,0.85);
  1798. margin-top: 4rpx;
  1799. overflow: hidden;
  1800. text-overflow: ellipsis;
  1801. white-space: nowrap;
  1802. }
  1803. .member-entry-btn {
  1804. margin-left: 16rpx;
  1805. padding: 10rpx 24rpx;
  1806. background: #fff;
  1807. border-radius: 30rpx;
  1808. flex-shrink: 0;
  1809. }
  1810. .member-entry-btn-text {
  1811. font-size: 24rpx;
  1812. color: #F97316;
  1813. font-weight: bold;
  1814. }
  1815. /* ===== 活动/阅读共用状态样式 ===== */
  1816. .loading-state,
  1817. .empty-state {
  1818. display: flex;
  1819. justify-content: center;
  1820. padding: 60rpx 0;
  1821. }
  1822. .loading-text,
  1823. .empty-text {
  1824. font-size: 26rpx;
  1825. color: #999;
  1826. }
  1827. /* ===== 五维全景幸福矩阵 ===== */
  1828. /* ===== 底部登录 ===== */
  1829. .login-footer {
  1830. margin: 40rpx 30rpx;
  1831. display: flex;
  1832. flex-direction: column;
  1833. align-items: center;
  1834. }
  1835. .login-btn {
  1836. width: 100%;
  1837. height: 88rpx;
  1838. line-height: 88rpx;
  1839. background: linear-gradient(135deg, #F97316, #FB923C);
  1840. color: #fff;
  1841. font-size: 32rpx;
  1842. font-weight: bold;
  1843. border-radius: 44rpx;
  1844. text-align: center;
  1845. border: none;
  1846. box-shadow: 0 8rpx 24rpx rgba(249,115,22,0.3);
  1847. }
  1848. .login-btn::after {
  1849. border: none;
  1850. }
  1851. .login-footer-text {
  1852. font-size: 22rpx;
  1853. color: #F97316;
  1854. margin-top: 16rpx;
  1855. font-weight: 500;
  1856. }
  1857. /* ===== 加载占位 ===== */
  1858. .loading-container {
  1859. display: flex;
  1860. justify-content: center;
  1861. align-items: center;
  1862. height: 100vh;
  1863. }
  1864. /* ===== 角色切换淡入淡出 ===== */
  1865. .role-switch-wrapper {
  1866. width: 100%;
  1867. min-height: 100vh;
  1868. }
  1869. .fade-enter-active,
  1870. .fade-leave-active {
  1871. transition: opacity 0.3s ease;
  1872. }
  1873. .fade-enter,
  1874. .fade-leave-to {
  1875. opacity: 0;
  1876. }
  1877. /* ===== 通用区块样式 ===== */
  1878. .section {
  1879. margin: 20rpx 30rpx;
  1880. }
  1881. .section-header {
  1882. display: flex;
  1883. justify-content: space-between;
  1884. align-items: center;
  1885. margin-bottom: 20rpx;
  1886. }
  1887. .section-title {
  1888. font-size: 30rpx;
  1889. font-weight: bold;
  1890. color: #333;
  1891. }
  1892. .section-more {
  1893. font-size: 24rpx;
  1894. color: #5B9BD5;
  1895. }
  1896. .empty-state {
  1897. display: flex;
  1898. justify-content: center;
  1899. padding: 60rpx 0;
  1900. }
  1901. .empty-text {
  1902. font-size: 26rpx;
  1903. color: #999;
  1904. }
  1905. /* ===== 活动列表 ===== */
  1906. .activity-list {
  1907. display: flex;
  1908. flex-direction: column;
  1909. gap: 16rpx;
  1910. }
  1911. .activity-card {
  1912. background: #fff;
  1913. border-radius: 16rpx;
  1914. overflow: hidden;
  1915. display: flex;
  1916. flex-direction: row;
  1917. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1918. }
  1919. .activity-card:active {
  1920. opacity: 0.8;
  1921. }
  1922. .activity-cover {
  1923. width: 200rpx;
  1924. height: 160rpx;
  1925. flex-shrink: 0;
  1926. background: #f0f0f0;
  1927. }
  1928. .activity-info {
  1929. flex: 1;
  1930. padding: 16rpx;
  1931. display: flex;
  1932. flex-direction: column;
  1933. justify-content: space-between;
  1934. }
  1935. .activity-name {
  1936. font-size: 28rpx;
  1937. font-weight: bold;
  1938. color: #333;
  1939. margin-bottom: 8rpx;
  1940. }
  1941. .line-clamp-1 {
  1942. overflow: hidden;
  1943. text-overflow: ellipsis;
  1944. white-space: nowrap;
  1945. }
  1946. .activity-meta {
  1947. display: flex;
  1948. align-items: center;
  1949. margin-bottom: 8rpx;
  1950. }
  1951. .activity-time {
  1952. font-size: 22rpx;
  1953. color: #999;
  1954. }
  1955. .activity-bottom {
  1956. display: flex;
  1957. align-items: center;
  1958. gap: 12rpx;
  1959. }
  1960. .activity-status {
  1961. font-size: 20rpx;
  1962. padding: 2rpx 10rpx;
  1963. border-radius: 8rpx;
  1964. background: #E8F5E9;
  1965. color: #2E7D32;
  1966. }
  1967. .activity-status.status-upcoming {
  1968. background: #E3F2FD;
  1969. color: #1565C0;
  1970. }
  1971. .activity-status.status-ended {
  1972. background: #F5F5F5;
  1973. color: #999;
  1974. }
  1975. .activity-fee {
  1976. font-size: 24rpx;
  1977. color: #F97316;
  1978. font-weight: bold;
  1979. }
  1980. .activity-fee.fee-free {
  1981. color: #4CAF50;
  1982. }
  1983. /* ===== 文章列表 ===== */
  1984. .article-list {
  1985. display: flex;
  1986. flex-direction: column;
  1987. gap: 16rpx;
  1988. }
  1989. .article-card {
  1990. background: #fff;
  1991. border-radius: 16rpx;
  1992. padding: 24rpx;
  1993. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1994. }
  1995. .article-card:active {
  1996. opacity: 0.8;
  1997. }
  1998. .article-category {
  1999. display: inline-block;
  2000. padding: 4rpx 14rpx;
  2001. border-radius: 8rpx;
  2002. margin-bottom: 10rpx;
  2003. }
  2004. .article-category-text {
  2005. font-size: 20rpx;
  2006. color: #fff;
  2007. }
  2008. .article-title {
  2009. display: block;
  2010. font-size: 28rpx;
  2011. font-weight: bold;
  2012. color: #333;
  2013. margin-bottom: 8rpx;
  2014. line-height: 1.4;
  2015. }
  2016. .article-summary {
  2017. display: block;
  2018. font-size: 24rpx;
  2019. color: #888;
  2020. line-height: 1.5;
  2021. margin-bottom: 12rpx;
  2022. overflow: hidden;
  2023. text-overflow: ellipsis;
  2024. display: -webkit-box;
  2025. -webkit-line-clamp: 2;
  2026. -webkit-box-orient: vertical;
  2027. }
  2028. .article-meta {
  2029. display: flex;
  2030. align-items: center;
  2031. gap: 16rpx;
  2032. }
  2033. .meta-item {
  2034. display: flex;
  2035. align-items: center;
  2036. gap: 4rpx;
  2037. }
  2038. .meta-icon {
  2039. font-size: 24rpx;
  2040. }
  2041. .meta-text {
  2042. font-size: 22rpx;
  2043. color: #999;
  2044. }
  2045. .article-date {
  2046. font-size: 22rpx;
  2047. color: #bbb;
  2048. }
  2049. /* ===== Splash Loading Overlay(冷启动蒙板,来自 merge splash.vue) ===== */
  2050. .splash-overlay {
  2051. position: fixed;
  2052. top: 0; left: 0; right: 0; bottom: 0;
  2053. z-index: 9999;
  2054. display: flex;
  2055. align-items: center;
  2056. justify-content: center;
  2057. background: linear-gradient(160deg, #FFF7ED 0%, #FFEDD5 50%, #FED7AA 100%);
  2058. overflow: hidden;
  2059. opacity: 1;
  2060. transition: opacity 0.4s ease;
  2061. }
  2062. .splash-overlay.fade-out {
  2063. opacity: 0;
  2064. pointer-events: none;
  2065. }
  2066. /* ---- bg circles from splash.vue ---- */
  2067. .splash-overlay-bg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; }
  2068. .bg-circle {
  2069. position: absolute;
  2070. border-radius: 50%;
  2071. opacity: 0.12;
  2072. }
  2073. .bg-circle-1 {
  2074. width: 400rpx; height: 400rpx;
  2075. background: #FF8C42;
  2076. top: -100rpx; right: -80rpx;
  2077. animation: splash-float-1 4s ease-in-out infinite;
  2078. }
  2079. .bg-circle-2 {
  2080. width: 280rpx; height: 280rpx;
  2081. background: #FF6B9D;
  2082. bottom: 80rpx; left: -60rpx;
  2083. animation: splash-float-2 5s ease-in-out infinite;
  2084. }
  2085. .bg-circle-3 {
  2086. width: 180rpx; height: 180rpx;
  2087. background: #6366F1;
  2088. top: 50%; right: -40rpx;
  2089. animation: splash-float-3 6s ease-in-out infinite;
  2090. }
  2091. @keyframes splash-float-1 {
  2092. 0%, 100% { transform: translateY(0) scale(1); }
  2093. 50% { transform: translateY(-30rpx) scale(1.05); }
  2094. }
  2095. @keyframes splash-float-2 {
  2096. 0%, 100% { transform: translateY(0) scale(1); }
  2097. 50% { transform: translateY(20rpx) scale(1.08); }
  2098. }
  2099. @keyframes splash-float-3 {
  2100. 0%, 100% { transform: translateY(0) rotate(0deg); }
  2101. 50% { transform: translateY(-20rpx) rotate(10deg); }
  2102. }
  2103. /* ---- body fade-in ---- */
  2104. .splash-overlay-body {
  2105. display: flex;
  2106. flex-direction: column;
  2107. align-items: center;
  2108. animation: splash-body-in 0.8s cubic-bezier(0.16,1,0.3,1) forwards;
  2109. }
  2110. @keyframes splash-body-in {
  2111. from { opacity: 0; transform: translateY(40rpx) scale(0.96); }
  2112. to { opacity: 1; transform: translateY(0) scale(1); }
  2113. }
  2114. /* ---- logo ---- */
  2115. .splash-logo-wrap {
  2116. width: 160rpx; height: 160rpx;
  2117. border-radius: 40rpx;
  2118. background: rgba(255,255,255,0.95);
  2119. display: flex; align-items: center; justify-content: center;
  2120. margin-bottom: 16rpx;
  2121. box-shadow: 0 8rpx 32rpx rgba(249,115,22,0.25);
  2122. animation: splash-logo-pulse 2.5s ease-in-out infinite;
  2123. }
  2124. @keyframes splash-logo-pulse {
  2125. 0%, 100% { box-shadow: 0 8rpx 32rpx rgba(249,115,22,0.25); }
  2126. 50% { box-shadow: 0 8rpx 48rpx rgba(249,115,22,0.45); }
  2127. }
  2128. .splash-logo-img { width: 100rpx; height: 100rpx; }
  2129. /* ---- brand ---- */
  2130. .splash-brand-name {
  2131. font-size: 64rpx; font-weight: 800;
  2132. color: #7C2D12;
  2133. letter-spacing: 10rpx;
  2134. margin-bottom: 2rpx;
  2135. }
  2136. .splash-brand-en {
  2137. font-size: 20rpx;
  2138. color: rgba(124,45,18,0.5);
  2139. letter-spacing: 6rpx;
  2140. margin-bottom: 30rpx;
  2141. }
  2142. .splash-tagline {
  2143. font-size: 26rpx;
  2144. color: rgba(124,45,18,0.7);
  2145. letter-spacing: 4rpx;
  2146. margin-top: 24rpx;
  2147. }
  2148. /* ---- dims row from splash.vue (rounded circles) ---- */
  2149. .splash-dims-row {
  2150. display: flex; flex-direction: row;
  2151. align-items: center; justify-content: center;
  2152. gap: 28rpx;
  2153. }
  2154. .splash-dim-item {
  2155. display: flex; flex-direction: column;
  2156. align-items: center; gap: 8rpx;
  2157. }
  2158. .splash-dim-circle {
  2159. width: 80rpx; height: 80rpx;
  2160. border-radius: 50%;
  2161. display: flex; align-items: center; justify-content: center;
  2162. }
  2163. .splash-dim-icon { font-size: 36rpx; line-height: 1; }
  2164. .splash-dim-label {
  2165. font-size: 22rpx; font-weight: 500;
  2166. color: rgba(124,45,18,0.75);
  2167. line-height: 1;
  2168. }
  2169. /* ---- staggered dim entry from splash.vue ---- */
  2170. .splash-dim-item:nth-child(1) { animation: splash-dim-in 0.5s ease 0.1s both; }
  2171. .splash-dim-item:nth-child(2) { animation: splash-dim-in 0.5s ease 0.2s both; }
  2172. .splash-dim-item:nth-child(3) { animation: splash-dim-in 0.5s ease 0.3s both; }
  2173. .splash-dim-item:nth-child(4) { animation: splash-dim-in 0.5s ease 0.4s both; }
  2174. .splash-dim-item:nth-child(5) { animation: splash-dim-in 0.5s ease 0.5s both; }
  2175. @keyframes splash-dim-in {
  2176. from { opacity: 0; transform: translateY(16rpx) scale(0.8); }
  2177. to { opacity: 1; transform: translateY(0) scale(1); }
  2178. }
  2179. /* ---- loading dots ---- */
  2180. .splash-overlay-loading {
  2181. position: absolute;
  2182. bottom: 120rpx;
  2183. left: 0; right: 0;
  2184. display: flex;
  2185. justify-content: center;
  2186. align-items: center;
  2187. gap: 12rpx;
  2188. }
  2189. .splash-overlay-dot {
  2190. width: 14rpx; height: 14rpx;
  2191. border-radius: 50%;
  2192. background: rgba(249,115,22,0.6);
  2193. animation: splash-dot-bounce 1.4s ease-in-out infinite both;
  2194. }
  2195. .splash-overlay-dot:nth-child(1) { animation-delay: -0.32s; }
  2196. .splash-overlay-dot:nth-child(2) { animation-delay: -0.16s; }
  2197. .splash-overlay-dot:nth-child(3) { animation-delay: 0s; }
  2198. @keyframes splash-dot-bounce {
  2199. 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  2200. 40% { transform: scale(1); opacity: 1; }
  2201. }
  2202. /* ---- 登录态内容布局 ---- */
  2203. .logged-in-container {
  2204. padding-bottom: 120rpx;
  2205. }
  2206. /* ===== ① 了解区 — 自测大卡(引导"从了解开始") ===== */
  2207. .self-test-card {
  2208. margin: 20rpx 30rpx 16rpx;
  2209. background: linear-gradient(135deg, #667eea, #764ba2);
  2210. border-radius: 20rpx;
  2211. padding: 24rpx 28rpx;
  2212. }
  2213. .self-test-head { display: flex; align-items: center; }
  2214. .self-test-icon { font-size: 40rpx; margin-right: 16rpx; }
  2215. .self-test-info { flex: 1; }
  2216. .self-test-title { font-size: 28rpx; font-weight: bold; color: #fff; display: block; }
  2217. .self-test-sub { font-size: 22rpx; color: rgba(255,255,255,0.8); display: block; margin-top: 4rpx; }
  2218. .self-test-arrow { font-size: 36rpx; color: rgba(255,255,255,0.7); }
  2219. /* ===== ①.b 行动引导条 — Next Best Action ===== */
  2220. .guide-bar {
  2221. margin: 0 30rpx 16rpx;
  2222. border-radius: 20rpx;
  2223. padding: 18rpx 24rpx;
  2224. display: flex;
  2225. flex-direction: row;
  2226. align-items: center;
  2227. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  2228. }
  2229. .guide-bar-icon-wrap {
  2230. width: 72rpx;
  2231. height: 72rpx;
  2232. border-radius: 18rpx;
  2233. display: flex;
  2234. align-items: center;
  2235. justify-content: center;
  2236. margin-right: 16rpx;
  2237. flex-shrink: 0;
  2238. }
  2239. .guide-bar-icon { font-size: 34rpx; }
  2240. .guide-bar-info { flex: 1; min-width: 0; }
  2241. .guide-bar-title { font-size: 27rpx; font-weight: bold; display: block; }
  2242. .guide-bar-sub { font-size: 21rpx; margin-top: 3rpx; display: block; }
  2243. .guide-bar-btn {
  2244. flex-shrink: 0;
  2245. margin-left: 12rpx;
  2246. padding: 8rpx 20rpx;
  2247. border-radius: 999rpx;
  2248. font-size: 22rpx;
  2249. font-weight: bold;
  2250. }
  2251. .guide-bar-btn-text { }
  2252. /* 颜色主题 — 低饱和背景 + 深色文字,不抢自测卡风头 */
  2253. .guide-bar-orange { background: #FFF3E7; border: 1rpx solid rgba(249,115,22,0.18); }
  2254. .guide-bar-orange .guide-bar-icon-wrap { background: rgba(249,115,22,0.14); }
  2255. .guide-bar-orange .guide-bar-title { color: #9A3412; }
  2256. .guide-bar-orange .guide-bar-sub { color: #B45309; }
  2257. .guide-bar-orange .guide-bar-btn { background: linear-gradient(135deg, #F97316, #FB923C); color: #fff; }
  2258. .guide-bar-blue { background: #EFF4FF; border: 1rpx solid rgba(99,102,241,0.18); }
  2259. .guide-bar-blue .guide-bar-icon-wrap { background: rgba(99,102,241,0.12); }
  2260. .guide-bar-blue .guide-bar-title { color: #312E81; }
  2261. .guide-bar-blue .guide-bar-sub { color: #4338CA; }
  2262. .guide-bar-blue .guide-bar-btn { background: linear-gradient(135deg, #6366F1, #818CF8); color: #fff; }
  2263. .guide-bar-green { background: #ECFDF5; border: 1rpx solid rgba(16,185,129,0.18); }
  2264. .guide-bar-green .guide-bar-icon-wrap { background: rgba(16,185,129,0.12); }
  2265. .guide-bar-green .guide-bar-title { color: #064E3B; }
  2266. .guide-bar-green .guide-bar-sub { color: #047857; }
  2267. .guide-bar-green .guide-bar-btn { background: linear-gradient(135deg, #10B981, #34D399); color: #fff; }
  2268. .guide-bar-purple { background: #F5F3FF; border: 1rpx solid rgba(139,92,246,0.18); }
  2269. .guide-bar-purple .guide-bar-icon-wrap { background: rgba(139,92,246,0.12); }
  2270. .guide-bar-purple .guide-bar-title { color: #4C1D95; }
  2271. .guide-bar-purple .guide-bar-sub { color: #6D28D9; }
  2272. .guide-bar-purple .guide-bar-btn { background: linear-gradient(135deg, #8B5CF6, #A78BFA); color: #fff; }
  2273. .guide-bar-gray { background: #F8FAFC; border: 1rpx solid rgba(100,116,139,0.15); }
  2274. .guide-bar-gray .guide-bar-icon-wrap { background: rgba(100,116,139,0.10); }
  2275. .guide-bar-gray .guide-bar-title { color: #334155; }
  2276. .guide-bar-gray .guide-bar-sub { color: #64748B; }
  2277. .guide-bar-gray .guide-bar-btn { background: linear-gradient(135deg, #94A3B8, #CBD5E1); color: #fff; }
  2278. /* ===== 快捷功能入口(单排,6个横向排列) ===== */
  2279. .quick-bar {
  2280. display: flex;
  2281. flex-direction: row;
  2282. justify-content: space-between;
  2283. align-items: center;
  2284. background: #fff;
  2285. border-radius: 20rpx;
  2286. padding: 20rpx 10rpx;
  2287. }
  2288. .quick-item {
  2289. flex: 1;
  2290. display: flex;
  2291. flex-direction: column;
  2292. align-items: center;
  2293. gap: 8rpx;
  2294. }
  2295. .quick-icon {
  2296. width: 80rpx;
  2297. height: 80rpx;
  2298. border-radius: 20rpx;
  2299. display: flex;
  2300. align-items: center;
  2301. justify-content: center;
  2302. }
  2303. .quick-icon text {
  2304. font-size: 36rpx;
  2305. }
  2306. .quick-item .quick-label {
  2307. font-size: 26rpx;
  2308. color: #666;
  2309. }
  2310. /* ===== 我的任务快捷列表 ===== */
  2311. .task-quick-list {
  2312. display: flex;
  2313. flex-direction: column;
  2314. gap: 12rpx;
  2315. }
  2316. .task-quick-item {
  2317. display: flex;
  2318. flex-direction: row;
  2319. align-items: center;
  2320. justify-content: space-between;
  2321. background: #fff;
  2322. border-radius: 16rpx;
  2323. padding: 18rpx 24rpx;
  2324. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  2325. }
  2326. .task-quick-info {
  2327. display: flex;
  2328. flex-direction: column;
  2329. min-width: 0;
  2330. flex: 1;
  2331. }
  2332. .task-quick-title {
  2333. font-size: 26rpx;
  2334. color: #333;
  2335. font-weight: 500;
  2336. line-height: 1.4;
  2337. }
  2338. .task-quick-meta {
  2339. font-size: 22rpx;
  2340. color: #F97316;
  2341. margin-top: 4rpx;
  2342. font-weight: bold;
  2343. }
  2344. .btn-quick-complete {
  2345. margin-left: 16rpx;
  2346. padding: 8rpx 24rpx;
  2347. background: linear-gradient(135deg, #F97316, #FB923C);
  2348. color: #fff;
  2349. font-size: 24rpx;
  2350. font-weight: bold;
  2351. border-radius: 20rpx;
  2352. border: none;
  2353. line-height: 1;
  2354. height: 44rpx;
  2355. flex-shrink: 0;
  2356. }
  2357. .btn-quick-complete::after {
  2358. border: none;
  2359. }
  2360. /* ===== 家庭挑战空态 ===== */
  2361. .challenge-empty {
  2362. display: flex;
  2363. flex-direction: column;
  2364. align-items: center;
  2365. padding: 40rpx 0 20rpx;
  2366. }
  2367. .challenge-empty-icon {
  2368. font-size: 64rpx;
  2369. margin-bottom: 12rpx;
  2370. line-height: 1;
  2371. }
  2372. .challenge-empty-text {
  2373. font-size: 26rpx;
  2374. color: #999;
  2375. margin-bottom: 20rpx;
  2376. }
  2377. .challenge-add-btn {
  2378. padding: 10rpx 32rpx;
  2379. background: linear-gradient(135deg, #F97316, #FB923C);
  2380. color: #fff;
  2381. font-size: 24rpx;
  2382. font-weight: bold;
  2383. border-radius: 24rpx;
  2384. border: none;
  2385. line-height: 1;
  2386. height: 48rpx;
  2387. }
  2388. .challenge-add-btn::after {
  2389. border: none;
  2390. }
  2391. .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; }
  2392. </style>