index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  1. <template>
  2. <view class="ac-container" :style="{ '--font-scale': fontScale }">
  3. <!-- 登录浮层(全局组件,页面内弹出底部登录) -->
  4. <login-sheet ref="loginSheet" @success="onSheetLoginSuccess" />
  5. <!-- 自定义导航栏 -->
  6. <view class="ac-nav">
  7. <view class="ac-nav-left" @click="onBack">
  8. <text class="ac-nav-back">&#x2190;</text>
  9. </view>
  10. <text class="ac-nav-title">知识分享</text>
  11. <view class="ac-nav-right">
  12. <text class="ac-nav-search-icon" @click="focusSearch">&#x1F50D;</text>
  13. <text class="ac-nav-add" @click="goEdit">+</text>
  14. </view>
  15. </view>
  16. <!-- 搜索栏(聚焦时展开) -->
  17. <view v-if="searchFocused || searchKeyword" class="ac-search-bar">
  18. <input
  19. class="ac-search-input"
  20. v-model="searchKeyword"
  21. placeholder="搜索文章..."
  22. confirm-type="search"
  23. @confirm="onSearch"
  24. @input="onSearchInput"
  25. @blur="onSearchBlur"
  26. />
  27. <text class="ac-search-cancel" @click="searchKeyword = ''; searchFocused = false; onSearch()">取消</text>
  28. </view>
  29. <!-- 搜索历史(聚焦且未输入时展示,上限 10 条可清空) -->
  30. <view v-if="searchFocused && !searchKeyword && searchHistory.length" class="ac-search-history">
  31. <view class="ac-history-header">
  32. <text class="ac-history-title">搜索历史</text>
  33. <text class="ac-history-clear" @click="clearSearchHistory">清除</text>
  34. </view>
  35. <view class="ac-history-tags">
  36. <text
  37. v-for="(item, idx) in searchHistory"
  38. :key="idx"
  39. class="ac-history-tag"
  40. @click="clickSearchHistory(item)"
  41. >{{ item }}</text>
  42. </view>
  43. </view>
  44. <!-- Tab 导航(药丸式) -->
  45. <view class="ac-tabs">
  46. <scroll-view scroll-x show-scrollbar="false" class="ac-tab-scroll">
  47. <view
  48. v-for="tab in tabList"
  49. :key="tab.code"
  50. :class="['ac-tab', currentTab === tab.code ? 'active' : '']"
  51. :style="currentTab === tab.code ? 'background:' + tab.color + ';color:' + whiteColor + ';border-color:' + tab.color : ''"
  52. @click="onTabChange(tab.code)"
  53. >
  54. {{ tab.name }}
  55. </view>
  56. </scroll-view>
  57. </view>
  58. <!-- 书册式推荐阅读 -->
  59. <ArticleBookshelf
  60. v-if="recommendedArticles.length > 0 || !recommendLoading"
  61. :articles="recommendedArticles"
  62. :loading="recommendLoading"
  63. :isLoggedIn="isLoggedIn"
  64. @articleClick="goDetail"
  65. @moreArticles="goExplore"
  66. />
  67. <!-- 文章列表区域 -->
  68. <scroll-view scroll-y class="ac-scroll" @scrolltolower="onLoadMore">
  69. <!-- 骨架屏 -->
  70. <view v-if="loading && articles.length === 0" class="ac-skeleton-wrap">
  71. <view v-for="n in 3" :key="n" class="sk-card">
  72. <view class="sk-cover"></view>
  73. <view class="sk-body">
  74. <view class="sk-row sk-tag"></view>
  75. <view class="sk-row sk-title"></view>
  76. <view class="sk-row sk-desc"></view>
  77. <view class="sk-row sk-footer"></view>
  78. </view>
  79. </view>
  80. </view>
  81. <!-- 空状态(搜索态无命中 → 未找到相关文章;非搜索态 → 暂无文章) -->
  82. <view v-else-if="noMore && articles.length === 0" class="ac-empty">
  83. <image class="ac-empty-img" src="/static/empty-article.png" mode="aspectFit" lazy-load></image>
  84. <text class="ac-empty-text">{{ isSearchEmpty ? '未找到相关文章' : '暂无文章' }}</text>
  85. </view>
  86. <!-- 文章列表 -->
  87. <view v-else class="ac-feed">
  88. <view
  89. v-for="item in articles"
  90. :key="item.id"
  91. class="ac-card"
  92. hover-class="ac-card-pressed"
  93. @click="goDetail(item.id)"
  94. >
  95. <view class="ac-card-media">
  96. <image
  97. class="ac-card-cover"
  98. :src="getImageUrl(item.coverImage) || '/static/default-article.png'"
  99. mode="aspectFill"
  100. lazy-load />
  101. <view class="ac-card-dimension-tags" v-if="item.relatedDimensions">
  102. <view
  103. v-for="dim in parseDimensions(item.relatedDimensions)"
  104. :key="dim.code"
  105. class="ac-card-dim-tag"
  106. :style="'background:' + dim.color"
  107. >{{ dim.name }}</view>
  108. </view>
  109. </view>
  110. <view class="ac-card-body">
  111. <view class="ac-card-meta-top">
  112. <text class="ac-card-category" v-if="item.categoryName">{{ item.categoryName }}</text>
  113. <text class="ac-card-readtime">&#x1F4D6; {{ item.readTime || 3 }}分钟</text>
  114. </view>
  115. <text class="ac-card-title">{{ item.title }}</text>
  116. <text class="ac-card-summary" v-if="item.summary">{{ item.summary }}</text>
  117. <view class="ac-card-footer">
  118. <text class="ac-card-author">{{ item.author || '浠艾福' }}</text>
  119. <text class="ac-card-sep">|</text>
  120. <text class="ac-card-date">{{ formatDate(item.publishedAt) }}</text>
  121. <text class="ac-card-fav">&#x2B50; {{ item.favCount || 0 }}</text>
  122. <text class="ac-card-sep">|</text>
  123. <text class="ac-card-readcount">&#x1F441; {{ item.viewCount || 0 }}</text>
  124. <text class="ac-card-sep">|</text>
  125. <text class="ac-card-duration">&#x23F1; {{ formatDuration(item.totalDurationSeconds) }}</text>
  126. </view>
  127. </view>
  128. </view>
  129. </view>
  130. <!-- 加载更多 / 没有更多 -->
  131. <view v-if="loadingMore" class="ac-loading-more">
  132. <text class="ac-loading-text">加载中...</text>
  133. </view>
  134. <view v-if="noMore && articles.length > 0" class="ac-no-more">
  135. <text class="ac-no-more-text">— 没有更多了 —</text>
  136. </view>
  137. <view class="ac-bottom-gap"></view>
  138. </scroll-view>
  139. <!-- 浮动发布按钮 -->
  140. <view class="ac-fab" @click="goEdit">
  141. <text class="ac-fab-icon">+</text>
  142. </view>
  143. </view>
  144. </template>
  145. <script>
  146. import { BrandColors } from '../../utils/brand-colors.js'
  147. import { getArticleList, getArticleTags, getFeaturedArticles } from '@/utils/api.js'
  148. import config from '@/config.js'
  149. import fontScaleMixin from '@/mixins/font-scale.js'
  150. export default {
  151. mixins: [fontScaleMixin],
  152. data() {
  153. return {
  154. whiteColor: BrandColors.white,
  155. tabList: [
  156. { code: '', name: '全部', color: BrandColors.primary }
  157. ],
  158. currentTab: '',
  159. articles: [],
  160. page: 1,
  161. size: 10,
  162. total: 0,
  163. loading: false,
  164. loadingMore: false,
  165. noMore: false,
  166. searchKeyword: '',
  167. searchFocused: false,
  168. searchHistory: [],
  169. isLoggedIn: false,
  170. recommendedArticles: [],
  171. recommendLoading: false
  172. }
  173. },
  174. computed: {
  175. // 搜索态判定:供空态文案区分「未找到相关文章 / 暂无文章」(契约 C5)
  176. isSearchEmpty() {
  177. return !!(this.searchKeyword && this.searchKeyword.trim())
  178. }
  179. },
  180. components: {
  181. ArticleBookshelf: () => require('@/pages/home-pages/components/ArticleBookshelf.vue')
  182. },
  183. onLoad(options) {
  184. // 兼容旧入口:外部传入 dimension(旧五维 code)时仍设置 currentTab。
  185. // 新语义下 currentTab 表示「文章标签」,若外部传的是旧五维 code,
  186. // 将命中 tag 为空的降级结果(无可匹配文章),属可接受的降级行为。
  187. if (options && options.dimension) {
  188. this.currentTab = options.dimension
  189. }
  190. this.isLoggedIn = !!uni.getStorageSync('token')
  191. this.currentChildId = uni.getStorageSync('currentChildId') || null
  192. this.loadTags()
  193. this.loadArticles()
  194. this.loadRecommendedArticles()
  195. this.loadSearchHistory()
  196. },
  197. onShow() {
  198. this.isLoggedIn = !!uni.getStorageSync('token')
  199. },
  200. onUnload() {
  201. if (this._searchTimer) {
  202. clearTimeout(this._searchTimer)
  203. this._searchTimer = null
  204. }
  205. },
  206. methods: {
  207. async loadTags() {
  208. try {
  209. var res = await getArticleTags()
  210. if (res && res.code === 200 && res.data && res.data.length) {
  211. var addList = res.data.map(function(tag) {
  212. return { code: tag, name: tag, color: BrandColors.primary }
  213. })
  214. this.tabList = [{ code: '', name: '全部', color: BrandColors.primary }].concat(addList)
  215. }
  216. } catch (e) {
  217. // 标签拉取失败时保留「全部」,文章列表仍可正常浏览
  218. }
  219. },
  220. async loadArticles(isLoadMore) {
  221. if (!isLoadMore) {
  222. if (this.loading) return
  223. this.loading = true
  224. this.page = 1
  225. this.articles = []
  226. this.noMore = false
  227. } else {
  228. if (this.loadingMore || this.noMore) return
  229. this.loadingMore = true
  230. }
  231. // 请求序号:新的搜索/刷新会使仍在途的旧响应作废,避免过期数据覆盖新结果
  232. var seq = (this._seq = (this._seq || 0) + 1)
  233. try {
  234. var params = { page: this.page, size: this.size }
  235. if (this.currentChildId) {
  236. params.memberId = parseInt(this.currentChildId)
  237. }
  238. if (this.currentTab) {
  239. params.tag = this.currentTab
  240. }
  241. if (this.searchKeyword && this.searchKeyword.trim()) {
  242. params.keyword = this.searchKeyword.trim()
  243. }
  244. var res = await getArticleList(params)
  245. if (seq !== this._seq) return
  246. if (res.code === 200 && res.data) {
  247. var list = res.data.records || []
  248. if (this.page === 1) {
  249. this.articles = list
  250. } else {
  251. this.articles = this.articles.concat(list)
  252. }
  253. this.total = res.data.total || 0
  254. this.noMore = this.articles.length >= this.total
  255. }
  256. } catch (e) {
  257. if (seq === this._seq) {
  258. uni.showToast({ title: '加载失败', icon: 'none' })
  259. }
  260. } finally {
  261. if (seq === this._seq) {
  262. this.loading = false
  263. this.loadingMore = false
  264. }
  265. }
  266. },
  267. onTabChange(code) {
  268. if (this.currentTab === code) return
  269. this.currentTab = code
  270. this.searchKeyword = ''
  271. this.searchFocused = false
  272. this.resetList()
  273. this.loadArticles()
  274. },
  275. async loadRecommendedArticles() {
  276. var self = this
  277. self.recommendLoading = true
  278. try {
  279. var res = await getFeaturedArticles({ size: 8 })
  280. if (res && res.code === 200 && res.data) {
  281. // 兼容数组 / { list } / { records } 三种响应结构,保证永远赋值数组
  282. var raw = Array.isArray(res.data) ? res.data : (res.data.list || res.data.records || [])
  283. self.recommendedArticles = Array.isArray(raw) ? raw : []
  284. }
  285. } catch (e) {
  286. // silent fail
  287. } finally {
  288. self.recommendLoading = false
  289. }
  290. },
  291. onLoadMore() {
  292. if (this.noMore || this.loading || this.loadingMore) return
  293. this.page++
  294. this.loadArticles(true)
  295. },
  296. goDetail(idOrArticle) {
  297. var id = idOrArticle && idOrArticle.id ? idOrArticle.id : idOrArticle
  298. uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
  299. },
  300. goEdit() {
  301. var isLoggedIn = !!uni.getStorageSync('token')
  302. if (isLoggedIn) {
  303. uni.navigateTo({ url: '/pages/article-center/article-edit' })
  304. } else {
  305. this.openLoginSheet({ redirect: '/pages/article-center/index' })
  306. }
  307. },
  308. goExplore() {
  309. // 筛选全部文章
  310. this.currentTab = ''
  311. this.page = 1
  312. this.articles = []
  313. this.loadArticles()
  314. },
  315. // 登录浮层成功回调:刷新文章列表(登录后可见编辑入口等)
  316. onLoginSuccess() {
  317. this.loadArticles()
  318. },
  319. formatDate(dateStr) {
  320. if (!dateStr) return ''
  321. return dateStr.slice(0, 10)
  322. },
  323. formatDuration(seconds) {
  324. if (!seconds || seconds <= 0) return '0分钟'
  325. var mins = Math.round(seconds / 60)
  326. if (mins < 60) return mins + '分钟'
  327. var hours = Math.floor(mins / 60)
  328. var restMins = mins % 60
  329. return restMins > 0 ? hours + '小时' + restMins + '分钟' : hours + '小时'
  330. },
  331. parseDimensions(str) {
  332. if (!str) return []
  333. var dimMap = {
  334. body: { code: 'body', color: BrandColors.body, name: '身' },
  335. mind: { code: 'mind', color: BrandColors.mind, name: '心' },
  336. wisdom: { code: 'wisdom', color: BrandColors.wisdom, name: '智' },
  337. action: { code: 'action', color: BrandColors.success, name: '行' },
  338. wealth: { code: 'wealth', color: BrandColors.wealth, name: '富' }
  339. }
  340. var codes = str.split(',').map(function(s) { return s.trim().toLowerCase() })
  341. return codes.filter(function(c) { return dimMap[c] }).map(function(c) { return dimMap[c] })
  342. },
  343. focusSearch() {
  344. this.searchFocused = true
  345. // 进入搜索态:清当前 Tab 回全量(搜索与标签筛选互斥,契约 C6)
  346. if (this.currentTab !== '') {
  347. this.currentTab = ''
  348. this.resetList()
  349. this.loadArticles()
  350. }
  351. },
  352. onSearch() {
  353. this.doSearch(true)
  354. },
  355. doSearch(saveHistory) {
  356. var keyword = (this.searchKeyword || '').trim()
  357. // 进入搜索态:清当前 Tab 回全量(互斥重置,契约 C6)
  358. if (this.currentTab !== '') {
  359. this.currentTab = ''
  360. }
  361. this.resetList()
  362. if (saveHistory && keyword) {
  363. this.saveSearchHistory(keyword)
  364. }
  365. this.loadArticles()
  366. },
  367. onSearchInput(e) {
  368. var value = e && e.detail ? e.detail.value : this.searchKeyword
  369. this.searchKeyword = value
  370. var self = this
  371. if (this._searchTimer) clearTimeout(this._searchTimer)
  372. // 400ms 防抖即时搜索(避免逐字请求,契约 D3a)
  373. this._searchTimer = setTimeout(function () {
  374. self._searchTimer = null
  375. self.doSearch(false)
  376. }, 400)
  377. },
  378. loadSearchHistory() {
  379. var raw = uni.getStorageSync('article_search_history')
  380. if (!raw) {
  381. this.searchHistory = []
  382. return
  383. }
  384. try {
  385. var arr = JSON.parse(raw)
  386. this.searchHistory = Array.isArray(arr) ? arr : []
  387. } catch (e) {
  388. this.searchHistory = []
  389. }
  390. },
  391. saveSearchHistory(keyword) {
  392. if (!keyword) return
  393. var list = this.searchHistory.filter(function (h) { return h !== keyword })
  394. list.unshift(keyword)
  395. if (list.length > 10) {
  396. list = list.slice(0, 10)
  397. }
  398. this.searchHistory = list
  399. uni.setStorageSync('article_search_history', JSON.stringify(list))
  400. },
  401. clearSearchHistory() {
  402. this.searchHistory = []
  403. uni.removeStorageSync('article_search_history')
  404. },
  405. clickSearchHistory(keyword) {
  406. this.searchKeyword = keyword
  407. this.onSearch()
  408. },
  409. resetList() {
  410. this.page = 1
  411. this.articles = []
  412. this.noMore = false
  413. // 作废旧请求:让新搜索/刷新取代仍在途的响应,避免旧数据覆盖新结果
  414. this._seq = (this._seq || 0) + 1
  415. this.loading = false
  416. this.loadingMore = false
  417. },
  418. onSearchBlur() {
  419. if (!this.searchKeyword) {
  420. this.searchFocused = false
  421. }
  422. },
  423. onBack() {
  424. uni.navigateBack()
  425. },
  426. getImageUrl: function(path) {
  427. if (!path || path === 'null' || path === 'undefined' || path === '/null') return ''
  428. var s = String(path).trim()
  429. if (!s || s === 'null' || s === '/null') return ''
  430. if (s.indexOf('http://') === 0 || s.indexOf('https://') === 0) return s
  431. return config.API_BASE_URL + (s.charAt(0) === '/' ? s : '/' + s)
  432. }
  433. }
  434. }
  435. </script>
  436. <style scoped lang="scss">
  437. /* ====================================
  438. 知识分享 — 重设计
  439. 白色导航 + 药丸Tab + 精装卡片
  440. ==================================== */
  441. .ac-container {
  442. min-height: 100vh;
  443. background: $app-bg;
  444. position: relative;
  445. }
  446. /* ---- 导航栏(白色简约) ---- */
  447. .ac-nav {
  448. display: flex;
  449. align-items: center;
  450. justify-content: space-between;
  451. padding: 84rpx 28rpx 20rpx;
  452. background: $app-surface;
  453. position: sticky;
  454. top: 0;
  455. z-index: 100;
  456. }
  457. .ac-nav-left {
  458. width: 60rpx;
  459. height: 48rpx;
  460. display: flex;
  461. align-items: center;
  462. justify-content: flex-start;
  463. flex-shrink: 0;
  464. }
  465. .ac-nav-back {
  466. font-size: calc(36rpx * var(--font-scale, 1));
  467. color: $facade-text-strong;
  468. font-weight: bold;
  469. }
  470. .ac-nav-title {
  471. font-size: calc(32rpx * var(--font-scale, 1));
  472. font-weight: bold;
  473. color: $text-charcoal;
  474. flex: 1;
  475. text-align: center;
  476. }
  477. .ac-nav-right {
  478. display: flex;
  479. align-items: center;
  480. gap: 20rpx;
  481. flex-shrink: 0;
  482. }
  483. .ac-nav-search-icon {
  484. font-size: calc(32rpx * var(--font-scale, 1));
  485. color: $facade-text-body;
  486. }
  487. .ac-nav-add {
  488. font-size: calc(40rpx * var(--font-scale, 1));
  489. color: $brand-primary;
  490. font-weight: 400;
  491. line-height: 1;
  492. }
  493. /* ---- 搜索展开条 ---- */
  494. .ac-search-bar {
  495. display: flex;
  496. align-items: center;
  497. padding: 12rpx 28rpx 16rpx;
  498. background: $app-surface;
  499. border-bottom: 1rpx solid $facade-fill;
  500. }
  501. .ac-search-input {
  502. flex: 1;
  503. height: 60rpx;
  504. background: $facade-fill-2;
  505. border-radius: 24rpx;
  506. padding: 0 28rpx;
  507. font-size: calc(26rpx * var(--font-scale, 1));
  508. color: $facade-text-strong;
  509. }
  510. .ac-search-cancel {
  511. font-size: calc(26rpx * var(--font-scale, 1));
  512. color: $facade-text-muted;
  513. margin-left: 16rpx;
  514. flex-shrink: 0;
  515. }
  516. /* ---- 搜索历史 ---- */
  517. .ac-search-history {
  518. padding: 16rpx 28rpx;
  519. background: $app-surface;
  520. border-bottom: 1rpx solid $facade-fill;
  521. }
  522. .ac-history-header {
  523. display: flex;
  524. align-items: center;
  525. justify-content: space-between;
  526. margin-bottom: 12rpx;
  527. }
  528. .ac-history-title {
  529. font-size: calc(24rpx * var(--font-scale, 1));
  530. color: $facade-text-muted;
  531. }
  532. .ac-history-clear {
  533. font-size: calc(22rpx * var(--font-scale, 1));
  534. color: $facade-text-ghost;
  535. }
  536. .ac-history-tags {
  537. display: flex;
  538. flex-wrap: wrap;
  539. gap: 12rpx;
  540. }
  541. .ac-history-tag {
  542. padding: 6rpx 20rpx;
  543. border-radius: 20rpx;
  544. background: $facade-fill;
  545. font-size: calc(22rpx * var(--font-scale, 1));
  546. color: $facade-text-strong;
  547. }
  548. /* ---- Tab 药丸导航 ---- */
  549. .ac-tabs {
  550. padding: 16rpx 28rpx;
  551. background: $app-surface;
  552. border-bottom: 1rpx solid $facade-fill;
  553. position: sticky;
  554. z-index: 10;
  555. }
  556. .ac-tab-scroll {
  557. white-space: nowrap;
  558. display: flex;
  559. }
  560. .ac-tab {
  561. display: inline-flex;
  562. align-items: center;
  563. justify-content: center;
  564. height: 52rpx;
  565. padding: 0 28rpx;
  566. margin-right: 16rpx;
  567. font-size: calc(24rpx * var(--font-scale, 1));
  568. color: $facade-text-body;
  569. background: $facade-fill;
  570. border-radius: 24rpx;
  571. border: 2rpx solid $facade-fill;
  572. flex-shrink: 0;
  573. transition: font-weight 0.2s;
  574. }
  575. .ac-tab.active {
  576. font-weight: 600;
  577. }
  578. /* ---- 滚动列表区域 ---- */
  579. .ac-scroll {
  580. height: calc(100vh - 200rpx);
  581. }
  582. /* ---- 骨架屏 ---- */
  583. .ac-skeleton-wrap { padding: 24rpx 28rpx; }
  584. .sk-card {
  585. background: $app-surface;
  586. border-radius: 24rpx;
  587. overflow: hidden;
  588. margin-bottom: 24rpx;
  589. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  590. }
  591. .sk-cover {
  592. height: 340rpx;
  593. background: linear-gradient(90deg, $facade-fill 25%, $facade-fill-4 50%, $facade-fill 75%);
  594. background-size: 200% 100%;
  595. animation: sk-shimmer 1.5s infinite;
  596. }
  597. .sk-body { padding: 24rpx; }
  598. .sk-row {
  599. height: 22rpx;
  600. background: linear-gradient(90deg, $facade-fill 25%, $facade-fill-4 50%, $facade-fill 75%);
  601. background-size: 200% 100%;
  602. border-radius: 8rpx;
  603. margin-bottom: 14rpx;
  604. animation: sk-shimmer 1.5s infinite;
  605. }
  606. .sk-tag { width: 20%; }
  607. .sk-title { width: 65%; }
  608. .sk-desc { width: 90%; }
  609. .sk-footer { width: 40%; height: 18rpx; }
  610. @keyframes sk-shimmer {
  611. 0% { background-position: -200% 0; }
  612. 100% { background-position: 200% 0; }
  613. }
  614. /* ---- 空状态 ---- */
  615. .ac-empty {
  616. display: flex;
  617. flex-direction: column;
  618. align-items: center;
  619. padding-top: 240rpx;
  620. }
  621. .ac-empty-img {
  622. width: 200rpx;
  623. height: 200rpx;
  624. margin-bottom: 28rpx;
  625. }
  626. .ac-empty-text {
  627. font-size: calc(28rpx * var(--font-scale, 1));
  628. color: $facade-text-ghost-light;
  629. }
  630. /* ---- 文章卡片(新版) ---- */
  631. .ac-feed {
  632. padding: 24rpx 28rpx;
  633. }
  634. .ac-card {
  635. background: $app-surface;
  636. border-radius: 24rpx;
  637. overflow: hidden;
  638. margin-bottom: 24rpx;
  639. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  640. transition: transform 0.15s;
  641. }
  642. .ac-card-pressed {
  643. transform: scale(0.97);
  644. opacity: 0.9;
  645. }
  646. /* 封面 + 维度浮标 */
  647. .ac-card-media {
  648. position: relative;
  649. width: 100%;
  650. overflow: hidden;
  651. }
  652. .ac-card-cover {
  653. display: block;
  654. width: 100%;
  655. height: 340rpx;
  656. background: $facade-fill;
  657. }
  658. .ac-card-dimension-tags {
  659. position: absolute;
  660. bottom: 12rpx;
  661. left: 16rpx;
  662. display: flex;
  663. gap: 8rpx;
  664. }
  665. .ac-card-dim-tag {
  666. padding: 2rpx 14rpx;
  667. border-radius: 16rpx;
  668. font-size: calc(20rpx * var(--font-scale, 1));
  669. color: $app-surface;
  670. font-weight: 500;
  671. line-height: 1.4;
  672. }
  673. /* 正文区 */
  674. .ac-card-body {
  675. padding: 24rpx 24rpx 28rpx;
  676. }
  677. .ac-card-meta-top {
  678. display: flex;
  679. align-items: center;
  680. margin-bottom: 12rpx;
  681. }
  682. .ac-card-category {
  683. font-size: calc(20rpx * var(--font-scale, 1));
  684. color: $brand-primary;
  685. background: rgba(249,115,22,0.08);
  686. padding: 2rpx 14rpx;
  687. border-radius: 8rpx;
  688. margin-right: 16rpx;
  689. }
  690. .ac-card-readtime {
  691. font-size: calc(20rpx * var(--font-scale, 1));
  692. color: $text-ghost-soft;
  693. }
  694. .ac-card-title {
  695. display: block;
  696. font-size: calc(30rpx * var(--font-scale, 1));
  697. font-weight: 600;
  698. color: $text-charcoal;
  699. line-height: 1.45;
  700. margin-bottom: 10rpx;
  701. overflow: hidden;
  702. text-overflow: ellipsis;
  703. display: -webkit-box;
  704. -webkit-line-clamp: 2;
  705. -webkit-box-orient: vertical;
  706. }
  707. .ac-card-summary {
  708. display: block;
  709. font-size: calc(24rpx * var(--font-scale, 1));
  710. color: $facade-text-muted;
  711. line-height: 1.5;
  712. margin-bottom: 16rpx;
  713. overflow: hidden;
  714. text-overflow: ellipsis;
  715. display: -webkit-box;
  716. -webkit-line-clamp: 2;
  717. -webkit-box-orient: vertical;
  718. }
  719. .ac-card-footer {
  720. display: flex;
  721. align-items: center;
  722. font-size: calc(20rpx * var(--font-scale, 1));
  723. color: $facade-text-ghost-light;
  724. }
  725. .ac-card-author {
  726. color: $facade-text-faint;
  727. }
  728. .ac-card-sep {
  729. margin: 0 10rpx;
  730. color: $facade-border-soft;
  731. }
  732. .ac-card-date {
  733. flex: 1;
  734. }
  735. .ac-card-fav {
  736. color: $facade-text-ghost;
  737. }
  738. .ac-card-readcount {
  739. color: $facade-text-ghost;
  740. }
  741. /* ---- 加载更多 / 没有更多 ---- */
  742. .ac-loading-more,
  743. .ac-no-more {
  744. text-align: center;
  745. padding: $uni-space-page;
  746. }
  747. .ac-loading-text {
  748. font-size: calc(24rpx * var(--font-scale, 1));
  749. color: $facade-text-ghost-light;
  750. }
  751. .ac-no-more-text {
  752. font-size: calc(24rpx * var(--font-scale, 1));
  753. color: $facade-border-soft;
  754. }
  755. .ac-bottom-gap {
  756. height: 140rpx;
  757. }
  758. /* ---- 浮动发布按钮 ---- */
  759. .ac-fab {
  760. position: fixed;
  761. right: 36rpx;
  762. bottom: 100rpx;
  763. width: 96rpx;
  764. height: 96rpx;
  765. background: linear-gradient(135deg, $brand-primary, $brand-primary-dark);
  766. color: $app-surface;
  767. border-radius: 50%;
  768. display: flex;
  769. align-items: center;
  770. justify-content: center;
  771. box-shadow: 0 6rpx 20rpx rgba(249,115,22,0.35);
  772. z-index: 100;
  773. }
  774. .ac-fab:active {
  775. transform: scale(0.92);
  776. opacity: 0.85;
  777. }
  778. .ac-fab-icon {
  779. font-size: calc(48rpx * var(--font-scale, 1));
  780. font-weight: 400;
  781. line-height: 1;
  782. }
  783. </style>