index.vue 64 KB

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