index.vue 51 KB

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