index.vue 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783
  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{1F4AC}', label: '记录互动', needLogin: true, page: '/pages/action-detail/interaction-log' },
  429. { icon: '\u{1F3E0}', label: '家庭天盘', needLogin: true, page: '/pages/mind-detail/family-dashboard' },
  430. { icon: '\u{1F468}\u200D\u{1F469}\u200D\u{1F467}', label: '成员管理', needLogin: true, page: '/pages/profile-extra/family-members' }
  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 self = this
  659. getChallengeList({}).then(function(res) {
  660. if (res.code === 200 && Array.isArray(res.data)) {
  661. self.activeChallenges = res.data
  662. }
  663. }).catch(function() {
  664. self.activeChallenges = []
  665. })
  666. },
  667. loadMyCircles: function() {
  668. var self = this
  669. if (!this.currentChildId) return
  670. getMyCircles(this.currentChildId, 'child').then(function(res) {
  671. if (res.code === 200 && res.data) {
  672. self.myCircles = Array.isArray(res.data) ? res.data : (res.data.list || [])
  673. }
  674. }).catch(function() { self.myCircles = [] })
  675. },
  676. loadDiscoverCircles: function() {
  677. var self = this
  678. if (!this.currentChildId) return
  679. discoverCircles(this.currentChildId).then(function(res) {
  680. if (res.code === 200 && res.data) {
  681. self.discoverCirclesList = Array.isArray(res.data) ? res.data.slice(0, 3) : []
  682. }
  683. }).catch(function() { self.discoverCirclesList = [] })
  684. },
  685. getCircleKey: function(item) {
  686. return item.id || item.circleId || Math.random()
  687. },
  688. onCircleClick: function(item) {
  689. this.detailCircle = item
  690. this.selectedCircleIsMember = item.isMember || false
  691. this.circleDetailVisible = true
  692. },
  693. onCircleJoin: function(circle) {
  694. var self = this
  695. joinGeneralCircle({ circleId: circle.id }).then(function(res) {
  696. if (res.code === 200) {
  697. self.circleDetailVisible = false
  698. self.loadMyCircles()
  699. self.loadDiscoverCircles()
  700. uni.showToast({ title: '加入成功', icon: 'success' })
  701. }
  702. }).catch(function() {})
  703. },
  704. onCircleLeave: function(circle) {
  705. var self = this
  706. leaveGeneralCircle({ circleId: circle.id }).then(function(res) {
  707. if (res.code === 200) {
  708. self.circleDetailVisible = false
  709. self.loadMyCircles()
  710. self.loadDiscoverCircles()
  711. uni.showToast({ title: '已退出', icon: 'none' })
  712. }
  713. }).catch(function() {})
  714. },
  715. goDiscoverCircles: function() {
  716. uni.navigateTo({ url: '/pages/discover/circles' })
  717. },
  718. loadFamilyMembers: function() {
  719. var self = this
  720. getVisibleFamilyMembers().then(function(res) {
  721. if (res.code === 200 && res.data) {
  722. self.familyMembersVisible = Array.isArray(res.data) ? res.data : (res.data.list || [])
  723. }
  724. }).catch(function() {})
  725. },
  726. parseRelatedDimensions: function(val) {
  727. if (!val) return []
  728. if (Array.isArray(val)) return val
  729. if (typeof val === 'string') {
  730. try {
  731. var parsed = JSON.parse(val)
  732. return Array.isArray(parsed) ? parsed : []
  733. } catch (e) {
  734. return val.split(',').map(function(s) { return s.trim() }).filter(function(s) { return s })
  735. }
  736. }
  737. return []
  738. },
  739. onFamilyMemberSelect: function(member) {
  740. this.selectedMemberId = member.id
  741. },
  742. onFamilyMemberSwitch: function(member) {
  743. var self = this
  744. if (!member || !member.id) return
  745. switchToFamilyMember(member.id, member.source || 'family_member').then(function(res) {
  746. if (res.code === 200 && res.data) {
  747. store.commit('switchToMember', {
  748. memberId: res.data.memberId,
  749. effectiveRole: res.data.effectiveRole
  750. })
  751. uni.showToast({ title: '已切换到' + (member.nickname || '该成员'), icon: 'success' })
  752. setTimeout(function() {
  753. uni.reLaunch({ url: '/pages/index-home/index' })
  754. }, 1000)
  755. } else {
  756. uni.showToast({ title: res.message || '切换失败', icon: 'none' })
  757. }
  758. }).catch(function() {
  759. uni.showToast({ title: '切换失败', icon: 'none' })
  760. })
  761. },
  762. onTaskClick: function(task) {
  763. uni.navigateTo({ url: '/pages/tasks/tasks' })
  764. },
  765. goTasks: function() {
  766. uni.navigateTo({ url: '/pages/tasks/tasks' })
  767. },
  768. goActivityDetail: function(act) {
  769. if (!act || !act.id) return
  770. uni.navigateTo({ url: '/pages/activity/activity-detail/activity-detail?id=' + act.id })
  771. },
  772. goMoreActivities: function() {
  773. uni.navigateTo({ url: '/pages/activity/index' })
  774. },
  775. goProductDetail: function(prod) {
  776. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + prod.id })
  777. },
  778. goMoreProducts: function() {
  779. uni.navigateTo({ url: '/pages/shop/index/index' })
  780. },
  781. goArticleDetail: function(article) {
  782. var id = article.id || article
  783. uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
  784. },
  785. goMoreArticles: function() {
  786. uni.navigateTo({ url: '/pages/article-center/index?dimension=action' })
  787. },
  788. onFuncClick: function(item) {
  789. var nativeTabs = ['/pages/index-home/index', '/pages/body/index', '/pages/mind/index', '/pages/wisdom/index', '/pages/wealth/index']
  790. if (nativeTabs.indexOf(item.page) !== -1) {
  791. uni.switchTab({ url: item.page })
  792. } else {
  793. uni.navigateTo({ url: item.page })
  794. }
  795. },
  796. // 首页 TabTransition 动态关闭:检测关键内容是否就绪
  797. _watchPageReady() {
  798. var self = this
  799. var unwatch = this.$watch(function() {
  800. if (!self.isLoggedIn()) {
  801. return !!(self.products && self.products.length > 0) ||
  802. !!(self.dimensionActivities && self.dimensionActivities.length > 0) ||
  803. !!(self.indexArticles && self.indexArticles.length > 0)
  804. }
  805. // 登录用户:等待关键数据加载完成
  806. return !!(self.currentRole && self.sandboxData)
  807. }, function(val) {
  808. if (val) {
  809. if (unwatch) unwatch()
  810. if (self.$refs.tabTransition) self.$refs.tabTransition.markReady()
  811. }
  812. })
  813. },
  814. _doInit(options) {
  815. options = options || {}
  816. if (!this.isLoggedIn()) {
  817. this.currentRole = ''
  818. this.loadProducts()
  819. this.loadDimensionActivities()
  820. this.loadFeaturedArticles()
  821. return
  822. }
  823. this.syncRoleAndTabBar()
  824. if (options.inviteCode && options.type === 'parent_invite') {
  825. this.handleParentInvite(options.inviteCode)
  826. return
  827. }
  828. var storedCode = uni.getStorageSync('inviteCode')
  829. var storedType = uni.getStorageSync('inviteType')
  830. if (storedCode && storedType === 'parent_invite') {
  831. this.handleParentInvite(storedCode)
  832. uni.removeStorageSync('inviteCode')
  833. uni.removeStorageSync('inviteType')
  834. return
  835. }
  836. // 登录用户:直接在 TabBar 页面内联渲染,保持底签可见
  837. if (!this.loggedInInitDone) {
  838. this.loggedInInitDone = true
  839. this.loadLoggedInData()
  840. }
  841. this.checkMemberStatus()
  842. this._watchPageReady()
  843. },
  844. isLoggedIn() {
  845. return !!uni.getStorageSync('token')
  846. },
  847. // ===== 会员状态(沙盘下方会员入口) =====
  848. checkMemberStatus: function() {
  849. var that = this
  850. getMyMembership().then(function(res) {
  851. var m = res.data || {}
  852. that.isMember = !!(m.memberLevel && m.memberLevel !== 'FREE') || !!(m.levelCode && m.levelCode !== 'FREE')
  853. var mem = m.membership || m
  854. if (mem.daysRemaining != null) {
  855. that.membershipDays = mem.daysRemaining
  856. }
  857. }).catch(function() {})
  858. },
  859. goMembership: function() {
  860. uni.navigateTo({ url: '/pages/membership/upgrade' })
  861. },
  862. normalizeCurrentRole() {
  863. const role = uni.getStorageSync('role') || 'parent'
  864. const currentRole = uni.getStorageSync('currentRole')
  865. if (!currentRole) {
  866. return role
  867. }
  868. // 非规划师账号不允许落到规划师首页
  869. if (currentRole === 'teacher' && role !== 'teacher') {
  870. return role
  871. }
  872. // 只有家长账号允许切换到孩子视角
  873. if (currentRole === 'child' && role !== 'parent') {
  874. return role
  875. }
  876. return currentRole
  877. },
  878. syncRoleAndTabBar() {
  879. this.currentRole = this.normalizeCurrentRole()
  880. uni.setStorageSync('currentRole', this.currentRole)
  881. },
  882. // ===== 发现页 / 未登录态方法 =====
  883. loadProducts: function() {
  884. this.loading = true
  885. var params = { page: 1, size: 10 }
  886. if (this.currentType) {
  887. params.productType = this.currentType
  888. }
  889. var self = this
  890. productList(params).then(function(res) {
  891. self.loading = false
  892. if (res && res.code === 200) {
  893. // res.data is the response wrapper, products are in res.data.data or res.data.records
  894. var rawData = res.data && (Array.isArray(res.data) ? res.data : (res.data.data || res.data.records || []))
  895. self.products = Array.isArray(rawData) ? rawData : []
  896. }
  897. self._checkSplashReady()
  898. }).catch(function() {
  899. self.loading = false
  900. self._checkSplashReady()
  901. })
  902. },
  903. loadDimensionActivities: function() {
  904. var self = this
  905. getActivityList({ dimensionCode: '', page: 1, size: 3 }).then(function(res) {
  906. if (res && res.code === 200) {
  907. // res.data is the response wrapper, activities are in res.data.data or res.data.records
  908. var rawData = res.data && (Array.isArray(res.data) ? res.data : (res.data.data || res.data.records || []))
  909. self.dimensionActivities = Array.isArray(rawData) ? rawData.slice(0, 3) : []
  910. }
  911. self._checkSplashReady()
  912. }).catch(function() {
  913. self._checkSplashReady()
  914. })
  915. },
  916. loadFeaturedArticles: function() {
  917. var self = this
  918. this.articlesLoading = true
  919. getFeaturedArticles({ size: 5 }).then(function(res) {
  920. self.articlesLoading = false
  921. if (res && res.code === 200) {
  922. var gradientColors = [
  923. 'linear-gradient(135deg, #10B981, #34D399)',
  924. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  925. 'linear-gradient(135deg, #8B5CF6, #C084FC)',
  926. 'linear-gradient(135deg, #F97316, #FB923C)',
  927. 'linear-gradient(135deg, #6366F1, #818CF8)'
  928. ]
  929. // res.data is the response wrapper, articles are in res.data.data
  930. var rawList = res.data && (Array.isArray(res.data) ? res.data : (res.data.data || res.data.records || []))
  931. var list = Array.isArray(rawList) ? rawList : []
  932. self.indexArticles = list.map(function(item, index) {
  933. return {
  934. id: item.id,
  935. category: item.categoryName || item.category || '热门文章',
  936. categoryColor: gradientColors[index % gradientColors.length],
  937. title: item.title || '',
  938. summary: item.summary || '',
  939. views: item.viewCount ? String(item.viewCount) : '0',
  940. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  941. coverImage: item.coverImage
  942. }
  943. })
  944. }
  945. self._checkSplashReady()
  946. }).catch(function() {
  947. self.articlesLoading = false
  948. self._checkSplashReady()
  949. })
  950. },
  951. goActivities: function() {
  952. uni.navigateTo({ url: '/pages/activity/index' })
  953. },
  954. goActivityDetail: function(act) {
  955. uni.navigateTo({ url: '/pages/activity/activity-detail/activity-detail?id=' + act.id })
  956. },
  957. goArticles: function() {
  958. uni.navigateTo({ url: '/pages/mind-detail/articles' })
  959. },
  960. goArticleDetail: function(article) {
  961. var id = article && article.id ? article.id : article
  962. uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
  963. },
  964. onTypeChange(value) {
  965. this.currentType = value
  966. this.loadProducts()
  967. },
  968. goShop() {
  969. uni.navigateTo({ url: '/pages/shop/index/index' })
  970. },
  971. goDetail(id) {
  972. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + id })
  973. },
  974. handleLogin() {
  975. uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/index-home/index') })
  976. },
  977. async handleParentInvite(code) {
  978. // 延迟显示,等待登录完成
  979. setTimeout(async () => {
  980. const hasToken = uni.getStorageSync('token')
  981. if (!hasToken) {
  982. // 未登录,先去登录
  983. uni.reLaunch({
  984. url: '/pages/login/login?inviteCode=' + code
  985. })
  986. return
  987. }
  988. // 已登录,显示确认框
  989. uni.showModal({
  990. title: '加入家庭',
  991. content: '您已被邀请加入家庭,是否接受?',
  992. success: async (res) => {
  993. if (res.confirm) {
  994. try {
  995. uni.showLoading({ title: '加入中...' })
  996. const result = await acceptParentInvite(code)
  997. uni.hideLoading()
  998. if (result.code === 200) {
  999. const { role, token } = result.data
  1000. uni.setStorageSync('role', role)
  1001. uni.setStorageSync('token', token)
  1002. uni.showToast({ title: '加入成功', icon: 'success' })
  1003. // 刷新页面
  1004. setTimeout(() => {
  1005. uni.switchTab({ url: '/pages/index-home/index' })
  1006. }, 1500)
  1007. }
  1008. } catch (e) {
  1009. uni.hideLoading()
  1010. uni.showToast({ title: e.message || '加入失败', icon: 'none' })
  1011. }
  1012. }
  1013. }
  1014. })
  1015. }, 500)
  1016. },
  1017. getImageUrl: function(path) {
  1018. return config.API_BASE_URL + path
  1019. }
  1020. }
  1021. }
  1022. </script>
  1023. <style>
  1024. .discover-container {
  1025. min-height: 100vh;
  1026. background: #f5f7fa;
  1027. padding-bottom: 100rpx;
  1028. }
  1029. /* ===== 会员入口卡(能量沙盘下方) ===== */
  1030. .member-entry {
  1031. display: flex;
  1032. align-items: center;
  1033. margin: 20rpx 30rpx 0;
  1034. background: linear-gradient(135deg, #F97316, #FB923C);
  1035. border-radius: 20rpx;
  1036. padding: 24rpx 30rpx;
  1037. }
  1038. .member-entry-icon-wrap {
  1039. width: 64rpx;
  1040. height: 64rpx;
  1041. border-radius: 50%;
  1042. background: rgba(255,255,255,0.2);
  1043. display: flex;
  1044. align-items: center;
  1045. justify-content: center;
  1046. margin-right: 16rpx;
  1047. flex-shrink: 0;
  1048. }
  1049. .member-entry-icon {
  1050. font-size: 36rpx;
  1051. }
  1052. .member-entry-texts {
  1053. flex: 1;
  1054. display: flex;
  1055. flex-direction: column;
  1056. min-width: 0;
  1057. }
  1058. .member-entry-title {
  1059. font-size: 30rpx;
  1060. font-weight: bold;
  1061. color: #fff;
  1062. }
  1063. .member-entry-desc {
  1064. font-size: 22rpx;
  1065. color: rgba(255,255,255,0.85);
  1066. margin-top: 4rpx;
  1067. overflow: hidden;
  1068. text-overflow: ellipsis;
  1069. white-space: nowrap;
  1070. }
  1071. .member-entry-btn {
  1072. margin-left: 16rpx;
  1073. padding: 10rpx 24rpx;
  1074. background: #fff;
  1075. border-radius: 30rpx;
  1076. flex-shrink: 0;
  1077. }
  1078. .member-entry-btn-text {
  1079. font-size: 24rpx;
  1080. color: #F97316;
  1081. font-weight: bold;
  1082. }
  1083. /* ===== 推荐 ===== */
  1084. .recommend-section {
  1085. margin: 20rpx 30rpx;
  1086. }
  1087. .section-header {
  1088. display: flex;
  1089. justify-content: space-between;
  1090. align-items: center;
  1091. margin-bottom: 20rpx;
  1092. }
  1093. .section-title {
  1094. font-size: 30rpx;
  1095. font-weight: bold;
  1096. color: #333;
  1097. }
  1098. .section-more {
  1099. font-size: 24rpx;
  1100. color: #5B9BD5;
  1101. }
  1102. .type-filter-scroll {
  1103. white-space: nowrap;
  1104. margin-bottom: 20rpx;
  1105. }
  1106. .filter-chip {
  1107. display: inline-block;
  1108. padding: 8rpx 24rpx;
  1109. font-size: 24rpx;
  1110. color: #666;
  1111. background: #f0f0f0;
  1112. border-radius: 30rpx;
  1113. margin-right: 16rpx;
  1114. }
  1115. .filter-chip.active {
  1116. background: #5B9BD5;
  1117. color: #fff;
  1118. }
  1119. .loading-state,
  1120. .empty-state {
  1121. display: flex;
  1122. justify-content: center;
  1123. padding: 60rpx 0;
  1124. }
  1125. .loading-text,
  1126. .empty-text {
  1127. font-size: 26rpx;
  1128. color: #999;
  1129. }
  1130. .product-grid {
  1131. display: flex;
  1132. flex-wrap: wrap;
  1133. justify-content: space-between;
  1134. }
  1135. .product-card {
  1136. width: 48%;
  1137. background: #fff;
  1138. border-radius: 16rpx;
  1139. overflow: hidden;
  1140. margin-bottom: 20rpx;
  1141. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  1142. }
  1143. .product-cover {
  1144. width: 100%;
  1145. height: 200rpx;
  1146. background: #f0f0f0;
  1147. }
  1148. .product-info {
  1149. padding: 14rpx;
  1150. }
  1151. .product-name {
  1152. display: block;
  1153. font-size: 26rpx;
  1154. color: #333;
  1155. margin-bottom: 10rpx;
  1156. overflow: hidden;
  1157. text-overflow: ellipsis;
  1158. white-space: nowrap;
  1159. }
  1160. .product-price-row {
  1161. display: flex;
  1162. align-items: baseline;
  1163. }
  1164. .product-price {
  1165. font-size: 28rpx;
  1166. color: #5B9BD5;
  1167. font-weight: bold;
  1168. margin-right: 10rpx;
  1169. }
  1170. .product-price-login {
  1171. font-size: 24rpx;
  1172. color: #999;
  1173. }
  1174. .product-member {
  1175. font-size: 20rpx;
  1176. color: #999;
  1177. }
  1178. /* ===== 五维全景幸福矩阵 ===== */
  1179. .why-section {
  1180. margin: 30rpx;
  1181. }
  1182. .dim-matrix {
  1183. display: flex;
  1184. flex-wrap: wrap;
  1185. gap: 20rpx;
  1186. justify-content: center;
  1187. }
  1188. .dim-card {
  1189. width: calc(33.33% - 14rpx);
  1190. box-sizing: border-box;
  1191. background: #fff;
  1192. border-radius: 20rpx;
  1193. padding: 28rpx 16rpx 24rpx;
  1194. display: flex;
  1195. flex-direction: column;
  1196. align-items: center;
  1197. text-align: center;
  1198. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  1199. transition: transform 0.2s ease, box-shadow 0.2s ease;
  1200. position: relative;
  1201. overflow: hidden;
  1202. }
  1203. .dim-card:active {
  1204. transform: scale(0.96);
  1205. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.1);
  1206. }
  1207. .dim-icon-circle {
  1208. width: 72rpx;
  1209. height: 72rpx;
  1210. border-radius: 50%;
  1211. display: flex;
  1212. align-items: center;
  1213. justify-content: center;
  1214. margin-bottom: 14rpx;
  1215. flex-shrink: 0;
  1216. }
  1217. .dim-icon {
  1218. font-size: 36rpx;
  1219. line-height: 1;
  1220. }
  1221. .dim-tag {
  1222. font-size: 22rpx;
  1223. font-weight: 600;
  1224. padding: 4rpx 14rpx;
  1225. border-radius: 20rpx;
  1226. margin-bottom: 10rpx;
  1227. max-width: 100%;
  1228. overflow: hidden;
  1229. text-overflow: ellipsis;
  1230. white-space: nowrap;
  1231. }
  1232. .dim-desc {
  1233. font-size: 20rpx;
  1234. color: #888;
  1235. line-height: 1.5;
  1236. display: -webkit-box;
  1237. -webkit-line-clamp: 2;
  1238. -webkit-box-orient: vertical;
  1239. overflow: hidden;
  1240. }
  1241. /* 五维能量环 */
  1242. .dim-energy-row {
  1243. display: flex;
  1244. justify-content: center;
  1245. gap: 12rpx;
  1246. margin-top: 24rpx;
  1247. opacity: 0.5;
  1248. }
  1249. .energy-dot {
  1250. width: 10rpx;
  1251. height: 10rpx;
  1252. border-radius: 50%;
  1253. }
  1254. /* ===== 底部登录 ===== */
  1255. .login-footer {
  1256. margin: 40rpx 30rpx;
  1257. display: flex;
  1258. flex-direction: column;
  1259. align-items: center;
  1260. }
  1261. .login-btn {
  1262. width: 100%;
  1263. height: 88rpx;
  1264. line-height: 88rpx;
  1265. background: linear-gradient(135deg, #5B9BD5, #3A7CC4);
  1266. color: #fff;
  1267. font-size: 32rpx;
  1268. font-weight: bold;
  1269. border-radius: 44rpx;
  1270. text-align: center;
  1271. border: none;
  1272. }
  1273. .login-btn::after {
  1274. border: none;
  1275. }
  1276. .login-footer-text {
  1277. font-size: 20rpx;
  1278. color: #bbb;
  1279. margin-top: 16rpx;
  1280. }
  1281. /* ===== 加载占位 ===== */
  1282. .loading-container {
  1283. display: flex;
  1284. justify-content: center;
  1285. align-items: center;
  1286. height: 100vh;
  1287. }
  1288. /* ===== 角色切换淡入淡出 ===== */
  1289. .role-switch-wrapper {
  1290. width: 100%;
  1291. min-height: 100vh;
  1292. }
  1293. .fade-enter-active,
  1294. .fade-leave-active {
  1295. transition: opacity 0.3s ease;
  1296. }
  1297. .fade-enter,
  1298. .fade-leave-to {
  1299. opacity: 0;
  1300. }
  1301. /* ===== 通用区块样式 ===== */
  1302. .section {
  1303. margin: 20rpx 30rpx;
  1304. }
  1305. .section-header {
  1306. display: flex;
  1307. justify-content: space-between;
  1308. align-items: center;
  1309. margin-bottom: 20rpx;
  1310. }
  1311. .section-title {
  1312. font-size: 30rpx;
  1313. font-weight: bold;
  1314. color: #333;
  1315. }
  1316. .section-more {
  1317. font-size: 24rpx;
  1318. color: #5B9BD5;
  1319. }
  1320. .empty-state {
  1321. display: flex;
  1322. justify-content: center;
  1323. padding: 60rpx 0;
  1324. }
  1325. .empty-text {
  1326. font-size: 26rpx;
  1327. color: #999;
  1328. }
  1329. /* ===== 活动列表 ===== */
  1330. .activity-list {
  1331. display: flex;
  1332. flex-direction: column;
  1333. gap: 16rpx;
  1334. }
  1335. .activity-card {
  1336. background: #fff;
  1337. border-radius: 16rpx;
  1338. overflow: hidden;
  1339. display: flex;
  1340. flex-direction: row;
  1341. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1342. }
  1343. .activity-card:active {
  1344. opacity: 0.8;
  1345. }
  1346. .activity-cover {
  1347. width: 200rpx;
  1348. height: 160rpx;
  1349. flex-shrink: 0;
  1350. background: #f0f0f0;
  1351. }
  1352. .activity-info {
  1353. flex: 1;
  1354. padding: 16rpx;
  1355. display: flex;
  1356. flex-direction: column;
  1357. justify-content: space-between;
  1358. }
  1359. .activity-name {
  1360. font-size: 28rpx;
  1361. font-weight: bold;
  1362. color: #333;
  1363. margin-bottom: 8rpx;
  1364. }
  1365. .line-clamp-1 {
  1366. overflow: hidden;
  1367. text-overflow: ellipsis;
  1368. white-space: nowrap;
  1369. }
  1370. .activity-meta {
  1371. display: flex;
  1372. align-items: center;
  1373. margin-bottom: 8rpx;
  1374. }
  1375. .activity-time {
  1376. font-size: 22rpx;
  1377. color: #999;
  1378. }
  1379. .activity-bottom {
  1380. display: flex;
  1381. align-items: center;
  1382. gap: 12rpx;
  1383. }
  1384. .activity-status {
  1385. font-size: 20rpx;
  1386. padding: 2rpx 10rpx;
  1387. border-radius: 8rpx;
  1388. background: #E8F5E9;
  1389. color: #2E7D32;
  1390. }
  1391. .activity-status.status-upcoming {
  1392. background: #E3F2FD;
  1393. color: #1565C0;
  1394. }
  1395. .activity-status.status-ended {
  1396. background: #F5F5F5;
  1397. color: #999;
  1398. }
  1399. .activity-fee {
  1400. font-size: 24rpx;
  1401. color: #F97316;
  1402. font-weight: bold;
  1403. }
  1404. .activity-fee.fee-free {
  1405. color: #4CAF50;
  1406. }
  1407. /* ===== 文章列表 ===== */
  1408. .article-list {
  1409. display: flex;
  1410. flex-direction: column;
  1411. gap: 16rpx;
  1412. }
  1413. .article-card {
  1414. background: #fff;
  1415. border-radius: 16rpx;
  1416. padding: 24rpx;
  1417. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1418. }
  1419. .article-card:active {
  1420. opacity: 0.8;
  1421. }
  1422. .article-category {
  1423. display: inline-block;
  1424. padding: 4rpx 14rpx;
  1425. border-radius: 8rpx;
  1426. margin-bottom: 10rpx;
  1427. }
  1428. .article-category-text {
  1429. font-size: 20rpx;
  1430. color: #fff;
  1431. }
  1432. .article-title {
  1433. display: block;
  1434. font-size: 28rpx;
  1435. font-weight: bold;
  1436. color: #333;
  1437. margin-bottom: 8rpx;
  1438. line-height: 1.4;
  1439. }
  1440. .article-summary {
  1441. display: block;
  1442. font-size: 24rpx;
  1443. color: #888;
  1444. line-height: 1.5;
  1445. margin-bottom: 12rpx;
  1446. overflow: hidden;
  1447. text-overflow: ellipsis;
  1448. display: -webkit-box;
  1449. -webkit-line-clamp: 2;
  1450. -webkit-box-orient: vertical;
  1451. }
  1452. .article-meta {
  1453. display: flex;
  1454. align-items: center;
  1455. gap: 16rpx;
  1456. }
  1457. .meta-item {
  1458. display: flex;
  1459. align-items: center;
  1460. gap: 4rpx;
  1461. }
  1462. .meta-icon {
  1463. font-size: 24rpx;
  1464. }
  1465. .meta-text {
  1466. font-size: 22rpx;
  1467. color: #999;
  1468. }
  1469. .article-date {
  1470. font-size: 22rpx;
  1471. color: #bbb;
  1472. }
  1473. /* ===== Splash Loading Overlay(冷启动蒙板,来自 merge splash.vue) ===== */
  1474. .splash-overlay {
  1475. position: fixed;
  1476. top: 0; left: 0; right: 0; bottom: 0;
  1477. z-index: 9999;
  1478. display: flex;
  1479. align-items: center;
  1480. justify-content: center;
  1481. background: linear-gradient(160deg, #FFF7ED 0%, #FFEDD5 50%, #FED7AA 100%);
  1482. overflow: hidden;
  1483. opacity: 1;
  1484. transition: opacity 0.4s ease;
  1485. }
  1486. .splash-overlay.fade-out {
  1487. opacity: 0;
  1488. pointer-events: none;
  1489. }
  1490. /* ---- bg circles from splash.vue ---- */
  1491. .splash-overlay-bg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; }
  1492. .bg-circle {
  1493. position: absolute;
  1494. border-radius: 50%;
  1495. opacity: 0.12;
  1496. }
  1497. .bg-circle-1 {
  1498. width: 400rpx; height: 400rpx;
  1499. background: #FF8C42;
  1500. top: -100rpx; right: -80rpx;
  1501. animation: splash-float-1 4s ease-in-out infinite;
  1502. }
  1503. .bg-circle-2 {
  1504. width: 280rpx; height: 280rpx;
  1505. background: #FF6B9D;
  1506. bottom: 80rpx; left: -60rpx;
  1507. animation: splash-float-2 5s ease-in-out infinite;
  1508. }
  1509. .bg-circle-3 {
  1510. width: 180rpx; height: 180rpx;
  1511. background: #6366F1;
  1512. top: 50%; right: -40rpx;
  1513. animation: splash-float-3 6s ease-in-out infinite;
  1514. }
  1515. @keyframes splash-float-1 {
  1516. 0%, 100% { transform: translateY(0) scale(1); }
  1517. 50% { transform: translateY(-30rpx) scale(1.05); }
  1518. }
  1519. @keyframes splash-float-2 {
  1520. 0%, 100% { transform: translateY(0) scale(1); }
  1521. 50% { transform: translateY(20rpx) scale(1.08); }
  1522. }
  1523. @keyframes splash-float-3 {
  1524. 0%, 100% { transform: translateY(0) rotate(0deg); }
  1525. 50% { transform: translateY(-20rpx) rotate(10deg); }
  1526. }
  1527. /* ---- body fade-in ---- */
  1528. .splash-overlay-body {
  1529. display: flex;
  1530. flex-direction: column;
  1531. align-items: center;
  1532. animation: splash-body-in 0.8s cubic-bezier(0.16,1,0.3,1) forwards;
  1533. }
  1534. @keyframes splash-body-in {
  1535. from { opacity: 0; transform: translateY(40rpx) scale(0.96); }
  1536. to { opacity: 1; transform: translateY(0) scale(1); }
  1537. }
  1538. /* ---- logo ---- */
  1539. .splash-logo-wrap {
  1540. width: 160rpx; height: 160rpx;
  1541. border-radius: 40rpx;
  1542. background: rgba(255,255,255,0.95);
  1543. display: flex; align-items: center; justify-content: center;
  1544. margin-bottom: 16rpx;
  1545. box-shadow: 0 8rpx 32rpx rgba(249,115,22,0.25);
  1546. animation: splash-logo-pulse 2.5s ease-in-out infinite;
  1547. }
  1548. @keyframes splash-logo-pulse {
  1549. 0%, 100% { box-shadow: 0 8rpx 32rpx rgba(249,115,22,0.25); }
  1550. 50% { box-shadow: 0 8rpx 48rpx rgba(249,115,22,0.45); }
  1551. }
  1552. .splash-logo-img { width: 100rpx; height: 100rpx; }
  1553. /* ---- brand ---- */
  1554. .splash-brand-name {
  1555. font-size: 64rpx; font-weight: 800;
  1556. color: #7C2D12;
  1557. letter-spacing: 10rpx;
  1558. margin-bottom: 2rpx;
  1559. }
  1560. .splash-brand-en {
  1561. font-size: 20rpx;
  1562. color: rgba(124,45,18,0.5);
  1563. letter-spacing: 6rpx;
  1564. margin-bottom: 30rpx;
  1565. }
  1566. .splash-tagline {
  1567. font-size: 26rpx;
  1568. color: rgba(124,45,18,0.7);
  1569. letter-spacing: 4rpx;
  1570. margin-top: 24rpx;
  1571. }
  1572. /* ---- dims row from splash.vue (rounded circles) ---- */
  1573. .splash-dims-row {
  1574. display: flex; flex-direction: row;
  1575. align-items: center; justify-content: center;
  1576. gap: 28rpx;
  1577. }
  1578. .splash-dim-item {
  1579. display: flex; flex-direction: column;
  1580. align-items: center; gap: 8rpx;
  1581. }
  1582. .splash-dim-circle {
  1583. width: 80rpx; height: 80rpx;
  1584. border-radius: 50%;
  1585. display: flex; align-items: center; justify-content: center;
  1586. }
  1587. .splash-dim-icon { font-size: 36rpx; line-height: 1; }
  1588. .splash-dim-label {
  1589. font-size: 22rpx; font-weight: 500;
  1590. color: rgba(124,45,18,0.75);
  1591. line-height: 1;
  1592. }
  1593. /* ---- staggered dim entry from splash.vue ---- */
  1594. .splash-dim-item:nth-child(1) { animation: splash-dim-in 0.5s ease 0.1s both; }
  1595. .splash-dim-item:nth-child(2) { animation: splash-dim-in 0.5s ease 0.2s both; }
  1596. .splash-dim-item:nth-child(3) { animation: splash-dim-in 0.5s ease 0.3s both; }
  1597. .splash-dim-item:nth-child(4) { animation: splash-dim-in 0.5s ease 0.4s both; }
  1598. .splash-dim-item:nth-child(5) { animation: splash-dim-in 0.5s ease 0.5s both; }
  1599. @keyframes splash-dim-in {
  1600. from { opacity: 0; transform: translateY(16rpx) scale(0.8); }
  1601. to { opacity: 1; transform: translateY(0) scale(1); }
  1602. }
  1603. /* ---- loading dots ---- */
  1604. .splash-overlay-loading {
  1605. position: absolute;
  1606. bottom: 120rpx;
  1607. left: 0; right: 0;
  1608. display: flex;
  1609. justify-content: center;
  1610. align-items: center;
  1611. gap: 12rpx;
  1612. }
  1613. .splash-overlay-dot {
  1614. width: 14rpx; height: 14rpx;
  1615. border-radius: 50%;
  1616. background: rgba(249,115,22,0.6);
  1617. animation: splash-dot-bounce 1.4s ease-in-out infinite both;
  1618. }
  1619. .splash-overlay-dot:nth-child(1) { animation-delay: -0.32s; }
  1620. .splash-overlay-dot:nth-child(2) { animation-delay: -0.16s; }
  1621. .splash-overlay-dot:nth-child(3) { animation-delay: 0s; }
  1622. @keyframes splash-dot-bounce {
  1623. 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  1624. 40% { transform: scale(1); opacity: 1; }
  1625. }
  1626. /* ---- 登录态内容布局 ---- */
  1627. .logged-in-container {
  1628. padding-bottom: 40rpx;
  1629. }
  1630. /* ===== 功能入口(原action页样式) ===== */
  1631. .func-section {
  1632. margin: -40rpx 20rpx 0;
  1633. position: relative;
  1634. z-index: 2;
  1635. }
  1636. .func-grid {
  1637. background: #fff;
  1638. border-radius: 24rpx;
  1639. padding: 30rpx 16rpx;
  1640. display: flex;
  1641. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  1642. }
  1643. .func-item {
  1644. flex: 1;
  1645. display: flex;
  1646. flex-direction: column;
  1647. align-items: center;
  1648. }
  1649. .func-item:active {
  1650. opacity: 0.7;
  1651. }
  1652. .func-icon-wrap {
  1653. width: 88rpx;
  1654. height: 88rpx;
  1655. border-radius: 50%;
  1656. background: #FFF7ED;
  1657. display: flex;
  1658. align-items: center;
  1659. justify-content: center;
  1660. margin-bottom: 10rpx;
  1661. }
  1662. .func-icon {
  1663. font-size: 40rpx;
  1664. }
  1665. .func-label {
  1666. font-size: 24rpx;
  1667. color: #333;
  1668. font-weight: 500;
  1669. }
  1670. /* ===== 圈子卡片 ===== */
  1671. .circle-section {
  1672. margin: 20rpx 30rpx;
  1673. }
  1674. .circle-header {
  1675. display: flex;
  1676. justify-content: space-between;
  1677. align-items: center;
  1678. margin-bottom: 20rpx;
  1679. }
  1680. .circle-section-title {
  1681. font-size: 30rpx;
  1682. font-weight: bold;
  1683. color: #333;
  1684. }
  1685. .circle-header-link {
  1686. font-size: 24rpx;
  1687. color: #5B9BD5;
  1688. }
  1689. .circle-scroll {
  1690. white-space: nowrap;
  1691. }
  1692. .circle-scroll-inner {
  1693. display: inline-flex;
  1694. gap: 16rpx;
  1695. }
  1696. .circle-card-wrap {
  1697. display: inline-block;
  1698. }
  1699. .circle-empty {
  1700. padding: 40rpx 0;
  1701. text-align: center;
  1702. }
  1703. .circle-empty-text {
  1704. font-size: 26rpx;
  1705. color: #999;
  1706. }
  1707. .circle-discover {
  1708. margin-top: 30rpx;
  1709. }
  1710. .discover-list {
  1711. display: flex;
  1712. flex-direction: column;
  1713. gap: 16rpx;
  1714. }
  1715. .discover-item {
  1716. background: #fff;
  1717. border-radius: 16rpx;
  1718. overflow: hidden;
  1719. }
  1720. </style>