index.vue 100 KB

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