index.vue 50 KB

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