index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="page-container">
  3. <view class="status_bar" :style="{ height: statusBarHeight }"></view>
  4. <!-- 顶部标题栏 -->
  5. <view class="nav-header">
  6. <view class="back-btn" @click="goBack">
  7. <image class="back-icon" src="/static/right_arrow.png" mode="aspectFit"></image>
  8. </view>
  9. <text class="page-title">精选课程</text>
  10. <view class="placeholder"></view>
  11. </view>
  12. <!-- 课程列表 -->
  13. <view class="course-grid">
  14. <view class="course-item" v-for="(item, index) in courseList" :key="index" @click="goDetail(item)">
  15. <view class="course-cover-box">
  16. <image class="course-cover" :src="item.image" mode="aspectFill"></image>
  17. </view>
  18. <view class="course-info">
  19. <view class="course-name">{{ item.title }}</view>
  20. <view class="course-footer">
  21. <text class="play-count">{{ item.playCount }}次播放</text>
  22. <image class="share-icon" src="/static/layer_share_icon16@3x.png" mode="aspectFit"></image>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. statusBarHeight: uni.getStorageSync('menuInfo') ? uni.getStorageSync('menuInfo').statusBarHeight : 20,
  34. courseList: [
  35. {
  36. id: 1,
  37. image: "/static/famous_doctor_img.png",
  38. title: "健身操",
  39. playCount: "16.5万"
  40. },
  41. {
  42. id: 2,
  43. image: "/static/famous_doctor_img2.png",
  44. title: "比赛",
  45. playCount: "16.5万"
  46. },
  47. {
  48. id: 3,
  49. image: "/static/course_img.png",
  50. title: "八段锦",
  51. playCount: "16.5万"
  52. },
  53. {
  54. id: 4,
  55. image: "/static/famous_doctor_img.png",
  56. title: "广场舞",
  57. playCount: "16.5万"
  58. },
  59. {
  60. id: 5,
  61. image: "/static/course_img.png",
  62. title: "八段锦",
  63. playCount: "16.5万"
  64. },
  65. {
  66. id: 6,
  67. image: "/static/famous_doctor_img2.png",
  68. title: "广场舞",
  69. playCount: "16.5万"
  70. }
  71. ]
  72. };
  73. },
  74. methods: {
  75. goBack() {
  76. uni.navigateBack();
  77. },
  78. goDetail(item) {
  79. uni.navigateTo({
  80. url: `/pages_course/learn?courseId=${item.id}&type=1`
  81. });
  82. }
  83. }
  84. };
  85. </script>
  86. <style lang="scss" scoped>
  87. .page-container {
  88. width: 100%;
  89. min-height: 100vh;
  90. background-color: #F8F9FB;
  91. padding-bottom: 120upx;
  92. .status_bar {
  93. width: 100%;
  94. background-color: #ffffff;
  95. }
  96. .nav-header {
  97. height: 88rpx;
  98. background-color: #ffffff;
  99. display: flex;
  100. align-items: center;
  101. justify-content: space-between;
  102. padding: 0 30rpx;
  103. position: sticky;
  104. top: 0;
  105. z-index: 100;
  106. .back-btn {
  107. width: 60rpx;
  108. height: 60rpx;
  109. display: flex;
  110. align-items: center;
  111. justify-content: flex-start;
  112. .back-icon {
  113. width: 36rpx;
  114. height: 36rpx;
  115. transform: rotate(180deg);
  116. }
  117. }
  118. .page-title {
  119. font-size: 36rpx;
  120. font-weight: bold;
  121. color: #1A1A1A;
  122. }
  123. .placeholder {
  124. width: 60rpx;
  125. }
  126. }
  127. .course-grid {
  128. padding: 30rpx;
  129. display: flex;
  130. flex-wrap: wrap;
  131. justify-content: space-between;
  132. .course-item {
  133. width: 334rpx;
  134. background-color: #ffffff;
  135. border-radius: 20rpx;
  136. margin-bottom: 30rpx;
  137. overflow: hidden;
  138. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.02);
  139. .course-cover-box {
  140. width: 100%;
  141. height: 250rpx;
  142. .course-cover {
  143. width: 100%;
  144. height: 100%;
  145. background-color: #f5f5f5;
  146. }
  147. }
  148. .course-info {
  149. padding: 20rpx;
  150. .course-name {
  151. font-size: 30rpx;
  152. font-weight: bold;
  153. color: #1A1A1A;
  154. margin-bottom: 20rpx;
  155. overflow: hidden;
  156. text-overflow: ellipsis;
  157. white-space: nowrap;
  158. }
  159. .course-footer {
  160. display: flex;
  161. align-items: center;
  162. justify-content: space-between;
  163. .play-count {
  164. font-size: 24rpx;
  165. color: #999999;
  166. }
  167. .share-icon {
  168. width: 32rpx;
  169. height: 32rpx;
  170. }
  171. }
  172. }
  173. }
  174. }
  175. }
  176. </style>