mineRecord.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view class="container">
  3. <view class="course-list">
  4. <view v-for="(course,index) in courses" :key="course.id">
  5. <view class="course-item">
  6. <view class="course-item-image">
  7. <image class="course-image" :src="course.keChengTuPian" mode="aspectFill"></image>
  8. </view>
  9. <view class="course-item-content">
  10. <view class="course-title">
  11. <text>{{ course.keChengMingCheng }}</text>
  12. </view>
  13. <view class="course-type">{{ course.keChengLeXing }}</view>
  14. <view class="course-teacher">
  15. <u-icon name="account" size="28"></u-icon>
  16. {{ course.shouKeZhe }}
  17. </view>
  18. <view class="course-date">
  19. <u-icon name="clock" size="28"></u-icon>
  20. {{ getDateWeek(course.shouKeShiJian) }}
  21. </view>
  22. <!-- <view class="course-price">¥{{ course.jiaGe }}元</view> -->
  23. <!-- <button :class="['button', getButtonClass(course)]">{{ getButtonText(course) }}</button> -->
  24. </view>
  25. </view>
  26. <u-line />
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script setup>
  32. import { ref } from 'vue'
  33. import { onLoad } from '@dcloudio/uni-app'
  34. // 日期格式:xxxx年xx月xx日(星期x)
  35. function getDateWeek(val) {
  36. const date = new Date(val);
  37. const daysOfWeek = ['日', '一', '二', '三', '四', '五', '六'];
  38. const year = date.getFullYear();
  39. const month = date.getMonth() + 1; // 注意:月份从0开始
  40. const day = date.getDate();
  41. const dayOfWeek = daysOfWeek[date.getUTCDay()];
  42. // const result = `${year}年${month}月${day}日(星期${dayOfWeek})`
  43. return `${year}年${month}月${day}日(星期${dayOfWeek})`
  44. }
  45. const courses = ref([]);
  46. const initCourse = () =>{
  47. // 获取列表
  48. courses.value = [{
  49. id: 1,
  50. keChengMingCheng: "前端开发基础前端开发基础前端开发基础",
  51. keChengLeXing: "精英训练营",
  52. shouKeZhe: "张老师",
  53. shouKeShiJian: "2023-10-01",
  54. keChengTuPian: "https://tse3-mm.cn.bing.net/th/id/OIP-C.YKoZzgmubNBxQ8j-mmoTKAHaEK?rs=1&pid=ImgDetMain",
  55. jiaGe: 99.00,
  56. isGouMai: false,
  57. isShouCang: true,
  58. fuFeiLeiXing: "免费" // 新增字段,标识课程的付费类型
  59. },
  60. {
  61. id: 2,
  62. keChengMingCheng: "Vue.js 从入门到精通",
  63. keChengLeXing: "领袖锻造营",
  64. shouKeZhe: "李老师",
  65. shouKeShiJian: "2023-09-15",
  66. keChengTuPian: "https://pic3.zhimg.com/v2-e52354ffdbd94a8e0a7649eacd34a788_r.jpg?source=1940ef5c",
  67. jiaGe: 199.00,
  68. isGouMai: false,
  69. isShouCang: false,
  70. fuFeiLeiXing: "会员免费"
  71. },
  72. {
  73. id: 3,
  74. keChengMingCheng: "React 开发实战",
  75. keChengLeXing: "领袖锻造营",
  76. shouKeZhe: "王老师",
  77. shouKeShiJian: "2023-11-05",
  78. keChengTuPian: "https://desk-fd.zol-img.com.cn/t_s960x600c5/g4/M03/00/0C/Cg-4zFS8bC-Ie9zBADCvovJAqiEAATJ8wDX__cAMK-6184.jpg",
  79. jiaGe: 149.00,
  80. isGouMai: false,
  81. isShouCang: false,
  82. fuFeiLeiXing: "付费"
  83. },
  84. {
  85. id: 4,
  86. keChengMingCheng: "Node.js 全栈开发",
  87. keChengLeXing: "合规专训营",
  88. shouKeZhe: "赵老师",
  89. shouKeShiJian: "2023-08-20",
  90. keChengTuPian: "https://pic3.zhimg.com/v2-e52354ffdbd94a8e0a7649eacd34a788_r.jpg?source=1940ef5c",
  91. jiaGe: 299.00,
  92. isGouMai: true,
  93. isShouCang: false,
  94. fuFeiLeiXing: "付费"
  95. },
  96. {
  97. id: 5,
  98. keChengMingCheng: "移动端开发技巧",
  99. keChengLeXing: "精英训练营",
  100. shouKeZhe: "钱老师",
  101. shouKeShiJian: "2025-07-18",
  102. keChengTuPian: "https://desk-fd.zol-img.com.cn/t_s960x600c5/g4/M03/00/0C/Cg-4zFS8bC-Ie9zBADCvovJAqiEAATJ8wDX__cAMK-6184.jpg",
  103. jiaGe: 89.00,
  104. isGouMai: true,
  105. isShouCang: false,
  106. fuFeiLeiXing: "付费"
  107. },
  108. {
  109. id: 6,
  110. keChengMingCheng: "11Vue.js 从入门到精通",
  111. keChengLeXing: "领袖锻造营",
  112. shouKeZhe: "李老师11",
  113. shouKeShiJian: "2023-09-15",
  114. keChengTuPian: "https://pic3.zhimg.com/v2-e52354ffdbd94a8e0a7649eacd34a788_r.jpg?source=1940ef5c",
  115. jiaGe: 199.00,
  116. isGouMai: true,
  117. isShouCang: false,
  118. fuFeiLeiXing: "会员免费"
  119. },
  120. {
  121. id: 7,
  122. keChengMingCheng: "113Vue.js 从入门到精通",
  123. keChengLeXing: "领袖锻造营",
  124. shouKeZhe: "李老师11",
  125. shouKeShiJian: "2025-09-15",
  126. keChengTuPian: "https://pic3.zhimg.com/v2-e52354ffdbd94a8e0a7649eacd34a788_r.jpg?source=1940ef5c",
  127. jiaGe: 199.00,
  128. isGouMai: true,
  129. isShouCang: false,
  130. fuFeiLeiXing: "会员免费"
  131. }]
  132. }
  133. onLoad(() => {
  134. initCourse();
  135. console.log('onLoad')
  136. })
  137. </script>
  138. <style lang="scss" scoped>
  139. .container {
  140. // height: 100vh;
  141. width: 100vw;
  142. background-color: #fff;
  143. padding: 0 20rpx env(safe-area-inset-bottom, 0);
  144. }
  145. .course-item {
  146. margin: 20rpx 0;
  147. display: flex;
  148. overflow: hidden;
  149. .course-item-image {
  150. width: 200rpx;
  151. height: 260rpx;
  152. flex: 0 0 auto;
  153. margin-right: 20rpx;
  154. .course-image {
  155. width: 100%;
  156. }
  157. }
  158. .course-item-content {
  159. flex: 1;
  160. position: relative;
  161. view {
  162. margin-bottom: 15rpx;
  163. }
  164. .course-title {
  165. font-weight: bold;
  166. margin-right: 10px;
  167. font-size: 28rpx;
  168. color: #000;
  169. }
  170. .course-type,
  171. .course-teacher,
  172. .course-date,
  173. .course-price {
  174. font-size: 30rpx;
  175. color: #000;
  176. }
  177. .course-price {
  178. color: #fe0000;
  179. letter-spacing: 2rpx;
  180. }
  181. .button::after {
  182. content: none;
  183. /* 移除内容 */
  184. }
  185. .button {
  186. position: absolute;
  187. right: 0;
  188. bottom: 0;
  189. min-width: 80px;
  190. padding: 0 40rpx;
  191. white-space: nowrap;
  192. height: 45rpx;
  193. line-height: 45rpx;
  194. font-size: 22rpx;
  195. /* padding: 0; */
  196. border-radius: 50rpx;
  197. color: white;
  198. border: none;
  199. }
  200. .free {
  201. background-color: #006af4;
  202. }
  203. .purchase {
  204. background-color: #fe0000;
  205. }
  206. .member-free {
  207. background-color: transparent;
  208. background-image: url('http://www.gzrea.org.cn:8543/icon/wxmp/bg-label.png');
  209. background-size: cover;
  210. background-repeat: no-repeat;
  211. color: #000;
  212. height: initial;
  213. padding: 6rpx 0 3rpx;
  214. border-radius: 0;
  215. }
  216. .replay {
  217. background-color: #006af4;
  218. }
  219. .purchased {
  220. background-color: #006af4;
  221. }
  222. }
  223. }
  224. </style>