course.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view style="padding: 30rpx;">
  3. <nav-bar title="所有课程"></nav-bar>
  4. <view v-if="!courseList.length">
  5. <u-empty text="暂无课程" mode="list"></u-empty>
  6. </view>
  7. <view v-else @click="jump(item,index)" v-for="(item, index) in courseList" :key="index" style="margin-bottom: 30rpx;">
  8. <view class="class_item">
  9. <image :src="$method.splitImgHost(item.coverUrl, true)" style="height: 316rpx;width: 100%;border-radius: 24rpx;"></image>
  10. <view style="color: #333333;font-weight: bold;font-size: 32rpx;">{{ item.courseName }}</view>
  11. </view>
  12. <view class="bottomBox">
  13. <view class=".content_box">
  14. <image src="/static/icon/wk_icon3.png" class="wk_icon"></image>
  15. 学习进度:{{ item.stuAllNum+item.recordNum }}/{{ item.secAllNum+item.examNum }}
  16. </view>
  17. <view class="box_progress">
  18. <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>
  19. <view><u-button type="warning" size="mini" @click.stop="studyIn(item,index)">进入学习</u-button></view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. goodsId: 0,
  30. gradeId:0,
  31. courseList: [],
  32. orderGoodsId:0,
  33. param:{
  34. pageNum: 1,
  35. pageSize: 10,
  36. total: 0
  37. },
  38. itemIndex:''
  39. };
  40. },
  41. onLoad(option) {
  42. this.goodsId = Number(option.id);
  43. this.gradeId = Number(option.gid)
  44. this.orderGoodsId = Number(option.orderGoodsId)
  45. // uni.setStorageSync('courseGoodsId', this.goodsId);
  46. this.courseCourseList();
  47. this.$store.getters.dictObj
  48. },
  49. onShow(){
  50. if(this.itemIndex !== '') {
  51. this.refreshByIndex();
  52. }
  53. },
  54. onReachBottom() {
  55. if (this.courseList.length < this.param.total) {
  56. this.param.pageNum++;
  57. this.courseCourseList();
  58. }
  59. },
  60. methods: {
  61. /**
  62. * 返回刷新之前进入的课程数据
  63. */
  64. refreshByIndex() {
  65. this.$api.courseCourseList({
  66. pageNum: this.itemIndex+1,
  67. pageSize: 1,
  68. goodsId:this.goodsId,
  69. gradeId:this.gradeId
  70. }).then(res => {
  71. if (res.data.code == 200) {
  72. this.$set(this.courseList,this.itemIndex,res.data.rows[0])
  73. }
  74. });
  75. },
  76. jump(item,index) {
  77. this.itemIndex = index;
  78. if(item.rebuild === 0) { //未重修
  79. this.$navTo.togo('/pages2/learn/details', {
  80. id: item.courseId,
  81. gradeId:item.gradeId,
  82. goodsId: this.goodsId
  83. });
  84. return;
  85. }
  86. this.$navTo.togo('/pages3/polyv/detail', {
  87. id: item.courseId,
  88. goodsId: this.goodsId,
  89. orderGoodsId:this.orderGoodsId
  90. });
  91. },
  92. studyIn(item,index) {
  93. this.itemIndex = index;
  94. if(item.rebuild === 0) { //未重修
  95. this.$navTo.togo('/pages2/learn/details', {
  96. id: item.courseId,
  97. gradeId:item.gradeId,
  98. goodsId: this.goodsId
  99. });
  100. return;
  101. }
  102. this.$navTo.togo('/pages3/polyv/detail', {
  103. id: item.courseId,
  104. goodsId: this.goodsId,
  105. orderGoodsId:this.orderGoodsId
  106. });
  107. // this.$navTo.togo('/pages2/verify/input');
  108. },
  109. courseCourseList() {
  110. let self = this;
  111. this.param.goodsId =this.goodsId
  112. this.param.gradeId = this.gradeId
  113. this.$api.courseCourseList(this.param).then(res => {
  114. if (res.data.code == 200) {
  115. self.courseList.push.apply(self.courseList, res.data.rows);
  116. self.param.total = res.data.total;
  117. }
  118. });
  119. },
  120. appointment() {
  121. this.$navTo.togo('/pages2/appointment/index');
  122. }
  123. }
  124. };
  125. </script>
  126. <style>
  127. page {
  128. background: #eaeef1;
  129. }
  130. </style>
  131. <style scope>
  132. .box_progress {
  133. display: flex;
  134. justify-content: space-between;
  135. align-items: center;
  136. margin-top: 20rpx;
  137. }
  138. .bottomBox {
  139. background: #ffffff;
  140. width: 94%;
  141. border-bottom-left-radius: 24rpx;
  142. border-bottom-right-radius: 24rpx;
  143. margin: 0 auto;
  144. padding: 20rpx;
  145. }
  146. .content_box {
  147. display: flex;
  148. align-items: center;
  149. color: #999999;
  150. margin-top: 8rpx;
  151. }
  152. .content {
  153. color: #000000;
  154. margin: 0 8rpx;
  155. }
  156. .wk_icon {
  157. width: 24rpx;
  158. height: 24rpx;
  159. margin-right: 8rpx;
  160. }
  161. .class_item {
  162. width: 100%;
  163. background: #ffffff;
  164. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  165. border-radius: 24rpx;
  166. padding: 20rpx;
  167. z-index: 999;
  168. position: relative;
  169. }
  170. </style>