course.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view style="padding: 30rpx;">
  3. <view v-if="!courseList.length">
  4. <u-empty text="暂无课程" mode="list"></u-empty>
  5. </view>
  6. <view v-else @click="jump(item)" v-for="(item, index) in courseList" :key="index" style="margin-bottom: 30rpx;">
  7. <view class="class_item">
  8. <image :src="$method.splitImgHost(item.coverUrl, true)" style="height: 316rpx;width: 100%;border-radius: 24rpx;"></image>
  9. <view style="color: #333333;font-weight: bold;font-size: 32rpx;">{{ item.courseName }}</view>
  10. </view>
  11. <view class="bottomBox">
  12. <view class=".content_box">
  13. <image src="/static/icon/wk_icon3.png" class="wk_icon"></image>
  14. 学习进度:{{ item.stuAllNum }}/{{ item.secAllNum }}
  15. </view>
  16. <view class="box_progress">
  17. <view style="width: 60%;"><u-line-progress active-color="#ff9900" :percent="(item.stuAllNum / item.secAllNum) * 100"></u-line-progress></view>
  18. <view><u-button type="warning" size="mini" @click.stop="studyIn(item)">进入学习</u-button></view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. goodsId: 0,
  29. courseList: [],
  30. param:{
  31. pageNum: 1,
  32. pageSize: 10,
  33. total: 0
  34. },
  35. };
  36. },
  37. onLoad(option) {
  38. this.goodsId = Number(option.id);
  39. // uni.setStorageSync('courseGoodsId', this.goodsId);
  40. this.courseCourseList();
  41. this.$store.getters.dictObj
  42. },
  43. onReachBottom() {
  44. if (this.courseList.length < this.param.total) {
  45. this.param.pageNum++;
  46. this.courseCourseList();
  47. }
  48. },
  49. methods: {
  50. jump(item) {
  51. this.$navTo.togo('/pages2/class/detail', {
  52. id: item.courseId,
  53. goodsId: this.goodsId
  54. });
  55. },
  56. studyIn(item) {
  57. this.$navTo.togo('/pages2/class/detail', {
  58. id: item.courseId,
  59. goodsId: this.goodsId
  60. });
  61. // this.$navTo.togo('/pages2/verify/input');
  62. },
  63. courseCourseList() {
  64. let self = this;
  65. this.param.goodsId =this.goodsId
  66. this.$api.courseCourseList(this.param).then(res => {
  67. if (res.data.code == 200) {
  68. self.courseList.push.apply(self.courseList, res.data.rows);
  69. self.param.total = res.data.total;
  70. }
  71. });
  72. },
  73. appointment() {
  74. this.$navTo.togo('/pages2/appointment/index');
  75. }
  76. }
  77. };
  78. </script>
  79. <style>
  80. page {
  81. background: #eaeef1;
  82. }
  83. </style>
  84. <style scope>
  85. .box_progress {
  86. display: flex;
  87. justify-content: space-between;
  88. align-items: center;
  89. margin-top: 20rpx;
  90. }
  91. .bottomBox {
  92. background: #ffffff;
  93. width: 94%;
  94. border-bottom-left-radius: 24rpx;
  95. border-bottom-right-radius: 24rpx;
  96. margin: 0 auto;
  97. padding: 20rpx;
  98. }
  99. .content_box {
  100. display: flex;
  101. align-items: center;
  102. color: #999999;
  103. margin-top: 8rpx;
  104. }
  105. .content {
  106. color: #000000;
  107. margin: 0 8rpx;
  108. }
  109. .wk_icon {
  110. width: 24rpx;
  111. height: 24rpx;
  112. margin-right: 8rpx;
  113. }
  114. .class_item {
  115. width: 100%;
  116. background: #ffffff;
  117. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  118. border-radius: 24rpx;
  119. padding: 20rpx;
  120. z-index: 999;
  121. position: relative;
  122. }
  123. </style>