course.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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,index)" 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 height="22" :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,index)">进入学习</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. itemIndex:''
  37. };
  38. },
  39. onLoad(option) {
  40. this.goodsId = Number(option.id);
  41. this.gradeId = Number(option.gid)
  42. // uni.setStorageSync('courseGoodsId', this.goodsId);
  43. this.courseCourseList();
  44. this.$store.getters.dictObj
  45. },
  46. onShow(){
  47. if(this.itemIndex !== '') {
  48. this.refreshByIndex();
  49. }
  50. },
  51. onReachBottom() {
  52. if (this.courseList.length < this.param.total) {
  53. this.param.pageNum++;
  54. this.courseCourseList();
  55. }
  56. },
  57. methods: {
  58. /**
  59. * 返回刷新之前进入的课程数据
  60. */
  61. refreshByIndex() {
  62. this.$api.courseCourseList({
  63. pageNum: this.itemIndex+1,
  64. pageSize: 1,
  65. }).then(res => {
  66. if (res.data.code == 200) {
  67. this.$set(this.courseList,this.itemIndex,res.data.rows[0])
  68. }
  69. });
  70. },
  71. jump(item,index) {
  72. this.itemIndex = index;
  73. if(item.rebuild === 0) { //未重修
  74. this.$navTo.togo('/pages2/learn/details', {
  75. id: item.courseId,
  76. gradeId:item.gradeId,
  77. goodsId: this.goodsId
  78. });
  79. return;
  80. }
  81. this.$navTo.togo('/pages3/polyv/detail', {
  82. id: item.courseId,
  83. goodsId: this.goodsId,
  84. });
  85. },
  86. studyIn(item,index) {
  87. this.itemIndex = index;
  88. if(item.rebuild === 0) { //未重修
  89. this.$navTo.togo('/pages2/learn/details', {
  90. id: item.courseId,
  91. gradeId:item.gradeId,
  92. goodsId: this.goodsId
  93. });
  94. return;
  95. }
  96. this.$navTo.togo('/pages3/polyv/detail', {
  97. id: item.courseId,
  98. goodsId: this.goodsId
  99. });
  100. // this.$navTo.togo('/pages2/verify/input');
  101. },
  102. courseCourseList() {
  103. let self = this;
  104. this.param.goodsId =this.goodsId
  105. this.param.gradeId = this.gradeId
  106. this.$api.courseCourseList(this.param).then(res => {
  107. if (res.data.code == 200) {
  108. self.courseList.push.apply(self.courseList, res.data.rows);
  109. self.param.total = res.data.total;
  110. }
  111. });
  112. },
  113. appointment() {
  114. this.$navTo.togo('/pages2/appointment/index');
  115. }
  116. }
  117. };
  118. </script>
  119. <style>
  120. page {
  121. background: #eaeef1;
  122. }
  123. </style>
  124. <style scope>
  125. .box_progress {
  126. display: flex;
  127. justify-content: space-between;
  128. align-items: center;
  129. margin-top: 20rpx;
  130. }
  131. .bottomBox {
  132. background: #ffffff;
  133. width: 94%;
  134. border-bottom-left-radius: 24rpx;
  135. border-bottom-right-radius: 24rpx;
  136. margin: 0 auto;
  137. padding: 20rpx;
  138. }
  139. .content_box {
  140. display: flex;
  141. align-items: center;
  142. color: #999999;
  143. margin-top: 8rpx;
  144. }
  145. .content {
  146. color: #000000;
  147. margin: 0 8rpx;
  148. }
  149. .wk_icon {
  150. width: 24rpx;
  151. height: 24rpx;
  152. margin-right: 8rpx;
  153. }
  154. .class_item {
  155. width: 100%;
  156. background: #ffffff;
  157. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  158. border-radius: 24rpx;
  159. padding: 20rpx;
  160. z-index: 999;
  161. position: relative;
  162. }
  163. </style>