index.vue 97 KB

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