course.vue 4.6 KB

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