index.vue 75 KB

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