course.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 :show-percent="false" 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. gradeId:0,
  30. courseList: [],
  31. param:{
  32. pageNum: 1,
  33. pageSize: 10,
  34. total: 0
  35. },
  36. };
  37. },
  38. onLoad(option) {
  39. this.goodsId = Number(option.id);
  40. this.gradeId = Number(option.gid)
  41. // uni.setStorageSync('courseGoodsId', this.goodsId);
  42. this.courseCourseList();
  43. this.$store.getters.dictObj
  44. },
  45. onReachBottom() {
  46. if (this.courseList.length < this.param.total) {
  47. this.param.pageNum++;
  48. this.courseCourseList();
  49. }
  50. },
  51. methods: {
  52. jump(item) {
  53. this.$navTo.togo('/pages2/class/detail', {
  54. id: item.courseId,
  55. goodsId: this.goodsId,
  56. });
  57. },
  58. studyIn(item) {
  59. this.$navTo.togo('/pages2/class/detail', {
  60. id: item.courseId,
  61. goodsId: this.goodsId
  62. });
  63. // this.$navTo.togo('/pages2/verify/input');
  64. },
  65. courseCourseList() {
  66. let self = this;
  67. this.param.goodsId =this.goodsId
  68. this.param.gradeId = this.gradeId
  69. this.$api.courseCourseList(this.param).then(res => {
  70. if (res.data.code == 200) {
  71. self.courseList.push.apply(self.courseList, res.data.rows);
  72. self.param.total = res.data.total;
  73. }
  74. });
  75. },
  76. appointment() {
  77. this.$navTo.togo('/pages2/appointment/index');
  78. }
  79. }
  80. };
  81. </script>
  82. <style>
  83. page {
  84. background: #eaeef1;
  85. }
  86. </style>
  87. <style scope>
  88. .box_progress {
  89. display: flex;
  90. justify-content: space-between;
  91. align-items: center;
  92. margin-top: 20rpx;
  93. }
  94. .bottomBox {
  95. background: #ffffff;
  96. width: 94%;
  97. border-bottom-left-radius: 24rpx;
  98. border-bottom-right-radius: 24rpx;
  99. margin: 0 auto;
  100. padding: 20rpx;
  101. }
  102. .content_box {
  103. display: flex;
  104. align-items: center;
  105. color: #999999;
  106. margin-top: 8rpx;
  107. }
  108. .content {
  109. color: #000000;
  110. margin: 0 8rpx;
  111. }
  112. .wk_icon {
  113. width: 24rpx;
  114. height: 24rpx;
  115. margin-right: 8rpx;
  116. }
  117. .class_item {
  118. width: 100%;
  119. background: #ffffff;
  120. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  121. border-radius: 24rpx;
  122. padding: 20rpx;
  123. z-index: 999;
  124. position: relative;
  125. }
  126. </style>