index.vue 54 KB

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