course.vue 3.9 KB

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