course.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942
  1. <template>
  2. <view class="container">
  3. <!-- 顶部导航 Tab -->
  4. <view class="top-nav">
  5. <view class="nav-tabs">
  6. <view
  7. class="nav-item"
  8. :class="{ active: tabIndex === 0 }"
  9. @click="tabIndex = 0"
  10. >
  11. <text>精选视频</text>
  12. <view v-if="tabIndex === 0" class="nav-indicator"></view>
  13. </view>
  14. <view
  15. class="nav-item"
  16. :class="{ active: tabIndex === 1 }"
  17. @click="tabIndex = 1"
  18. >
  19. <text>浏览记录</text>
  20. <view v-if="tabIndex === 1" class="nav-indicator"></view>
  21. </view>
  22. </view>
  23. <view v-if="tabIndex === 0" class="category-wrap">
  24. <view class="category-tags" :class="{ collapsed: !categoryExpand }">
  25. <view
  26. v-for="(cat, idx) in categories"
  27. :key="idx"
  28. class="tag-item"
  29. :class="{ active: categoryIndex === idx }"
  30. @click="onSelectCategory(idx)"
  31. >
  32. <text>{{ cat }}</text>
  33. </view>
  34. </view>
  35. <view v-if="categories.length>9" class="expand-btn" @click="categoryExpand = !categoryExpand">
  36. <text>{{ categoryExpand ? '收起' : '展开' }}</text>
  37. <image :class="{ 'rotate-arrow': !categoryExpand }" src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/class/expand.png"></image>
  38. <!-- <text class="arrow">{{ categoryExpand ? '▲' : '▼' }}</text> -->
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 精品课程 内容 -->
  43. <scroll-view
  44. v-show="tabIndex === 0"
  45. scroll-y
  46. class="scroll-wrap"
  47. :show-scrollbar="false"
  48. lower-threshold="120"
  49. @scrolltolower="onCourseScrollToLower"
  50. >
  51. <!-- 分类标签区 -->
  52. <!-- 课程骨架屏 -->
  53. <view class="course-skeleton" v-if="courseSectionLoading && courseList.length === 0">
  54. <view class="sk-course-card" v-for="i in 3" :key="'sk-course-' + i">
  55. <view class="sk-thumb"></view>
  56. <view class="sk-info">
  57. <view class="sk-line sk-line-lg"></view>
  58. <view class="sk-line sk-line-md"></view>
  59. <view class="sk-foot">
  60. <view class="sk-line sk-line-sm"></view>
  61. <view class="sk-btn"></view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="course-grid-wrap" v-else>
  67. <view class="course-grid" :class="{ 'list-dimmed': courseRefreshing }">
  68. <view
  69. v-for="(course, idx) in courseList"
  70. :key="course.courseId"
  71. class="course-card"
  72. @click="onCourseClick(course)"
  73. >
  74. <view class="card-cover">
  75. <image v-if="course.cover" :src="course.cover" mode="aspectFill" class="cover-img"></image>
  76. </view>
  77. <view class="course-info">
  78. <text class="card-title">{{ course.title }}</text>
  79. <view class="x-end" style="justify-content: space-between;">
  80. <view class="course-meta">
  81. <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/class/renshu.png"></image>
  82. <text class="meta-count">{{ courseViewsDisplay(course.views) }}</text>
  83. </view>
  84. <view class="btn-watch" @click.stop="onCourseClick(course)">立即观看</view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. <view class="refresh-mask" v-if="courseRefreshing">
  90. <view class="refresh-spinner"></view>
  91. </view>
  92. </view>
  93. <view v-if="courseList.length > 0" class="load-tip">
  94. <text v-if="courseLoading">加载中...</text>
  95. <text v-else-if="!courseHasMore">没有更多了</text>
  96. </view>
  97. <view class="bottom-placeholder"></view>
  98. </scroll-view>
  99. <!-- 最近浏览 内容 -->
  100. <scroll-view
  101. v-show="tabIndex === 1"
  102. scroll-y
  103. class="scroll-wrap"
  104. :show-scrollbar="false"
  105. lower-threshold="120"
  106. @scrolltolower="onRecentScrollToLower"
  107. >
  108. <!-- 最近浏览骨架屏 -->
  109. <view class="recent-skeleton" v-if="recentSectionLoading && recentList.length === 0">
  110. <view class="sk-recent-group" v-for="g in 2" :key="'sk-group-' + g">
  111. <view class="sk-date"></view>
  112. <view class="sk-recent-card" v-for="i in 2" :key="'sk-recent-' + g + '-' + i">
  113. <view class="sk-thumb"></view>
  114. <view class="sk-info">
  115. <view class="sk-line sk-line-lg"></view>
  116. <view class="sk-line sk-line-md"></view>
  117. <view class="sk-btn"></view>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. <!-- 有浏览记录:按日期分组列表 -->
  123. <template v-else-if="recentList.length > 0">
  124. <view v-for="(group, gIdx) in recentList" :key="gIdx" class="recent-group">
  125. <view class="group-date">
  126. <image class="date-icon" src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/class/time.png"></image>
  127. <text class="date-text">{{ group.date }}</text>
  128. </view>
  129. <view
  130. v-for="(item, i) in group.courses"
  131. :key="i"
  132. class="recent-card"
  133. @click="onCourseClick(item)"
  134. >
  135. <view class="recent-thumb">
  136. <image :src="item.imgUrl" mode="aspectFill" class="thumb-img"></image>
  137. </view>
  138. <view class="recent-info">
  139. <text class="recent-title">{{ item.courseName }}</text>
  140. <text class="recent-progress">已看: {{ item.progress }}%</text>
  141. <view class="y-end">
  142. <view class="btn-watch" @click.stop="onCourseClick(item)">立即观看</view>
  143. </view>
  144. </view>
  145. </view>
  146. </view>
  147. <view class="load-tip">
  148. <text v-if="recentLoading">加载中...</text>
  149. <text v-else-if="!recentHasMore">没有更多了</text>
  150. </view>
  151. </template>
  152. <!-- 无浏览记录:空态 + 为您精选 -->
  153. <template v-else-if="!recentSectionLoading">
  154. <view class="empty-state">
  155. <!-- <view class="empty-icon"></view> -->
  156. <image class="empty-icon" src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/class/nodata.png"></image>
  157. <text class="empty-text">暂无浏览内容</text>
  158. </view>
  159. <view class="recommend-section">
  160. <text class="recommend-title">为您精选</text>
  161. <view class="course-grid" style="padding: 0;">
  162. <view
  163. v-for="(course, idx) in recommendList"
  164. :key="idx"
  165. class="course-card"
  166. @click="onCourseClick(course)"
  167. >
  168. <view class="card-cover">
  169. <image :src="course.imgUrl" mode="aspectFill" class="cover-img"></image>
  170. </view>
  171. <view class="card-footer">
  172. <text class="card-title">{{ course.title }}</text>
  173. <view class="x-end" style="justify-content: space-between;">
  174. <view class="course-meta">
  175. <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/class/renshu.png"></image>
  176. <text class="meta-count">{{ courseViewsDisplay(course.views) }}</text>
  177. </view>
  178. <view class="btn-watch" @click.stop="onCourseClick(course)">立即观看</view>
  179. </view>
  180. </view>
  181. </view>
  182. </view>
  183. </view>
  184. </template>
  185. <view class="bottom-placeholder"></view>
  186. </scroll-view>
  187. </view>
  188. </template>
  189. <script>
  190. import { listPublicCourseCategory, listPublicCourse } from '@/api/home.js'
  191. import { getCourseStudyList } from '@/api/class.js'
  192. export default {
  193. data() {
  194. return {
  195. statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 'px',
  196. tabIndex: 0,
  197. categoryExpand: false,
  198. categoryIndex: 0,
  199. categories: [],
  200. categoryRows: [],
  201. courseList: [],
  202. coursePageNum: 1,
  203. coursePageSize: 10,
  204. courseLoading: false,
  205. courseRefreshing: false,
  206. courseSectionLoading: true,
  207. courseHasMore: true,
  208. courseQuerySubCateId: null,
  209. courseRequestId: 0,
  210. recentPageNum: 1,
  211. recentPageSize: 10,
  212. recentLoading: false,
  213. recentSectionLoading: true,
  214. recentHasMore: true,
  215. recentList: [
  216. // {
  217. // date: '2026-02-08',
  218. // list: [
  219. // { title: '歌唱家刘金的《0基础金曲演唱速练课》', progress: 87, cover: '' },
  220. // { title: '资深编辑邹方斌讲《毛笔书法修心课》', progress: 56, cover: '' }
  221. // ]
  222. // },
  223. // {
  224. // date: '2026-02-01',
  225. // list: [
  226. // { title: '张斌《元气八段锦》系列课', progress: 56, cover: '' }
  227. // ]
  228. // }
  229. ],
  230. recommendList: [
  231. // { title: '刘金的《0基础金曲演唱速练课》', views: '9239', cover: '' },
  232. // { title: '邹方斌讲《毛笔书法修心课》', views: '10.8w', cover: '' },
  233. // { title: '张斌《元气八段锦》系列课', views: '2.5w', cover: '' },
  234. // { title: '翔哥精讲摄影课-手机微距拍摄技巧...', views: '100w+', cover: '' }
  235. ]
  236. }
  237. },
  238. onLoad() {
  239. // 默认先查一次课程(不带分类参数),再加载分类标签
  240. this.initPublicCourseData()
  241. this.getNewCourseList()
  242. },
  243. methods: {
  244. courseViewsDisplay(views) {
  245. const raw = views;
  246. const n = Number(raw);
  247. if (!Number.isFinite(n) || n < 0) {
  248. return "0";
  249. }
  250. if (n < 100000) {
  251. return String(Math.floor(n));
  252. }
  253. if (n < 1000000) {
  254. return (n / 10000).toFixed(1) + "w";
  255. }
  256. return "100w+";
  257. },
  258. async initPublicCourseData() {
  259. await this.getCategoryList()
  260. this.courseQuerySubCateId = null
  261. await this.getCourseList({})
  262. await this.getCourseStudyList({})
  263. },
  264. async getNewCourseList() {
  265. try {
  266. const params = { pageNum: 1, pageSize:6 }
  267. const res = await listPublicCourse(params)
  268. const list = (res && res.data && res.data.list) || []
  269. this.recommendList = list.map(item => ({
  270. courseId: item.courseId,
  271. title: item.courseTitle || item.courseName || '',
  272. views: item.watchUserCount || 0,
  273. cover: item.imgUrl || ''
  274. }))
  275. } catch (e) {
  276. this.recommendList = []
  277. }
  278. },
  279. async getCategoryList() {
  280. try {
  281. const res = await listPublicCourseCategory({ pageNum: 1, pageSize: 50 ,yxxTag:0})
  282. const list = (res && res.data && res.data.list) || []
  283. this.categoryRows = [{ cateId: null, cateName: '全部' }, ...list]
  284. this.categories = this.categoryRows.map(item => item.cateName || '')
  285. } catch (e) {
  286. this.categoryRows = [{ cateId: null, cateName: '全部' }]
  287. this.categories = ['全部']
  288. }
  289. },
  290. countRecentCourses(groups) {
  291. if (!Array.isArray(groups)) return 0
  292. return groups.reduce((n, g) => n + (g && g.courses ? g.courses.length : 0), 0)
  293. },
  294. mergeRecentGroups(existing, incoming) {
  295. if (!Array.isArray(incoming) || incoming.length === 0) {
  296. return Array.isArray(existing) ? existing.slice() : []
  297. }
  298. if (!Array.isArray(existing) || existing.length === 0) {
  299. return incoming.map(g => ({
  300. date: g.date,
  301. courses: [...(g.courses || [])]
  302. }))
  303. }
  304. const result = existing.map(g => ({
  305. date: g.date,
  306. courses: [...(g.courses || [])]
  307. }))
  308. for (const ng of incoming) {
  309. const last = result[result.length - 1]
  310. if (last && last.date === ng.date) {
  311. last.courses = last.courses.concat(ng.courses || [])
  312. } else {
  313. result.push({ date: ng.date, courses: [...(ng.courses || [])] })
  314. }
  315. }
  316. return result
  317. },
  318. async getCourseList(options = {}) {
  319. const loadMore = !!options.loadMore
  320. if (this.courseLoading && loadMore) return
  321. if (loadMore && !this.courseHasMore) return
  322. const requestId = ++this.courseRequestId
  323. if (!loadMore) {
  324. this.coursePageNum = 1
  325. this.courseHasMore = true
  326. if (options.subCateId !== undefined) {
  327. this.courseQuerySubCateId = options.subCateId
  328. }
  329. if (this.courseList.length > 0) {
  330. this.courseRefreshing = true
  331. } else {
  332. this.courseSectionLoading = true
  333. }
  334. }
  335. const currentPageNum = this.coursePageNum
  336. const params = {
  337. yxxTag: 0,
  338. pageNum: currentPageNum,
  339. pageSize: this.coursePageSize
  340. }
  341. if (this.courseQuerySubCateId) {
  342. params.subCateId = this.courseQuerySubCateId
  343. }
  344. this.courseLoading = true
  345. try {
  346. const res = await listPublicCourse(params)
  347. if (requestId !== this.courseRequestId) return
  348. const list = (res && res.data && res.data.list) || []
  349. const mapped = list.map(item => ({
  350. courseId: item.courseId,
  351. title: item.courseTitle || item.courseName || '',
  352. views: item.watchUserCount || 0,
  353. cover: item.imgUrl || ''
  354. }))
  355. this.courseList = loadMore ? this.courseList.concat(mapped) : mapped
  356. const total = Number(res.data && res.data.total)
  357. if (Number.isFinite(total) && total >= 0) {
  358. this.courseHasMore = this.courseList.length < total
  359. } else {
  360. this.courseHasMore = mapped.length >= this.coursePageSize
  361. }
  362. if (mapped.length > 0) {
  363. this.coursePageNum = currentPageNum + 1
  364. } else {
  365. this.courseHasMore = false
  366. }
  367. } catch (e) {
  368. if (requestId !== this.courseRequestId) return
  369. if (!loadMore) {
  370. this.courseList = []
  371. }
  372. this.courseHasMore = false
  373. } finally {
  374. if (requestId !== this.courseRequestId) return
  375. this.courseLoading = false
  376. this.courseRefreshing = false
  377. if (!loadMore) this.courseSectionLoading = false
  378. }
  379. },
  380. onCourseScrollToLower() {
  381. if (this.tabIndex !== 0) return
  382. this.getCourseList({ loadMore: true })
  383. },
  384. async getCourseStudyList(options = {}) {
  385. const loadMore = !!options.loadMore
  386. if (this.recentLoading && !loadMore) return
  387. if (loadMore && !this.recentHasMore) return
  388. if (!loadMore) {
  389. this.recentPageNum = 1
  390. this.recentHasMore = true
  391. if (this.recentList.length === 0) {
  392. this.recentSectionLoading = true
  393. }
  394. }
  395. const currentPageNum = this.recentPageNum
  396. const params = {
  397. courseType: 0,
  398. pageNum: currentPageNum,
  399. pageSize: this.recentPageSize
  400. }
  401. this.recentLoading = true
  402. try {
  403. const res = await getCourseStudyList(params)
  404. const list = (res && res.data && res.data.list) || []
  405. const merged = loadMore ? this.mergeRecentGroups(this.recentList, list) : list
  406. this.recentList = merged
  407. const pageCourseCount = this.countRecentCourses(list)
  408. const total = Number(res.data && res.data.total)
  409. if (Number.isFinite(total) && total >= 0) {
  410. const loaded = this.countRecentCourses(this.recentList)
  411. this.recentHasMore = loaded < total
  412. } else {
  413. this.recentHasMore = pageCourseCount >= this.recentPageSize
  414. }
  415. if (pageCourseCount > 0) {
  416. this.recentPageNum = currentPageNum + 1
  417. } else {
  418. this.recentHasMore = false
  419. }
  420. } catch (e) {
  421. if (!loadMore) {
  422. this.recentList = []
  423. }
  424. this.recentHasMore = false
  425. } finally {
  426. this.recentLoading = false
  427. if (!loadMore) this.recentSectionLoading = false
  428. }
  429. },
  430. onRecentScrollToLower() {
  431. if (this.tabIndex !== 1) return
  432. if (!this.recentList.length) return
  433. this.getCourseStudyList({ loadMore: true })
  434. },
  435. onSelectCategory(idx) {
  436. if (idx === this.categoryIndex || this.courseRefreshing) return
  437. this.categoryIndex = idx
  438. const selected = this.categoryRows[idx]
  439. const subCateId = selected && selected.cateId ? selected.cateId : null
  440. this.getCourseList({ subCateId })
  441. },
  442. onCourseClick(course) {
  443. if (course && course.courseId) {
  444. uni.navigateTo({ url: '/pages_index/courseDetail?courseId=' + course.courseId + '&type=1' })
  445. return
  446. }
  447. }
  448. }
  449. }
  450. </script>
  451. <style lang="scss" scoped>
  452. /* 图片箭头旋转类(展开时向上) */
  453. .rotate-arrow {
  454. transform: rotate(180deg);
  455. }
  456. .container {
  457. min-height: 100vh;
  458. background: #F5F5F5;
  459. display: flex;
  460. flex-direction: column;
  461. }
  462. /* 顶部 Tab */
  463. .top-nav {
  464. display: flex;
  465. flex-direction: column;
  466. background: #fff;
  467. /* border-bottom: 1rpx solid #f0f0f0; */
  468. }
  469. .nav-tabs {
  470. display: flex;
  471. align-items: center;
  472. justify-content: center;
  473. }
  474. .nav-item {
  475. flex:1;
  476. display: flex;
  477. align-items: center;
  478. justify-content: center;
  479. position: relative;
  480. padding: 24rpx 0;
  481. }
  482. .nav-item text {
  483. font-family: PingFangSC, PingFang SC;
  484. font-weight: 400;
  485. font-size: 36rpx;
  486. color: #030303;
  487. }
  488. .nav-item.active text {
  489. font-weight: 600;
  490. font-size: 40rpx;
  491. }
  492. .nav-indicator {
  493. position: absolute;
  494. left: 50%;
  495. bottom: 0;
  496. transform: translateX(-50%);
  497. width: 100rpx;
  498. height: 10rpx;
  499. background: linear-gradient( 135deg, #FF5267 0%, #FF233C 100%);
  500. border-radius: 6rpx;
  501. }
  502. .nav-actions {
  503. display: flex;
  504. align-items: center;
  505. gap: 24rpx;
  506. }
  507. .action-icon {
  508. font-size: 36rpx;
  509. color: #666;
  510. }
  511. /* 滚动区 */
  512. .scroll-wrap {
  513. flex: 1;
  514. height: 0;
  515. }
  516. /* 分类标签 */
  517. .category-wrap {
  518. padding:24rpx 24rpx 12rpx;
  519. border-radius: 0rpx 0rpx 20rpx 20rpx;
  520. background: #fff;
  521. display: flex;
  522. align-items: center;
  523. flex-direction: column;
  524. }
  525. .category-tags {
  526. width: 100%;
  527. display: flex;
  528. flex-wrap: wrap;
  529. gap:24rpx;
  530. flex-direction: row;
  531. justify-content: flex-start;
  532. }
  533. .category-tags.collapsed {
  534. max-height: 336rpx;
  535. overflow: hidden;
  536. }
  537. .tag-item {
  538. flex: 0 0 calc((100% - 2*24rpx)/3);
  539. padding: 20rpx 0;
  540. text-align: center;
  541. border-radius: 20rpx;
  542. background: #f0f0f0;
  543. }
  544. .tag-item text {
  545. font-family: PingFangSC, PingFang SC;
  546. font-weight: 400;
  547. font-size: 40rpx;
  548. color: rgba(0,0,0,0.85);
  549. overflow: hidden;
  550. text-overflow: ellipsis;
  551. display: -webkit-box;
  552. -webkit-line-clamp: 1;
  553. -webkit-box-orient: vertical;
  554. }
  555. .tag-item.active {
  556. background: linear-gradient( 135deg, #FF5267 0%, #FF233C 100%);
  557. }
  558. .tag-item.active text {
  559. color: #fff;
  560. }
  561. .expand-btn {
  562. display: flex;
  563. align-items: center;
  564. justify-content: center;
  565. margin-top: 24rpx;
  566. width: 166rpx;
  567. height: 64rpx;
  568. border-radius: 32rpx;
  569. border: 2rpx solid #FF233C;
  570. }
  571. .expand-btn text {
  572. font-family: PingFangSC, PingFang SC;
  573. font-weight: 400;
  574. font-size: 32rpx;
  575. color: #FF233C;
  576. }
  577. .expand-btn .arrow {
  578. margin-left: 6rpx;
  579. font-size: 22rpx;
  580. }
  581. .expand-btn image{
  582. margin-left:10rpx ;
  583. width: 32rpx;
  584. height: 32rpx;
  585. }
  586. /* 课程网格 */
  587. .course-grid {
  588. display: flex;
  589. flex-wrap: wrap;
  590. padding:24rpx;
  591. gap: 24rpx 20rpx;
  592. flex-direction: column;
  593. }
  594. .course-card {
  595. display: flex;
  596. background: #fff;
  597. border-radius: 20rpx;
  598. overflow: hidden;
  599. padding: 20rpx;
  600. }
  601. .course-tag {
  602. position: absolute;
  603. left: 0;
  604. bottom: 0;
  605. right: 0;
  606. padding: 8rpx 12rpx;
  607. background: linear-gradient(transparent, rgba(0,0,0,0.6));
  608. font-size: 22rpx;
  609. color: #fff;
  610. }
  611. .course-info {
  612. flex: 1;
  613. padding-left: 24rpx;
  614. /* padding: 20rpx 24rpx; */
  615. display: flex;
  616. flex-direction: column;
  617. justify-content: space-between;
  618. min-width: 0;
  619. }
  620. .course-meta {
  621. display: flex;
  622. align-items: center;
  623. image{
  624. width: 30rpx;
  625. height: 30rpx;
  626. }
  627. }
  628. .meta-icon {
  629. font-size: 24rpx;
  630. margin-right: 6rpx;
  631. color: #999;
  632. }
  633. .meta-count {
  634. margin-left: 10rpx;
  635. font-family: PingFangSC, PingFang SC;
  636. font-weight: 400;
  637. font-size: 32rpx;
  638. color: #666666;
  639. }
  640. .card-cover {
  641. position: relative;
  642. width: 296rpx;
  643. height: 222rpx;
  644. border-radius: 20rpx;
  645. overflow: hidden;
  646. flex-shrink: 0;
  647. }
  648. .cover-img {
  649. width: 100%;
  650. height: 100%;
  651. background: #BB6D6D;
  652. }
  653. .card-title {
  654. font-family: PingFangSC, PingFang SC;
  655. font-weight: 600;
  656. font-size: 36rpx;
  657. color: #222222;
  658. line-height: 50rpx;
  659. text-align: justify;
  660. overflow: hidden;
  661. text-overflow: ellipsis;
  662. display: -webkit-box;
  663. -webkit-line-clamp: 2;
  664. -webkit-box-orient: vertical;
  665. }
  666. .card-footer {
  667. flex: 1;
  668. padding-left: 24rpx;
  669. /* padding: 20rpx 24rpx; */
  670. display: flex;
  671. flex-direction: column;
  672. justify-content: space-between;
  673. min-width: 0;
  674. }
  675. .card-views {
  676. font-family: PingFangSC, PingFang SC;
  677. font-weight: 400;
  678. font-size: 32rpx;
  679. color: #666666;
  680. line-height: 44rpx;
  681. }
  682. .btn-watch {
  683. width: 168rpx;
  684. height: 64rpx;
  685. line-height: 64rpx;
  686. text-align: center;
  687. background: linear-gradient( 135deg, #FF5267 0%, #FF233C 100%);
  688. border-radius: 32rpx;
  689. font-family: PingFangSC, PingFang SC;
  690. font-weight: 600;
  691. font-size: 32rpx;
  692. color: #FFFFFF;
  693. }
  694. /* 最近浏览 - 按日期分组 */
  695. .recent-group {
  696. padding: 24rpx 24rpx 0;
  697. }
  698. .group-date {
  699. display: flex;
  700. align-items: center;
  701. margin-bottom: 24rpx;
  702. }
  703. .date-icon {
  704. width: 32rpx;
  705. height: 32rpx;
  706. margin-right: 8rpx;
  707. }
  708. .date-text {
  709. font-family: PingFangSC, PingFang SC;
  710. font-weight: 600;
  711. font-size: 40rpx;
  712. line-height: 56rpx;
  713. color: #222222;
  714. }
  715. .recent-card {
  716. display: flex;
  717. background: #fff;
  718. border-radius: 20rpx;
  719. overflow: hidden;
  720. padding: 20rpx;
  721. margin-bottom: 24rpx;
  722. }
  723. .recent-card:last-child{
  724. margin-bottom: 0;
  725. }
  726. .recent-thumb {
  727. position: relative;
  728. width: 296rpx;
  729. height: 222rpx;
  730. border-radius: 20rpx;
  731. overflow: hidden;
  732. flex-shrink: 0;
  733. }
  734. .thumb-img {
  735. width: 100%;
  736. height: 100%;
  737. background: #BB6D6D;
  738. }
  739. .recent-info {
  740. flex: 1;
  741. padding-left: 24rpx;
  742. /* padding: 20rpx 24rpx; */
  743. display: flex;
  744. flex-direction: column;
  745. justify-content: space-between;
  746. min-width: 0;
  747. }
  748. .recent-title {
  749. font-family: PingFangSC, PingFang SC;
  750. font-weight: 600;
  751. font-size: 36rpx;
  752. color: #222222;
  753. line-height: 50rpx;
  754. text-align: justify;
  755. overflow: hidden;
  756. text-overflow: ellipsis;
  757. display: -webkit-box;
  758. -webkit-line-clamp: 2;
  759. -webkit-box-orient: vertical;
  760. }
  761. .recent-progress {
  762. font-family: PingFangSC, PingFang SC;
  763. font-weight: 400;
  764. font-size: 32rpx;
  765. color: rgba(0,0,0,0.65);
  766. line-height: 44rpx;
  767. }
  768. /* 空态 */
  769. .empty-state {
  770. display: flex;
  771. flex-direction: column;
  772. align-items: center;
  773. justify-content: center;
  774. padding: 80rpx 0 48rpx;
  775. /* background: linear-gradient(180deg, #fff5f5 0%, #fff 100%); */
  776. }
  777. .empty-icon {
  778. width: 310rpx;
  779. height: 260rpx;
  780. margin-bottom: 30rpx;
  781. }
  782. .empty-text {
  783. font-family: PingFangSC, PingFang SC;
  784. font-weight: 400;
  785. font-size: 36rpx;
  786. color: rgba(0,0,0,0.25);
  787. line-height: 50rpx;
  788. }
  789. /* 为您精选 */
  790. .recommend-section {
  791. padding: 0 24rpx 32rpx;
  792. }
  793. .recommend-title {
  794. display: block;
  795. font-family: PingFangSC, PingFang SC;
  796. font-weight: 600;
  797. font-size: 40rpx;
  798. color: #222222;
  799. line-height: 56rpx;
  800. padding-bottom: 24rpx;
  801. }
  802. .bottom-placeholder {
  803. height: 120rpx;
  804. }
  805. .load-tip {
  806. padding: 24rpx 0 8rpx;
  807. text-align: center;
  808. font-size: 28rpx;
  809. color: #999;
  810. }
  811. @mixin sk-shimmer {
  812. background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  813. background-size: 200% 100%;
  814. animation: skeleton-shimmer 1.2s ease-in-out infinite;
  815. }
  816. .sk-line {
  817. height: 28rpx;
  818. border-radius: 6rpx;
  819. @include sk-shimmer;
  820. }
  821. .sk-line-lg { width: 90%; }
  822. .sk-line-md { width: 70%; margin-top: 16rpx; }
  823. .sk-line-sm { width: 40%; }
  824. @keyframes skeleton-shimmer {
  825. 0% { background-position: 100% 0; }
  826. 100% { background-position: -100% 0; }
  827. }
  828. /* 精品课程骨架 */
  829. .course-skeleton {
  830. padding: 24rpx;
  831. display: flex;
  832. flex-direction: column;
  833. gap: 24rpx;
  834. }
  835. .sk-course-card,
  836. .sk-recent-card {
  837. display: flex;
  838. background: #fff;
  839. border-radius: 20rpx;
  840. padding: 20rpx;
  841. }
  842. .sk-thumb {
  843. width: 296rpx;
  844. height: 222rpx;
  845. border-radius: 20rpx;
  846. flex-shrink: 0;
  847. @include sk-shimmer;
  848. }
  849. .sk-info {
  850. flex: 1;
  851. padding-left: 24rpx;
  852. min-width: 0;
  853. }
  854. .sk-foot {
  855. display: flex;
  856. align-items: center;
  857. justify-content: space-between;
  858. margin-top: 40rpx;
  859. }
  860. .sk-btn {
  861. width: 168rpx;
  862. height: 64rpx;
  863. border-radius: 32rpx;
  864. @include sk-shimmer;
  865. }
  866. .course-grid-wrap {
  867. position: relative;
  868. }
  869. .course-grid.list-dimmed {
  870. opacity: 0.55;
  871. transition: opacity 0.2s ease;
  872. }
  873. .refresh-mask {
  874. position: absolute;
  875. left: 0;
  876. right: 0;
  877. top: 0;
  878. bottom: 0;
  879. display: flex;
  880. align-items: center;
  881. justify-content: center;
  882. pointer-events: none;
  883. }
  884. .refresh-spinner {
  885. width: 48rpx;
  886. height: 48rpx;
  887. border: 4rpx solid #e8e8e8;
  888. border-top-color: #FF233C;
  889. border-radius: 50%;
  890. animation: spin 0.8s linear infinite;
  891. }
  892. @keyframes spin {
  893. to { transform: rotate(360deg); }
  894. }
  895. /* 最近浏览骨架 */
  896. .recent-skeleton {
  897. padding: 24rpx 24rpx 0;
  898. }
  899. .sk-recent-group {
  900. margin-bottom: 24rpx;
  901. }
  902. .sk-date {
  903. width: 240rpx;
  904. height: 40rpx;
  905. margin-bottom: 24rpx;
  906. border-radius: 8rpx;
  907. @include sk-shimmer;
  908. }
  909. .sk-recent-card {
  910. margin-bottom: 24rpx;
  911. }
  912. .sk-recent-card:last-child {
  913. margin-bottom: 0;
  914. }
  915. .sk-recent-card .sk-btn {
  916. margin-top: 40rpx;
  917. }
  918. </style>