index.vue 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323
  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. /** 转发给朋友/群 */
  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. imageUrl: '/static/share-cover.png'
  1347. }
  1348. },
  1349. /** 分享到朋友圈 */
  1350. onShareTimeline: function() {
  1351. var query = ''
  1352. if (this.referralCode) {
  1353. query = 'refCode=' + this.referralCode
  1354. }
  1355. return {
  1356. title: '浠艾福 · 家庭五维幸福成长',
  1357. query: query,
  1358. imageUrl: '/static/share-cover.png'
  1359. }
  1360. }
  1361. }
  1362. }
  1363. </script>
  1364. <style>
  1365. .discover-container {
  1366. min-height: 100vh;
  1367. background: #f5f7fa;
  1368. padding-bottom: 100rpx;
  1369. }
  1370. /* ===== 品牌 Hero 区 ===== */
  1371. .hero-section {
  1372. margin: 24rpx 30rpx 0;
  1373. padding: 40rpx 32rpx;
  1374. background: linear-gradient(160deg, #FFF7ED 0%, #FED7AA 60%, rgba(249,115,22,0.15) 100%);
  1375. border-radius: 24rpx;
  1376. text-align: center;
  1377. border: 1rpx solid rgba(249,115,22,0.12);
  1378. }
  1379. .hero-logo {
  1380. width: 100rpx;
  1381. height: 100rpx;
  1382. border-radius: 50rpx;
  1383. background: #fff;
  1384. box-shadow: 0 8rpx 24rpx rgba(249,115,22,0.18);
  1385. }
  1386. .hero-name {
  1387. display: block;
  1388. font-size: 48rpx;
  1389. font-weight: bold;
  1390. color: #7C2D12;
  1391. margin-top: 16rpx;
  1392. letter-spacing: 6rpx;
  1393. }
  1394. .hero-slogan {
  1395. display: block;
  1396. font-size: 26rpx;
  1397. color: #9A3412;
  1398. margin-top: 8rpx;
  1399. font-weight: 500;
  1400. }
  1401. .hero-powered {
  1402. display: block;
  1403. font-size: 20rpx;
  1404. color: rgba(124,45,18,0.45);
  1405. margin-top: 10rpx;
  1406. }
  1407. .hero-dims {
  1408. display: flex;
  1409. justify-content: center;
  1410. gap: 16rpx;
  1411. margin-top: 28rpx;
  1412. flex-wrap: wrap;
  1413. }
  1414. .hero-dim {
  1415. display: flex;
  1416. flex-direction: column;
  1417. align-items: center;
  1418. gap: 6rpx;
  1419. padding: 12rpx 16rpx;
  1420. background: rgba(255,255,255,0.7);
  1421. border-radius: 16rpx;
  1422. }
  1423. .hero-dim-emoji {
  1424. font-size: 32rpx;
  1425. }
  1426. .hero-dim-label {
  1427. font-size: 20rpx;
  1428. color: #7C2D12;
  1429. font-weight: 500;
  1430. white-space: nowrap;
  1431. }
  1432. /* ===== 未登录态 Hero 副标语 / CTA ===== */
  1433. .hero-sub-slogan {
  1434. display: block;
  1435. font-size: 22rpx;
  1436. color: #EA580C;
  1437. margin-top: 18rpx;
  1438. font-weight: 500;
  1439. }
  1440. .hero-cta-btn {
  1441. margin: 28rpx auto 0;
  1442. display: block;
  1443. width: 420rpx;
  1444. height: 80rpx;
  1445. line-height: 80rpx;
  1446. background: linear-gradient(135deg, #F97316, #FB923C);
  1447. color: #fff;
  1448. font-size: 28rpx;
  1449. font-weight: bold;
  1450. border-radius: 40rpx;
  1451. text-align: center;
  1452. border: none;
  1453. box-shadow: 0 8rpx 20rpx rgba(249,115,22,0.3);
  1454. }
  1455. .hero-cta-btn::after {
  1456. border: none;
  1457. }
  1458. /* ===== 价值主张(为什么选择浠艾福) ===== */
  1459. .value-prop-section {
  1460. margin: 24rpx 30rpx 0;
  1461. }
  1462. .value-prop-title {
  1463. display: block;
  1464. font-size: 32rpx;
  1465. font-weight: bold;
  1466. color: #333;
  1467. text-align: center;
  1468. margin-bottom: 20rpx;
  1469. }
  1470. .value-prop-grid {
  1471. display: flex;
  1472. flex-wrap: wrap;
  1473. justify-content: space-between;
  1474. }
  1475. .value-prop-card {
  1476. width: 48.5%;
  1477. box-sizing: border-box;
  1478. background: #fff;
  1479. border-radius: 20rpx;
  1480. padding: 22rpx;
  1481. margin-bottom: 16rpx;
  1482. box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.05);
  1483. display: flex;
  1484. flex-direction: row;
  1485. align-items: flex-start;
  1486. }
  1487. .value-prop-icon {
  1488. font-size: 40rpx;
  1489. line-height: 1.3;
  1490. margin-right: 12rpx;
  1491. flex-shrink: 0;
  1492. }
  1493. .value-prop-texts {
  1494. display: flex;
  1495. flex-direction: column;
  1496. flex: 1;
  1497. min-width: 0;
  1498. }
  1499. .value-prop-name {
  1500. font-size: 28rpx;
  1501. font-weight: bold;
  1502. color: #333;
  1503. }
  1504. .value-prop-desc {
  1505. font-size: 22rpx;
  1506. color: #999;
  1507. margin-top: 8rpx;
  1508. line-height: 1.5;
  1509. }
  1510. /* ===== 三步上手 ===== */
  1511. .how-it-works {
  1512. margin: 32rpx 30rpx 0;
  1513. padding: 32rpx 24rpx;
  1514. background: #fff;
  1515. border-radius: 24rpx;
  1516. box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.04);
  1517. }
  1518. .how-it-works-title {
  1519. display: block;
  1520. font-size: 32rpx;
  1521. font-weight: bold;
  1522. color: #333;
  1523. text-align: center;
  1524. margin-bottom: 28rpx;
  1525. }
  1526. .step-row {
  1527. display: flex;
  1528. align-items: flex-start;
  1529. justify-content: space-between;
  1530. }
  1531. .step-item {
  1532. display: flex;
  1533. flex-direction: column;
  1534. align-items: center;
  1535. flex: 1;
  1536. min-width: 0;
  1537. }
  1538. .step-num {
  1539. width: 48rpx;
  1540. height: 48rpx;
  1541. line-height: 48rpx;
  1542. border-radius: 50%;
  1543. background: linear-gradient(135deg, #F97316, #FB923C);
  1544. color: #fff;
  1545. font-size: 26rpx;
  1546. font-weight: bold;
  1547. text-align: center;
  1548. box-shadow: 0 4rpx 12rpx rgba(249,115,22,0.3);
  1549. }
  1550. .step-name {
  1551. font-size: 24rpx;
  1552. color: #333;
  1553. font-weight: 500;
  1554. margin-top: 12rpx;
  1555. text-align: center;
  1556. }
  1557. .step-sub {
  1558. font-size: 20rpx;
  1559. color: #999;
  1560. margin-top: 4rpx;
  1561. text-align: center;
  1562. }
  1563. .step-arrow {
  1564. font-size: 28rpx;
  1565. color: #F97316;
  1566. line-height: 1;
  1567. align-self: center;
  1568. padding: 0 6rpx;
  1569. }
  1570. /* ===== 品牌定位语(保留旧样式,不再使用) ===== */
  1571. .brand-strap {
  1572. margin: 16rpx 30rpx 0;
  1573. padding: 20rpx 28rpx;
  1574. background: linear-gradient(135deg, #FFF7ED, rgba(249,115,22,0.10));
  1575. border-radius: 16rpx;
  1576. border-left: 4rpx solid #F97316;
  1577. }
  1578. .brand-strap-text {
  1579. font-size: 26rpx;
  1580. color: #9A3412;
  1581. font-weight: 500;
  1582. }
  1583. /* ===== 会员入口卡(能量沙盘下方) ===== */
  1584. .member-entry {
  1585. display: flex;
  1586. align-items: center;
  1587. margin: 20rpx 30rpx 0;
  1588. background: linear-gradient(135deg, #F97316, #FB923C);
  1589. border-radius: 20rpx;
  1590. padding: 24rpx 30rpx;
  1591. }
  1592. .member-entry-icon-wrap {
  1593. width: 64rpx;
  1594. height: 64rpx;
  1595. border-radius: 50%;
  1596. background: rgba(255,255,255,0.2);
  1597. display: flex;
  1598. align-items: center;
  1599. justify-content: center;
  1600. margin-right: 16rpx;
  1601. flex-shrink: 0;
  1602. }
  1603. .member-entry-icon {
  1604. font-size: 36rpx;
  1605. }
  1606. .member-entry-texts {
  1607. flex: 1;
  1608. display: flex;
  1609. flex-direction: column;
  1610. min-width: 0;
  1611. }
  1612. .member-entry-title {
  1613. font-size: 30rpx;
  1614. font-weight: bold;
  1615. color: #fff;
  1616. }
  1617. .member-entry-desc {
  1618. font-size: 22rpx;
  1619. color: rgba(255,255,255,0.85);
  1620. margin-top: 4rpx;
  1621. overflow: hidden;
  1622. text-overflow: ellipsis;
  1623. white-space: nowrap;
  1624. }
  1625. .member-entry-btn {
  1626. margin-left: 16rpx;
  1627. padding: 10rpx 24rpx;
  1628. background: #fff;
  1629. border-radius: 30rpx;
  1630. flex-shrink: 0;
  1631. }
  1632. .member-entry-btn-text {
  1633. font-size: 24rpx;
  1634. color: #F97316;
  1635. font-weight: bold;
  1636. }
  1637. /* ===== 活动/阅读共用状态样式 ===== */
  1638. .loading-state,
  1639. .empty-state {
  1640. display: flex;
  1641. justify-content: center;
  1642. padding: 60rpx 0;
  1643. }
  1644. .loading-text,
  1645. .empty-text {
  1646. font-size: 26rpx;
  1647. color: #999;
  1648. }
  1649. /* ===== 五维全景幸福矩阵 ===== */
  1650. /* ===== 底部登录 ===== */
  1651. .login-footer {
  1652. margin: 40rpx 30rpx;
  1653. display: flex;
  1654. flex-direction: column;
  1655. align-items: center;
  1656. }
  1657. .login-btn {
  1658. width: 100%;
  1659. height: 88rpx;
  1660. line-height: 88rpx;
  1661. background: linear-gradient(135deg, #F97316, #FB923C);
  1662. color: #fff;
  1663. font-size: 32rpx;
  1664. font-weight: bold;
  1665. border-radius: 44rpx;
  1666. text-align: center;
  1667. border: none;
  1668. box-shadow: 0 8rpx 24rpx rgba(249,115,22,0.3);
  1669. }
  1670. .login-btn::after {
  1671. border: none;
  1672. }
  1673. .login-footer-text {
  1674. font-size: 22rpx;
  1675. color: #F97316;
  1676. margin-top: 16rpx;
  1677. font-weight: 500;
  1678. }
  1679. /* ===== 加载占位 ===== */
  1680. .loading-container {
  1681. display: flex;
  1682. justify-content: center;
  1683. align-items: center;
  1684. height: 100vh;
  1685. }
  1686. /* ===== 角色切换淡入淡出 ===== */
  1687. .role-switch-wrapper {
  1688. width: 100%;
  1689. min-height: 100vh;
  1690. }
  1691. .fade-enter-active,
  1692. .fade-leave-active {
  1693. transition: opacity 0.3s ease;
  1694. }
  1695. .fade-enter,
  1696. .fade-leave-to {
  1697. opacity: 0;
  1698. }
  1699. /* ===== 通用区块样式 ===== */
  1700. .section {
  1701. margin: 20rpx 30rpx;
  1702. }
  1703. .section-header {
  1704. display: flex;
  1705. justify-content: space-between;
  1706. align-items: center;
  1707. margin-bottom: 20rpx;
  1708. }
  1709. .section-title {
  1710. font-size: 30rpx;
  1711. font-weight: bold;
  1712. color: #333;
  1713. }
  1714. .section-more {
  1715. font-size: 24rpx;
  1716. color: #5B9BD5;
  1717. }
  1718. .empty-state {
  1719. display: flex;
  1720. justify-content: center;
  1721. padding: 60rpx 0;
  1722. }
  1723. .empty-text {
  1724. font-size: 26rpx;
  1725. color: #999;
  1726. }
  1727. /* ===== 活动列表 ===== */
  1728. .activity-list {
  1729. display: flex;
  1730. flex-direction: column;
  1731. gap: 16rpx;
  1732. }
  1733. .activity-card {
  1734. background: #fff;
  1735. border-radius: 16rpx;
  1736. overflow: hidden;
  1737. display: flex;
  1738. flex-direction: row;
  1739. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1740. }
  1741. .activity-card:active {
  1742. opacity: 0.8;
  1743. }
  1744. .activity-cover {
  1745. width: 200rpx;
  1746. height: 160rpx;
  1747. flex-shrink: 0;
  1748. background: #f0f0f0;
  1749. }
  1750. .activity-info {
  1751. flex: 1;
  1752. padding: 16rpx;
  1753. display: flex;
  1754. flex-direction: column;
  1755. justify-content: space-between;
  1756. }
  1757. .activity-name {
  1758. font-size: 28rpx;
  1759. font-weight: bold;
  1760. color: #333;
  1761. margin-bottom: 8rpx;
  1762. }
  1763. .line-clamp-1 {
  1764. overflow: hidden;
  1765. text-overflow: ellipsis;
  1766. white-space: nowrap;
  1767. }
  1768. .activity-meta {
  1769. display: flex;
  1770. align-items: center;
  1771. margin-bottom: 8rpx;
  1772. }
  1773. .activity-time {
  1774. font-size: 22rpx;
  1775. color: #999;
  1776. }
  1777. .activity-bottom {
  1778. display: flex;
  1779. align-items: center;
  1780. gap: 12rpx;
  1781. }
  1782. .activity-status {
  1783. font-size: 20rpx;
  1784. padding: 2rpx 10rpx;
  1785. border-radius: 8rpx;
  1786. background: #E8F5E9;
  1787. color: #2E7D32;
  1788. }
  1789. .activity-status.status-upcoming {
  1790. background: #E3F2FD;
  1791. color: #1565C0;
  1792. }
  1793. .activity-status.status-ended {
  1794. background: #F5F5F5;
  1795. color: #999;
  1796. }
  1797. .activity-fee {
  1798. font-size: 24rpx;
  1799. color: #F97316;
  1800. font-weight: bold;
  1801. }
  1802. .activity-fee.fee-free {
  1803. color: #4CAF50;
  1804. }
  1805. /* ===== 文章列表 ===== */
  1806. .article-list {
  1807. display: flex;
  1808. flex-direction: column;
  1809. gap: 16rpx;
  1810. }
  1811. .article-card {
  1812. background: #fff;
  1813. border-radius: 16rpx;
  1814. padding: 24rpx;
  1815. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1816. }
  1817. .article-card:active {
  1818. opacity: 0.8;
  1819. }
  1820. .article-category {
  1821. display: inline-block;
  1822. padding: 4rpx 14rpx;
  1823. border-radius: 8rpx;
  1824. margin-bottom: 10rpx;
  1825. }
  1826. .article-category-text {
  1827. font-size: 20rpx;
  1828. color: #fff;
  1829. }
  1830. .article-title {
  1831. display: block;
  1832. font-size: 28rpx;
  1833. font-weight: bold;
  1834. color: #333;
  1835. margin-bottom: 8rpx;
  1836. line-height: 1.4;
  1837. }
  1838. .article-summary {
  1839. display: block;
  1840. font-size: 24rpx;
  1841. color: #888;
  1842. line-height: 1.5;
  1843. margin-bottom: 12rpx;
  1844. overflow: hidden;
  1845. text-overflow: ellipsis;
  1846. display: -webkit-box;
  1847. -webkit-line-clamp: 2;
  1848. -webkit-box-orient: vertical;
  1849. }
  1850. .article-meta {
  1851. display: flex;
  1852. align-items: center;
  1853. gap: 16rpx;
  1854. }
  1855. .meta-item {
  1856. display: flex;
  1857. align-items: center;
  1858. gap: 4rpx;
  1859. }
  1860. .meta-icon {
  1861. font-size: 24rpx;
  1862. }
  1863. .meta-text {
  1864. font-size: 22rpx;
  1865. color: #999;
  1866. }
  1867. .article-date {
  1868. font-size: 22rpx;
  1869. color: #bbb;
  1870. }
  1871. /* ===== Splash Loading Overlay(冷启动蒙板,来自 merge splash.vue) ===== */
  1872. .splash-overlay {
  1873. position: fixed;
  1874. top: 0; left: 0; right: 0; bottom: 0;
  1875. z-index: 9999;
  1876. display: flex;
  1877. align-items: center;
  1878. justify-content: center;
  1879. background: linear-gradient(160deg, #FFF7ED 0%, #FFEDD5 50%, #FED7AA 100%);
  1880. overflow: hidden;
  1881. opacity: 1;
  1882. transition: opacity 0.4s ease;
  1883. }
  1884. .splash-overlay.fade-out {
  1885. opacity: 0;
  1886. pointer-events: none;
  1887. }
  1888. /* ---- bg circles from splash.vue ---- */
  1889. .splash-overlay-bg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; }
  1890. .bg-circle {
  1891. position: absolute;
  1892. border-radius: 50%;
  1893. opacity: 0.12;
  1894. }
  1895. .bg-circle-1 {
  1896. width: 400rpx; height: 400rpx;
  1897. background: #FF8C42;
  1898. top: -100rpx; right: -80rpx;
  1899. animation: splash-float-1 4s ease-in-out infinite;
  1900. }
  1901. .bg-circle-2 {
  1902. width: 280rpx; height: 280rpx;
  1903. background: #FF6B9D;
  1904. bottom: 80rpx; left: -60rpx;
  1905. animation: splash-float-2 5s ease-in-out infinite;
  1906. }
  1907. .bg-circle-3 {
  1908. width: 180rpx; height: 180rpx;
  1909. background: #6366F1;
  1910. top: 50%; right: -40rpx;
  1911. animation: splash-float-3 6s ease-in-out infinite;
  1912. }
  1913. @keyframes splash-float-1 {
  1914. 0%, 100% { transform: translateY(0) scale(1); }
  1915. 50% { transform: translateY(-30rpx) scale(1.05); }
  1916. }
  1917. @keyframes splash-float-2 {
  1918. 0%, 100% { transform: translateY(0) scale(1); }
  1919. 50% { transform: translateY(20rpx) scale(1.08); }
  1920. }
  1921. @keyframes splash-float-3 {
  1922. 0%, 100% { transform: translateY(0) rotate(0deg); }
  1923. 50% { transform: translateY(-20rpx) rotate(10deg); }
  1924. }
  1925. /* ---- body fade-in ---- */
  1926. .splash-overlay-body {
  1927. display: flex;
  1928. flex-direction: column;
  1929. align-items: center;
  1930. animation: splash-body-in 0.8s cubic-bezier(0.16,1,0.3,1) forwards;
  1931. }
  1932. @keyframes splash-body-in {
  1933. from { opacity: 0; transform: translateY(40rpx) scale(0.96); }
  1934. to { opacity: 1; transform: translateY(0) scale(1); }
  1935. }
  1936. /* ---- logo ---- */
  1937. .splash-logo-wrap {
  1938. width: 160rpx; height: 160rpx;
  1939. border-radius: 40rpx;
  1940. background: rgba(255,255,255,0.95);
  1941. display: flex; align-items: center; justify-content: center;
  1942. margin-bottom: 16rpx;
  1943. box-shadow: 0 8rpx 32rpx rgba(249,115,22,0.25);
  1944. animation: splash-logo-pulse 2.5s ease-in-out infinite;
  1945. }
  1946. @keyframes splash-logo-pulse {
  1947. 0%, 100% { box-shadow: 0 8rpx 32rpx rgba(249,115,22,0.25); }
  1948. 50% { box-shadow: 0 8rpx 48rpx rgba(249,115,22,0.45); }
  1949. }
  1950. .splash-logo-img { width: 100rpx; height: 100rpx; }
  1951. /* ---- brand ---- */
  1952. .splash-brand-name {
  1953. font-size: 64rpx; font-weight: 800;
  1954. color: #7C2D12;
  1955. letter-spacing: 10rpx;
  1956. margin-bottom: 2rpx;
  1957. }
  1958. .splash-brand-en {
  1959. font-size: 20rpx;
  1960. color: rgba(124,45,18,0.5);
  1961. letter-spacing: 6rpx;
  1962. margin-bottom: 30rpx;
  1963. }
  1964. .splash-tagline {
  1965. font-size: 26rpx;
  1966. color: rgba(124,45,18,0.7);
  1967. letter-spacing: 4rpx;
  1968. margin-top: 24rpx;
  1969. }
  1970. /* ---- dims row from splash.vue (rounded circles) ---- */
  1971. .splash-dims-row {
  1972. display: flex; flex-direction: row;
  1973. align-items: center; justify-content: center;
  1974. gap: 28rpx;
  1975. }
  1976. .splash-dim-item {
  1977. display: flex; flex-direction: column;
  1978. align-items: center; gap: 8rpx;
  1979. }
  1980. .splash-dim-circle {
  1981. width: 80rpx; height: 80rpx;
  1982. border-radius: 50%;
  1983. display: flex; align-items: center; justify-content: center;
  1984. }
  1985. .splash-dim-icon { font-size: 36rpx; line-height: 1; }
  1986. .splash-dim-label {
  1987. font-size: 22rpx; font-weight: 500;
  1988. color: rgba(124,45,18,0.75);
  1989. line-height: 1;
  1990. }
  1991. /* ---- staggered dim entry from splash.vue ---- */
  1992. .splash-dim-item:nth-child(1) { animation: splash-dim-in 0.5s ease 0.1s both; }
  1993. .splash-dim-item:nth-child(2) { animation: splash-dim-in 0.5s ease 0.2s both; }
  1994. .splash-dim-item:nth-child(3) { animation: splash-dim-in 0.5s ease 0.3s both; }
  1995. .splash-dim-item:nth-child(4) { animation: splash-dim-in 0.5s ease 0.4s both; }
  1996. .splash-dim-item:nth-child(5) { animation: splash-dim-in 0.5s ease 0.5s both; }
  1997. @keyframes splash-dim-in {
  1998. from { opacity: 0; transform: translateY(16rpx) scale(0.8); }
  1999. to { opacity: 1; transform: translateY(0) scale(1); }
  2000. }
  2001. /* ---- loading dots ---- */
  2002. .splash-overlay-loading {
  2003. position: absolute;
  2004. bottom: 120rpx;
  2005. left: 0; right: 0;
  2006. display: flex;
  2007. justify-content: center;
  2008. align-items: center;
  2009. gap: 12rpx;
  2010. }
  2011. .splash-overlay-dot {
  2012. width: 14rpx; height: 14rpx;
  2013. border-radius: 50%;
  2014. background: rgba(249,115,22,0.6);
  2015. animation: splash-dot-bounce 1.4s ease-in-out infinite both;
  2016. }
  2017. .splash-overlay-dot:nth-child(1) { animation-delay: -0.32s; }
  2018. .splash-overlay-dot:nth-child(2) { animation-delay: -0.16s; }
  2019. .splash-overlay-dot:nth-child(3) { animation-delay: 0s; }
  2020. @keyframes splash-dot-bounce {
  2021. 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  2022. 40% { transform: scale(1); opacity: 1; }
  2023. }
  2024. /* ---- 登录态内容布局 ---- */
  2025. .logged-in-container {
  2026. padding-bottom: 120rpx;
  2027. }
  2028. /* ===== ① 了解区 — 自测大卡(引导"从了解开始") ===== */
  2029. .self-test-card {
  2030. margin: 20rpx 30rpx 16rpx;
  2031. background: linear-gradient(135deg, #667eea, #764ba2);
  2032. border-radius: 20rpx;
  2033. padding: 24rpx 28rpx;
  2034. }
  2035. .self-test-head { display: flex; align-items: center; }
  2036. .self-test-icon { font-size: 40rpx; margin-right: 16rpx; }
  2037. .self-test-info { flex: 1; }
  2038. .self-test-title { font-size: 28rpx; font-weight: bold; color: #fff; display: block; }
  2039. .self-test-sub { font-size: 22rpx; color: rgba(255,255,255,0.8); display: block; margin-top: 4rpx; }
  2040. .self-test-arrow { font-size: 36rpx; color: rgba(255,255,255,0.7); }
  2041. /* ===== ①.b 行动引导条 — Next Best Action ===== */
  2042. .guide-bar {
  2043. margin: 0 30rpx 16rpx;
  2044. border-radius: 20rpx;
  2045. padding: 18rpx 24rpx;
  2046. display: flex;
  2047. flex-direction: row;
  2048. align-items: center;
  2049. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  2050. }
  2051. .guide-bar-icon-wrap {
  2052. width: 72rpx;
  2053. height: 72rpx;
  2054. border-radius: 18rpx;
  2055. display: flex;
  2056. align-items: center;
  2057. justify-content: center;
  2058. margin-right: 16rpx;
  2059. flex-shrink: 0;
  2060. }
  2061. .guide-bar-icon { font-size: 34rpx; }
  2062. .guide-bar-info { flex: 1; min-width: 0; }
  2063. .guide-bar-title { font-size: 27rpx; font-weight: bold; display: block; }
  2064. .guide-bar-sub { font-size: 21rpx; margin-top: 3rpx; display: block; }
  2065. .guide-bar-btn {
  2066. flex-shrink: 0;
  2067. margin-left: 12rpx;
  2068. padding: 8rpx 20rpx;
  2069. border-radius: 999rpx;
  2070. font-size: 22rpx;
  2071. font-weight: bold;
  2072. }
  2073. .guide-bar-btn-text { }
  2074. /* 颜色主题 — 低饱和背景 + 深色文字,不抢自测卡风头 */
  2075. .guide-bar-orange { background: #FFF3E7; border: 1rpx solid rgba(249,115,22,0.18); }
  2076. .guide-bar-orange .guide-bar-icon-wrap { background: rgba(249,115,22,0.14); }
  2077. .guide-bar-orange .guide-bar-title { color: #9A3412; }
  2078. .guide-bar-orange .guide-bar-sub { color: #B45309; }
  2079. .guide-bar-orange .guide-bar-btn { background: linear-gradient(135deg, #F97316, #FB923C); color: #fff; }
  2080. .guide-bar-blue { background: #EFF4FF; border: 1rpx solid rgba(99,102,241,0.18); }
  2081. .guide-bar-blue .guide-bar-icon-wrap { background: rgba(99,102,241,0.12); }
  2082. .guide-bar-blue .guide-bar-title { color: #312E81; }
  2083. .guide-bar-blue .guide-bar-sub { color: #4338CA; }
  2084. .guide-bar-blue .guide-bar-btn { background: linear-gradient(135deg, #6366F1, #818CF8); color: #fff; }
  2085. .guide-bar-green { background: #ECFDF5; border: 1rpx solid rgba(16,185,129,0.18); }
  2086. .guide-bar-green .guide-bar-icon-wrap { background: rgba(16,185,129,0.12); }
  2087. .guide-bar-green .guide-bar-title { color: #064E3B; }
  2088. .guide-bar-green .guide-bar-sub { color: #047857; }
  2089. .guide-bar-green .guide-bar-btn { background: linear-gradient(135deg, #10B981, #34D399); color: #fff; }
  2090. .guide-bar-purple { background: #F5F3FF; border: 1rpx solid rgba(139,92,246,0.18); }
  2091. .guide-bar-purple .guide-bar-icon-wrap { background: rgba(139,92,246,0.12); }
  2092. .guide-bar-purple .guide-bar-title { color: #4C1D95; }
  2093. .guide-bar-purple .guide-bar-sub { color: #6D28D9; }
  2094. .guide-bar-purple .guide-bar-btn { background: linear-gradient(135deg, #8B5CF6, #A78BFA); color: #fff; }
  2095. .guide-bar-gray { background: #F8FAFC; border: 1rpx solid rgba(100,116,139,0.15); }
  2096. .guide-bar-gray .guide-bar-icon-wrap { background: rgba(100,116,139,0.10); }
  2097. .guide-bar-gray .guide-bar-title { color: #334155; }
  2098. .guide-bar-gray .guide-bar-sub { color: #64748B; }
  2099. .guide-bar-gray .guide-bar-btn { background: linear-gradient(135deg, #94A3B8, #CBD5E1); color: #fff; }
  2100. /* ===== 快捷功能入口(单排,6个横向排列) ===== */
  2101. .quick-bar {
  2102. display: flex;
  2103. flex-direction: row;
  2104. justify-content: space-between;
  2105. align-items: center;
  2106. background: #fff;
  2107. border-radius: 20rpx;
  2108. padding: 20rpx 10rpx;
  2109. }
  2110. .quick-item {
  2111. flex: 1;
  2112. display: flex;
  2113. flex-direction: column;
  2114. align-items: center;
  2115. gap: 8rpx;
  2116. }
  2117. .quick-icon {
  2118. width: 80rpx;
  2119. height: 80rpx;
  2120. border-radius: 20rpx;
  2121. display: flex;
  2122. align-items: center;
  2123. justify-content: center;
  2124. }
  2125. .quick-icon text {
  2126. font-size: 36rpx;
  2127. }
  2128. .quick-item .quick-label {
  2129. font-size: 26rpx;
  2130. color: #666;
  2131. }
  2132. /* ===== 我的任务快捷列表 ===== */
  2133. .task-quick-list {
  2134. display: flex;
  2135. flex-direction: column;
  2136. gap: 12rpx;
  2137. }
  2138. .task-quick-item {
  2139. display: flex;
  2140. flex-direction: row;
  2141. align-items: center;
  2142. justify-content: space-between;
  2143. background: #fff;
  2144. border-radius: 16rpx;
  2145. padding: 18rpx 24rpx;
  2146. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  2147. }
  2148. .task-quick-info {
  2149. display: flex;
  2150. flex-direction: column;
  2151. min-width: 0;
  2152. flex: 1;
  2153. }
  2154. .task-quick-title {
  2155. font-size: 26rpx;
  2156. color: #333;
  2157. font-weight: 500;
  2158. line-height: 1.4;
  2159. }
  2160. .task-quick-meta {
  2161. font-size: 22rpx;
  2162. color: #F97316;
  2163. margin-top: 4rpx;
  2164. font-weight: bold;
  2165. }
  2166. .btn-quick-complete {
  2167. margin-left: 16rpx;
  2168. padding: 8rpx 24rpx;
  2169. background: linear-gradient(135deg, #F97316, #FB923C);
  2170. color: #fff;
  2171. font-size: 24rpx;
  2172. font-weight: bold;
  2173. border-radius: 20rpx;
  2174. border: none;
  2175. line-height: 1;
  2176. height: 44rpx;
  2177. flex-shrink: 0;
  2178. }
  2179. .btn-quick-complete::after {
  2180. border: none;
  2181. }
  2182. /* ===== 家庭挑战空态 ===== */
  2183. .challenge-empty {
  2184. display: flex;
  2185. flex-direction: column;
  2186. align-items: center;
  2187. padding: 40rpx 0 20rpx;
  2188. }
  2189. .challenge-empty-icon {
  2190. font-size: 64rpx;
  2191. margin-bottom: 12rpx;
  2192. line-height: 1;
  2193. }
  2194. .challenge-empty-text {
  2195. font-size: 26rpx;
  2196. color: #999;
  2197. margin-bottom: 20rpx;
  2198. }
  2199. .challenge-add-btn {
  2200. padding: 10rpx 32rpx;
  2201. background: linear-gradient(135deg, #F97316, #FB923C);
  2202. color: #fff;
  2203. font-size: 24rpx;
  2204. font-weight: bold;
  2205. border-radius: 24rpx;
  2206. border: none;
  2207. line-height: 1;
  2208. height: 48rpx;
  2209. }
  2210. .challenge-add-btn::after {
  2211. border: none;
  2212. }
  2213. .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; }
  2214. </style>