course.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. // if (res.data.rows.length) {
  132. // this.courseBusiness(res.data.rows[0].businessId);
  133. // }
  134. }
  135. });
  136. },
  137. appointment() {
  138. this.$navTo.togo("/pages2/appointment/index?orderGoodsId="+this.orderGoodsId);
  139. },
  140. },
  141. };
  142. </script>
  143. <style>
  144. page {
  145. background: #eaeef1;
  146. }
  147. </style>
  148. <style scope lang="scss">
  149. .box_progress {
  150. display: flex;
  151. justify-content: space-between;
  152. align-items: center;
  153. margin-top: 20rpx;
  154. }
  155. .bottomBox {
  156. background: #ffffff;
  157. width: 94%;
  158. border-bottom-left-radius: 24rpx;
  159. border-bottom-right-radius: 24rpx;
  160. margin: 0 auto;
  161. padding: 20rpx;
  162. }
  163. .content_box {
  164. display: flex;
  165. align-items: center;
  166. color: #999999;
  167. margin-top: 8rpx;
  168. }
  169. .content {
  170. color: #000000;
  171. margin: 0 8rpx;
  172. }
  173. .wk_icon {
  174. width: 24rpx;
  175. height: 24rpx;
  176. margin-right: 8rpx;
  177. }
  178. .class_item {
  179. width: 100%;
  180. background: #ffffff;
  181. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  182. border-radius: 24rpx;
  183. padding: 20rpx;
  184. z-index: 999;
  185. position: relative;
  186. }
  187. </style>