index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816
  1. <template>
  2. <view>
  3. <!-- Tabbar 切换过渡页 -->
  4. <tab-transition v-if="showTabTransition" dimCode="action" />
  5. <!-- 未登录态 — 发现页/引流内容,直接内嵌,不跳转 -->
  6. <view v-if="!currentRole" class="discover-container">
  7. <!-- 品牌头部 -->
  8. <PageBanner theme="home"
  9. tagline="家庭健康成长俱乐部"
  10. quote="给全家的一站式幸福提案" />
  11. <!-- 五行沙盘预览 -->
  12. <wuxing-sandbox mode="preview" badgeText="登录查看完整报告" @point-click="handleLogin" />
  13. <!-- 活动/商品推荐 -->
  14. <view class="recommend-section">
  15. <view class="section-header">
  16. <text class="section-title">🔥 热门推荐</text>
  17. <text class="section-more" @click="goShop">查看更多 ›</text>
  18. </view>
  19. <scroll-view scroll-x enable-flex show-scrollbar="false" class="type-filter-scroll">
  20. <view
  21. v-for="item in typeList"
  22. :key="item.value"
  23. :class="['filter-chip', currentType === item.value ? 'active' : '']"
  24. @click="onTypeChange(item.value)"
  25. >
  26. {{ item.label }}
  27. </view>
  28. </scroll-view>
  29. <view v-if="loading" class="loading-state">
  30. <text class="loading-text">加载中...</text>
  31. </view>
  32. <view v-else-if="products.length === 0" class="empty-state">
  33. <text class="empty-text">暂无商品,去商城看看吧</text>
  34. </view>
  35. <view v-else class="product-grid">
  36. <view
  37. v-for="item in products"
  38. :key="item.id"
  39. class="product-card"
  40. @click="handleLogin()"
  41. >
  42. <image class="product-cover" :src="item.coverImage || '/static/default-product.png'" mode="aspectFill" />
  43. <view class="product-info">
  44. <text class="product-name">{{ item.name }}</text>
  45. <view class="product-price-row">
  46. <!-- 游客不显示价格 -->
  47. <text class="product-price-login">登录查看</text>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 热门活动(无条件展示) -->
  54. <view class="section">
  55. <view class="section-header">
  56. <text class="section-title">🔥 热门活动</text>
  57. <text class="section-more" @click="goActivities">查看更多 ›</text>
  58. </view>
  59. <view v-if="dimensionActivities.length === 0" class="empty-state" style="padding: 40rpx 0;">
  60. <text class="empty-text">暂无活动</text>
  61. </view>
  62. <view class="activity-list" v-else>
  63. <view class="activity-card" v-for="act in dimensionActivities" :key="act.id" @click="goActivityDetail(act)">
  64. <image class="activity-cover" :src="act.coverImage || '/static/default-activity.png'" mode="aspectFill" />
  65. <view class="activity-info">
  66. <text class="activity-name line-clamp-1">{{ act.title }}</text>
  67. <view class="activity-meta">
  68. <text class="activity-time">{{ act.startTime }}</text>
  69. </view>
  70. <view class="activity-bottom">
  71. <text class="activity-status" :class="'status-' + (act.status || 'upcoming')">{{ act.status === 'ongoing' ? '进行中' : act.status === 'ended' ? '已结束' : '即将开始' }}</text>
  72. <text class="activity-fee" v-if="act.price && act.price > 0">¥{{ (act.price / 100).toFixed(0) }}</text>
  73. <text class="activity-fee fee-free" v-else>免费</text>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <!-- 推荐阅读(无条件展示) -->
  80. <view class="section" v-if="indexArticles.length > 0">
  81. <view class="section-header">
  82. <text class="section-title">📖 推荐阅读</text>
  83. <text class="section-more" @click="goArticles">更多 ›</text>
  84. </view>
  85. <view class="article-list">
  86. <view class="article-card" v-for="article in indexArticles" :key="article.id" @click="goArticleDetail(article.id)">
  87. <view class="article-category" :style="{ background: article.categoryColor }">
  88. <text class="article-category-text">{{ article.category }}</text>
  89. </view>
  90. <text class="article-title">{{ article.title }}</text>
  91. <text class="article-summary">{{ article.summary }}</text>
  92. <view class="article-meta">
  93. <view class="meta-item">
  94. <text class="meta-icon">&#x1F4D6;</text>
  95. <text class="meta-text">{{ article.views }}</text>
  96. </view>
  97. <text class="article-date">{{ article.date }}</text>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. <!-- 五维全景幸福矩阵 -->
  103. <view class="why-section">
  104. <view class="section-header">
  105. <text class="section-title">🌏 五维全景幸福矩阵 — 给全家的一站式幸福提案</text>
  106. </view>
  107. <view class="dim-matrix">
  108. <view
  109. v-for="dim in dimList" :key="dim.code"
  110. class="dim-card"
  111. :style="'border-left:6rpx solid ' + dim.color"
  112. @click="handleLogin"
  113. >
  114. <view class="dim-icon-circle" :style="'background:' + dim.bgColor">
  115. <text class="dim-icon">{{ dim.icon }}</text>
  116. </view>
  117. <view class="dim-tag" :style="'color:' + dim.color + ';background:' + dim.bgColor">{{ dim.name }} · {{ dim.title }}</view>
  118. <text class="dim-desc">{{ dim.desc }}</text>
  119. </view>
  120. </view>
  121. <!-- 五维能量环装饰 -->
  122. <view class="dim-energy-row">
  123. <view
  124. v-for="c in energyDotColors" :key="c"
  125. class="energy-dot"
  126. :style="'background:' + c"
  127. ></view>
  128. </view>
  129. </view>
  130. <!-- 底部登录按钮 -->
  131. <view class="login-footer">
  132. <button class="login-btn" @click="handleLogin">登录 / 注册</button>
  133. <text class="login-footer-text">登录即表示同意《用户协议》和《隐私政策》</text>
  134. </view>
  135. <!-- 底部占位 -->
  136. <view style="height: 120rpx;"></view>
  137. </view>
  138. <!-- 登录态 — 按角色渲染(带淡入淡出过渡)-->
  139. <view v-else class="role-switch-wrapper">
  140. <transition name="fade" mode="out-in">
  141. <parent-index v-if="currentRole === 'parent'" key="parent" />
  142. <child-index v-else-if="currentRole === 'child'" key="child" />
  143. <!-- teacher-index 已废弃,教师功能折入 parent-index -->
  144. <view v-else class="loading-container" key="loading">
  145. <text>加载中...</text>
  146. </view>
  147. </transition>
  148. </view>
  149. </view>
  150. </template>
  151. <script>
  152. import ParentIndex from './parent-index.vue'
  153. import ChildIndex from './child-index.vue'
  154. // TeacherIndex 已废弃,教师功能折入 parent-index
  155. import PageBanner from '../../components/PageBanner.vue'
  156. import WuxingSandbox from '../../components/wuxing-sandbox.vue'
  157. import TabTransition from '../../components/tab-transition.vue'
  158. import { acceptParentInvite, productList, getActivityList, getFeaturedArticles } from '../../utils/api.js'
  159. var DIMENSIONS = [
  160. { code: 'body', name: '身', icon: '🌏', color: '#8D6E63', bgColor: 'rgba(141,110,99,0.15)', title: '主动健康', desc: '用最适合的方法,从根源调理家人体质,畅享高质量长寿生活' },
  161. { code: 'mind', name: '心', icon: '🔥', color: '#FF6B35', bgColor: 'rgba(255,107,53,0.15)', title: '大爱传承', desc: '将长辈陪护升华为家族纽带,让家风温暖代代相传' },
  162. { code: 'wisdom', name: '智', icon: '⚡', color: '#FFD700', bgColor: 'rgba(255,215,0,0.15)', title: '赋能未来', desc: '专业测评与素质培养,开启孩子面向未来的大智慧' },
  163. { code: 'action', name: '行', icon: '🌿', color: '#4CAF50', bgColor: 'rgba(76,175,80,0.15)', title: '知行合一', desc: '在亲子户外与沙龙中,让健康生活方式真正知行合一' },
  164. { code: 'wealth', name: '富', icon: '💧', color: '#42A5F5', bgColor: 'rgba(66,165,245,0.15)', title: '利他创富', desc: '依托创客生态,在利他分享中实现家庭第二收入曲线' }
  165. ]
  166. export default {
  167. components: {
  168. ParentIndex,
  169. ChildIndex,
  170. PageBanner,
  171. WuxingSandbox,
  172. TabTransition
  173. },
  174. data() {
  175. // 从 storage 预取登录态/角色,确保首次渲染即正确(WeChat 渲染层/逻辑层分离架构下 onLoad 执行前已渲染)
  176. var _token = uni.getStorageSync('token')
  177. var _currentRole = ''
  178. if (_token) {
  179. _currentRole = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || ''
  180. }
  181. return {
  182. currentRole: _currentRole,
  183. showTabTransition: true,
  184. typeList: [
  185. { label: '全部', value: '' },
  186. { label: '活动', value: 'activity' },
  187. { label: '课程', value: 'course' },
  188. { label: '实物', value: 'physical' },
  189. { label: '数字', value: 'digital' },
  190. { label: '服务', value: 'service' }
  191. ],
  192. currentType: '',
  193. products: [],
  194. loading: false,
  195. dimensionActivities: [],
  196. indexArticles: []
  197. }
  198. },
  199. onLoad(options) {
  200. this._doInit(options)
  201. },
  202. onShow() {
  203. // Tabbar 切换过渡动画:从 splash 首次进入时跳过(splash 本身就是过渡)
  204. var fromSplash = uni.getStorageSync('_fromSplash')
  205. if (fromSplash === '1') {
  206. uni.removeStorageSync('_fromSplash')
  207. } else {
  208. this.showTabTransition = true
  209. var self = this
  210. setTimeout(function() {
  211. self.showTabTransition = false
  212. }, 1100)
  213. }
  214. // 始终执行初始化,确保登录态变更后及时切换视图
  215. this._doInit()
  216. },
  217. methods: {
  218. _doInit(options) {
  219. options = options || {}
  220. if (!this.isLoggedIn()) {
  221. this.currentRole = ''
  222. this.loadProducts()
  223. this.loadDimensionActivities()
  224. this.loadFeaturedArticles()
  225. return
  226. }
  227. this.syncRoleAndTabBar()
  228. if (options.inviteCode && options.type === 'parent_invite') {
  229. this.handleParentInvite(options.inviteCode)
  230. } else {
  231. var storedCode = uni.getStorageSync('inviteCode')
  232. var storedType = uni.getStorageSync('inviteType')
  233. if (storedCode && storedType === 'parent_invite') {
  234. this.handleParentInvite(storedCode)
  235. uni.removeStorageSync('inviteCode')
  236. uni.removeStorageSync('inviteType')
  237. }
  238. }
  239. },
  240. isLoggedIn() {
  241. return !!uni.getStorageSync('token')
  242. },
  243. normalizeCurrentRole() {
  244. const role = uni.getStorageSync('role') || 'parent'
  245. const currentRole = uni.getStorageSync('currentRole')
  246. if (!currentRole) {
  247. return role
  248. }
  249. // 非规划师账号不允许落到规划师首页
  250. if (currentRole === 'teacher' && role !== 'teacher') {
  251. return role
  252. }
  253. // 只有家长账号允许切换到孩子视角
  254. if (currentRole === 'child' && role !== 'parent') {
  255. return role
  256. }
  257. return currentRole
  258. },
  259. syncRoleAndTabBar() {
  260. this.currentRole = this.normalizeCurrentRole()
  261. uni.setStorageSync('currentRole', this.currentRole)
  262. },
  263. // ===== 发现页 / 未登录态方法 =====
  264. loadProducts() {
  265. this.loading = true
  266. var params = { page: 1, size: 10 }
  267. if (this.currentType) {
  268. params.productType = this.currentType
  269. }
  270. productList(params).then(function(res) {
  271. this.loading = false
  272. if (res.code === 200 && res.data) {
  273. this.products = res.data.records || []
  274. }
  275. }.bind(this)).catch(function() {
  276. this.loading = false
  277. }.bind(this))
  278. },
  279. loadDimensionActivities: function() {
  280. var self = this
  281. getActivityList({ dimensionCode: '', page: 1, size: 3 }).then(function(res) {
  282. if (res && res.data) {
  283. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  284. self.dimensionActivities = list.slice(0, 3)
  285. }
  286. }.bind(this)).catch(function() {})
  287. },
  288. loadFeaturedArticles: function() {
  289. var self = this
  290. getFeaturedArticles({ size: 5 }).then(function(res) {
  291. if (res.code === 200 && res.data) {
  292. var gradientColors = [
  293. 'linear-gradient(135deg, #10B981, #34D399)',
  294. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  295. 'linear-gradient(135deg, #8B5CF6, #C084FC)',
  296. 'linear-gradient(135deg, #F97316, #FB923C)',
  297. 'linear-gradient(135deg, #6366F1, #818CF8)'
  298. ]
  299. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  300. self.indexArticles = list.map(function(item, index) {
  301. return {
  302. id: item.id,
  303. category: item.categoryName || '热门文章',
  304. categoryColor: gradientColors[index % gradientColors.length],
  305. title: item.title || '',
  306. summary: item.summary || '',
  307. views: item.viewCount ? String(item.viewCount) : '0',
  308. date: item.publishedAt ? item.publishedAt.slice(0, 10) : ''
  309. }
  310. })
  311. }
  312. }.bind(this)).catch(function() {})
  313. },
  314. goActivities: function() {
  315. uni.navigateTo({ url: '/pages/discover/index?type=activity' })
  316. },
  317. goActivityDetail: function(act) {
  318. uni.navigateTo({ url: '/pages/discover-detail/activity-detail/activity-detail?id=' + act.id })
  319. },
  320. goArticles: function() {
  321. uni.navigateTo({ url: '/pages/mind-detail/articles' })
  322. },
  323. goArticleDetail: function(id) {
  324. uni.navigateTo({ url: '/pages/mind-detail/article-detail?id=' + id })
  325. },
  326. onTypeChange(value) {
  327. this.currentType = value
  328. this.loadProducts()
  329. },
  330. goShop() {
  331. uni.navigateTo({ url: '/pages/discover/index' })
  332. },
  333. goDetail(id) {
  334. uni.navigateTo({ url: '/pages/discover/product-detail/product-detail?id=' + id })
  335. },
  336. handleLogin() {
  337. uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/index/index') })
  338. },
  339. async handleParentInvite(code) {
  340. // 延迟显示,等待登录完成
  341. setTimeout(async () => {
  342. const hasToken = uni.getStorageSync('token')
  343. if (!hasToken) {
  344. // 未登录,先去登录
  345. uni.reLaunch({
  346. url: '/pages/login/login?inviteCode=' + code
  347. })
  348. return
  349. }
  350. // 已登录,显示确认框
  351. uni.showModal({
  352. title: '加入家庭',
  353. content: '您已被邀请加入家庭,是否接受?',
  354. success: async (res) => {
  355. if (res.confirm) {
  356. try {
  357. uni.showLoading({ title: '加入中...' })
  358. const result = await acceptParentInvite(code)
  359. uni.hideLoading()
  360. if (result.code === 200) {
  361. const { familyId, role, token } = result.data
  362. uni.setStorageSync('familyId', familyId)
  363. uni.setStorageSync('role', role)
  364. uni.setStorageSync('token', token)
  365. uni.showToast({ title: '加入成功', icon: 'success' })
  366. // 刷新页面
  367. setTimeout(() => {
  368. uni.reLaunch({ url: '/pages/index/index' })
  369. }, 1500)
  370. }
  371. } catch (e) {
  372. uni.hideLoading()
  373. uni.showToast({ title: e.message || '加入失败', icon: 'none' })
  374. }
  375. }
  376. }
  377. })
  378. }, 500)
  379. },
  380. },
  381. computed: {
  382. dimList: function() {
  383. return DIMENSIONS
  384. },
  385. energyDotColors: function() {
  386. return ['#8D6E63', '#FF6B35', '#FFD700', '#4CAF50', '#42A5F5']
  387. }
  388. }
  389. }
  390. </script>
  391. <style>
  392. .discover-container {
  393. min-height: 100vh;
  394. background: #f5f7fa;
  395. padding-bottom: 100rpx;
  396. }
  397. /* ===== 推荐 ===== */
  398. .recommend-section {
  399. margin: 20rpx 30rpx;
  400. }
  401. .section-header {
  402. display: flex;
  403. justify-content: space-between;
  404. align-items: center;
  405. margin-bottom: 20rpx;
  406. }
  407. .section-title {
  408. font-size: 30rpx;
  409. font-weight: bold;
  410. color: #333;
  411. }
  412. .section-more {
  413. font-size: 24rpx;
  414. color: #5B9BD5;
  415. }
  416. .type-filter-scroll {
  417. white-space: nowrap;
  418. margin-bottom: 20rpx;
  419. }
  420. .filter-chip {
  421. display: inline-block;
  422. padding: 8rpx 24rpx;
  423. font-size: 24rpx;
  424. color: #666;
  425. background: #f0f0f0;
  426. border-radius: 30rpx;
  427. margin-right: 16rpx;
  428. }
  429. .filter-chip.active {
  430. background: #5B9BD5;
  431. color: #fff;
  432. }
  433. .loading-state,
  434. .empty-state {
  435. display: flex;
  436. justify-content: center;
  437. padding: 60rpx 0;
  438. }
  439. .loading-text,
  440. .empty-text {
  441. font-size: 26rpx;
  442. color: #999;
  443. }
  444. .product-grid {
  445. display: flex;
  446. flex-wrap: wrap;
  447. justify-content: space-between;
  448. }
  449. .product-card {
  450. width: 48%;
  451. background: #fff;
  452. border-radius: 16rpx;
  453. overflow: hidden;
  454. margin-bottom: 20rpx;
  455. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.06);
  456. }
  457. .product-cover {
  458. width: 100%;
  459. height: 200rpx;
  460. background: #f0f0f0;
  461. }
  462. .product-info {
  463. padding: 14rpx;
  464. }
  465. .product-name {
  466. display: block;
  467. font-size: 26rpx;
  468. color: #333;
  469. margin-bottom: 10rpx;
  470. overflow: hidden;
  471. text-overflow: ellipsis;
  472. white-space: nowrap;
  473. }
  474. .product-price-row {
  475. display: flex;
  476. align-items: baseline;
  477. }
  478. .product-price {
  479. font-size: 28rpx;
  480. color: #5B9BD5;
  481. font-weight: bold;
  482. margin-right: 10rpx;
  483. }
  484. .product-price-login {
  485. font-size: 24rpx;
  486. color: #999;
  487. }
  488. .product-member {
  489. font-size: 20rpx;
  490. color: #999;
  491. }
  492. /* ===== 五维全景幸福矩阵 ===== */
  493. .why-section {
  494. margin: 30rpx;
  495. }
  496. .dim-matrix {
  497. display: flex;
  498. flex-wrap: wrap;
  499. gap: 20rpx;
  500. justify-content: center;
  501. }
  502. .dim-card {
  503. width: calc(33.33% - 14rpx);
  504. box-sizing: border-box;
  505. background: #fff;
  506. border-radius: 20rpx;
  507. padding: 28rpx 16rpx 24rpx;
  508. display: flex;
  509. flex-direction: column;
  510. align-items: center;
  511. text-align: center;
  512. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  513. transition: transform 0.2s ease, box-shadow 0.2s ease;
  514. position: relative;
  515. overflow: hidden;
  516. }
  517. .dim-card:active {
  518. transform: scale(0.96);
  519. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.1);
  520. }
  521. .dim-icon-circle {
  522. width: 72rpx;
  523. height: 72rpx;
  524. border-radius: 50%;
  525. display: flex;
  526. align-items: center;
  527. justify-content: center;
  528. margin-bottom: 14rpx;
  529. flex-shrink: 0;
  530. }
  531. .dim-icon {
  532. font-size: 36rpx;
  533. line-height: 1;
  534. }
  535. .dim-tag {
  536. font-size: 22rpx;
  537. font-weight: 600;
  538. padding: 4rpx 14rpx;
  539. border-radius: 20rpx;
  540. margin-bottom: 10rpx;
  541. max-width: 100%;
  542. overflow: hidden;
  543. text-overflow: ellipsis;
  544. white-space: nowrap;
  545. }
  546. .dim-desc {
  547. font-size: 20rpx;
  548. color: #888;
  549. line-height: 1.5;
  550. display: -webkit-box;
  551. -webkit-line-clamp: 2;
  552. -webkit-box-orient: vertical;
  553. overflow: hidden;
  554. }
  555. /* 五维能量环 */
  556. .dim-energy-row {
  557. display: flex;
  558. justify-content: center;
  559. gap: 12rpx;
  560. margin-top: 24rpx;
  561. opacity: 0.5;
  562. }
  563. .energy-dot {
  564. width: 10rpx;
  565. height: 10rpx;
  566. border-radius: 50%;
  567. }
  568. /* ===== 底部登录 ===== */
  569. .login-footer {
  570. margin: 40rpx 30rpx;
  571. display: flex;
  572. flex-direction: column;
  573. align-items: center;
  574. }
  575. .login-btn {
  576. width: 100%;
  577. height: 88rpx;
  578. line-height: 88rpx;
  579. background: linear-gradient(135deg, #5B9BD5, #3A7CC4);
  580. color: #fff;
  581. font-size: 32rpx;
  582. font-weight: bold;
  583. border-radius: 44rpx;
  584. text-align: center;
  585. border: none;
  586. }
  587. .login-btn::after {
  588. border: none;
  589. }
  590. .login-footer-text {
  591. font-size: 20rpx;
  592. color: #bbb;
  593. margin-top: 16rpx;
  594. }
  595. /* ===== 加载占位 ===== */
  596. .loading-container {
  597. display: flex;
  598. justify-content: center;
  599. align-items: center;
  600. height: 100vh;
  601. }
  602. /* ===== 角色切换淡入淡出 ===== */
  603. .role-switch-wrapper {
  604. width: 100%;
  605. min-height: 100vh;
  606. }
  607. .fade-enter-active,
  608. .fade-leave-active {
  609. transition: opacity 0.3s ease;
  610. }
  611. .fade-enter,
  612. .fade-leave-to {
  613. opacity: 0;
  614. }
  615. /* ===== 通用区块样式 ===== */
  616. .section {
  617. margin: 20rpx 30rpx;
  618. }
  619. .section-header {
  620. display: flex;
  621. justify-content: space-between;
  622. align-items: center;
  623. margin-bottom: 20rpx;
  624. }
  625. .section-title {
  626. font-size: 30rpx;
  627. font-weight: bold;
  628. color: #333;
  629. }
  630. .section-more {
  631. font-size: 24rpx;
  632. color: #5B9BD5;
  633. }
  634. .empty-state {
  635. display: flex;
  636. justify-content: center;
  637. padding: 60rpx 0;
  638. }
  639. .empty-text {
  640. font-size: 26rpx;
  641. color: #999;
  642. }
  643. /* ===== 活动列表 ===== */
  644. .activity-list {
  645. display: flex;
  646. flex-direction: column;
  647. gap: 16rpx;
  648. }
  649. .activity-card {
  650. background: #fff;
  651. border-radius: 16rpx;
  652. overflow: hidden;
  653. display: flex;
  654. flex-direction: row;
  655. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  656. }
  657. .activity-card:active {
  658. opacity: 0.8;
  659. }
  660. .activity-cover {
  661. width: 200rpx;
  662. height: 160rpx;
  663. flex-shrink: 0;
  664. background: #f0f0f0;
  665. }
  666. .activity-info {
  667. flex: 1;
  668. padding: 16rpx;
  669. display: flex;
  670. flex-direction: column;
  671. justify-content: space-between;
  672. }
  673. .activity-name {
  674. font-size: 28rpx;
  675. font-weight: bold;
  676. color: #333;
  677. margin-bottom: 8rpx;
  678. }
  679. .line-clamp-1 {
  680. overflow: hidden;
  681. text-overflow: ellipsis;
  682. white-space: nowrap;
  683. }
  684. .activity-meta {
  685. display: flex;
  686. align-items: center;
  687. margin-bottom: 8rpx;
  688. }
  689. .activity-time {
  690. font-size: 22rpx;
  691. color: #999;
  692. }
  693. .activity-bottom {
  694. display: flex;
  695. align-items: center;
  696. gap: 12rpx;
  697. }
  698. .activity-status {
  699. font-size: 20rpx;
  700. padding: 2rpx 10rpx;
  701. border-radius: 8rpx;
  702. background: #E8F5E9;
  703. color: #2E7D32;
  704. }
  705. .activity-status.status-upcoming {
  706. background: #E3F2FD;
  707. color: #1565C0;
  708. }
  709. .activity-status.status-ended {
  710. background: #F5F5F5;
  711. color: #999;
  712. }
  713. .activity-fee {
  714. font-size: 24rpx;
  715. color: #F97316;
  716. font-weight: bold;
  717. }
  718. .activity-fee.fee-free {
  719. color: #4CAF50;
  720. }
  721. /* ===== 文章列表 ===== */
  722. .article-list {
  723. display: flex;
  724. flex-direction: column;
  725. gap: 16rpx;
  726. }
  727. .article-card {
  728. background: #fff;
  729. border-radius: 16rpx;
  730. padding: 24rpx;
  731. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  732. }
  733. .article-card:active {
  734. opacity: 0.8;
  735. }
  736. .article-category {
  737. display: inline-block;
  738. padding: 4rpx 14rpx;
  739. border-radius: 8rpx;
  740. margin-bottom: 10rpx;
  741. }
  742. .article-category-text {
  743. font-size: 20rpx;
  744. color: #fff;
  745. }
  746. .article-title {
  747. display: block;
  748. font-size: 28rpx;
  749. font-weight: bold;
  750. color: #333;
  751. margin-bottom: 8rpx;
  752. line-height: 1.4;
  753. }
  754. .article-summary {
  755. display: block;
  756. font-size: 24rpx;
  757. color: #888;
  758. line-height: 1.5;
  759. margin-bottom: 12rpx;
  760. overflow: hidden;
  761. text-overflow: ellipsis;
  762. display: -webkit-box;
  763. -webkit-line-clamp: 2;
  764. -webkit-box-orient: vertical;
  765. }
  766. .article-meta {
  767. display: flex;
  768. align-items: center;
  769. gap: 16rpx;
  770. }
  771. .meta-item {
  772. display: flex;
  773. align-items: center;
  774. gap: 4rpx;
  775. }
  776. .meta-icon {
  777. font-size: 24rpx;
  778. }
  779. .meta-text {
  780. font-size: 22rpx;
  781. color: #999;
  782. }
  783. .article-date {
  784. font-size: 22rpx;
  785. color: #bbb;
  786. }
  787. </style>