course.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. goodsId:this.goodsId,
  66. gradeId:this.gradeId
  67. }).then(res => {
  68. if (res.data.code == 200) {
  69. this.$set(this.courseList,this.itemIndex,res.data.rows[0])
  70. }
  71. });
  72. },
  73. jump(item,index) {
  74. this.itemIndex = index;
  75. if(item.rebuild === 0) { //未重修
  76. this.$navTo.togo('/pages2/learn/details', {
  77. id: item.courseId,
  78. gradeId:item.gradeId,
  79. goodsId: this.goodsId
  80. });
  81. return;
  82. }
  83. this.$navTo.togo('/pages3/polyv/detail', {
  84. id: item.courseId,
  85. goodsId: this.goodsId,
  86. });
  87. },
  88. studyIn(item,index) {
  89. this.itemIndex = index;
  90. if(item.rebuild === 0) { //未重修
  91. this.$navTo.togo('/pages2/learn/details', {
  92. id: item.courseId,
  93. gradeId:item.gradeId,
  94. goodsId: this.goodsId
  95. });
  96. return;
  97. }
  98. this.$navTo.togo('/pages3/polyv/detail', {
  99. id: item.courseId,
  100. goodsId: this.goodsId
  101. });
  102. // this.$navTo.togo('/pages2/verify/input');
  103. },
  104. courseCourseList() {
  105. let self = this;
  106. this.param.goodsId =this.goodsId
  107. this.param.gradeId = this.gradeId
  108. this.$api.courseCourseList(this.param).then(res => {
  109. if (res.data.code == 200) {
  110. self.courseList.push.apply(self.courseList, res.data.rows);
  111. self.param.total = res.data.total;
  112. }
  113. });
  114. },
  115. appointment() {
  116. this.$navTo.togo('/pages2/appointment/index');
  117. }
  118. }
  119. };
  120. </script>
  121. <style>
  122. page {
  123. background: #eaeef1;
  124. }
  125. </style>
  126. <style scope>
  127. .box_progress {
  128. display: flex;
  129. justify-content: space-between;
  130. align-items: center;
  131. margin-top: 20rpx;
  132. }
  133. .bottomBox {
  134. background: #ffffff;
  135. width: 94%;
  136. border-bottom-left-radius: 24rpx;
  137. border-bottom-right-radius: 24rpx;
  138. margin: 0 auto;
  139. padding: 20rpx;
  140. }
  141. .content_box {
  142. display: flex;
  143. align-items: center;
  144. color: #999999;
  145. margin-top: 8rpx;
  146. }
  147. .content {
  148. color: #000000;
  149. margin: 0 8rpx;
  150. }
  151. .wk_icon {
  152. width: 24rpx;
  153. height: 24rpx;
  154. margin-right: 8rpx;
  155. }
  156. .class_item {
  157. width: 100%;
  158. background: #ffffff;
  159. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  160. border-radius: 24rpx;
  161. padding: 20rpx;
  162. z-index: 999;
  163. position: relative;
  164. }
  165. </style>