index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <view class="page-container">
  3. <!-- <view class="status_bar" :style="{ height: statusBarHeight }"></view> -->
  4. <!-- 学习统计卡片 -->
  5. <view class="stats-card">
  6. <view class="stats-item">
  7. <view class="num-box">
  8. <text class="num">30</text>
  9. <text class="unit">分钟</text>
  10. </view>
  11. <view class="label">今日学习</view>
  12. </view>
  13. <view class="divider"></view>
  14. <view class="stats-item">
  15. <view class="num-box">
  16. <text class="num">250</text>
  17. <text class="unit">金币</text>
  18. </view>
  19. <view class="label">累计奖励</view>
  20. </view>
  21. </view>
  22. <!-- 课程列表 -->
  23. <view class="course-list">
  24. <view class="course-item" v-for="(item, index) in studyList" :key="index" @click="goCourse(item)">
  25. <view class="course-left">
  26. <image class="cover" :src="item.image" mode="aspectFill"></image>
  27. <view class="play-tag">{{ item.playCount }}次播放</view>
  28. </view>
  29. <view class="course-right">
  30. <view class="title">{{ item.title }}</view>
  31. <view class="subtitle">共{{ item.total }}节 | 已学{{ item.learned }}节</view>
  32. <view class="progress-box">
  33. <view class="progress-bar">
  34. <view class="progress-inner" :style="{ width: item.percent + '%' }"></view>
  35. <text class="percent-text">{{ item.percent }}%</text>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. data() {
  46. return {
  47. statusBarHeight: uni.getStorageSync('menuInfo') ? uni.getStorageSync('menuInfo').statusBarHeight : 20,
  48. studyList: [
  49. {
  50. id: 1,
  51. image: "/static/famous_doctor_img.png",
  52. title: "中医降脂养肝课",
  53. playCount: "8.1万",
  54. total: 20,
  55. learned: 10,
  56. percent: 50
  57. },
  58. {
  59. id: 2,
  60. image: "/static/famous_doctor_img2.png",
  61. title: "五脏养生操",
  62. playCount: "8.1万",
  63. total: 35,
  64. learned: 10,
  65. percent: 40
  66. }
  67. ]
  68. };
  69. },
  70. methods: {
  71. goCourse(item) {
  72. uni.navigateTo({
  73. url: `/pages_course/learn?courseId=${item.id}&type=1`
  74. });
  75. }
  76. }
  77. };
  78. </script>
  79. <style lang="scss" scoped>
  80. .page-container {
  81. width: 100%;
  82. min-height: 100vh;
  83. background-color: #F8F9FB;
  84. padding: 0 30rpx 140rpx;
  85. }
  86. .status_bar {
  87. width: 100%;
  88. }
  89. .stats-card {
  90. margin-top: 30rpx;
  91. background: #FFFFFF;
  92. border-radius: 24rpx;
  93. height: 180rpx;
  94. display: flex;
  95. align-items: center;
  96. justify-content: space-around;
  97. padding: 0 40rpx;
  98. .stats-item {
  99. flex: 1;
  100. display: flex;
  101. flex-direction: column;
  102. align-items: center;
  103. .num-box {
  104. display: flex;
  105. align-items: baseline;
  106. margin-bottom: 12rpx;
  107. .num {
  108. font-size: 48rpx;
  109. font-weight: bold;
  110. color: #1A1A1A;
  111. }
  112. .unit {
  113. font-size: 24rpx;
  114. color: #999;
  115. margin-left: 8rpx;
  116. }
  117. }
  118. .label {
  119. font-size: 26rpx;
  120. color: #666;
  121. }
  122. }
  123. .divider {
  124. width: 1rpx;
  125. height: 80rpx;
  126. background-color: #F0F0F0;
  127. }
  128. }
  129. .course-list {
  130. margin-top: 30rpx;
  131. .course-item {
  132. background: #FFFFFF;
  133. border-radius: 24rpx;
  134. padding: 24rpx;
  135. display: flex;
  136. margin-bottom: 30rpx;
  137. .course-left {
  138. position: relative;
  139. width: 240rpx;
  140. height: 160rpx;
  141. border-radius: 16rpx;
  142. overflow: hidden;
  143. margin-right: 24rpx;
  144. .cover {
  145. width: 100%;
  146. height: 100%;
  147. }
  148. .play-tag {
  149. position: absolute;
  150. bottom: 0;
  151. left: 0;
  152. width: 100%;
  153. height: 48rpx;
  154. background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
  155. font-size: 20rpx;
  156. color: #FFFFFF;
  157. padding: 12rpx;
  158. display: flex;
  159. align-items: center;
  160. }
  161. }
  162. .course-right {
  163. flex: 1;
  164. display: flex;
  165. flex-direction: column;
  166. justify-content: space-between;
  167. .title {
  168. font-size: 32rpx;
  169. font-weight: bold;
  170. color: #1A1A1A;
  171. margin-bottom: 8rpx;
  172. }
  173. .subtitle {
  174. font-size: 24rpx;
  175. color: #999;
  176. margin-bottom: 20rpx;
  177. }
  178. .progress-box {
  179. display: flex;
  180. align-items: center;
  181. .progress-bar {
  182. flex: 1;
  183. height: 12rpx;
  184. background: #F5F6F8;
  185. border-radius: 6rpx;
  186. margin-right: 20rpx;
  187. display: flex;
  188. align-items: center;
  189. overflow: hidden;
  190. .progress-inner {
  191. height: 100%;
  192. background: #FEB413;
  193. border-radius: 6rpx;
  194. }
  195. }
  196. .percent-text {
  197. font-size:14rpx;
  198. color: #FFFFFF;
  199. flex: 1;
  200. text-align: center;
  201. }
  202. }
  203. }
  204. }
  205. }
  206. </style>