index.vue 58 KB

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