course.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. if (this.$method.isGoLogin()) { // 从公众号消息进来的没登录需要跳到登录页,登录后返回
  75. return;
  76. }
  77. this.courseCourseList();
  78. this.$store.getters.dictObj;
  79. },
  80. onShow() {
  81. if (this.itemIndex !== "") {
  82. this.refreshByIndex();
  83. }
  84. },
  85. onReachBottom() {
  86. if (this.courseList.length < this.param.total) {
  87. this.param.pageNum++;
  88. this.courseCourseList();
  89. }
  90. },
  91. methods: {
  92. /**
  93. * 返回刷新之前进入的课程数据
  94. */
  95. refreshByIndex() {
  96. this.$api
  97. .courseCourseList({
  98. pageNum: this.itemIndex + 1,
  99. pageSize: 1,
  100. goodsId: this.goodsId,
  101. gradeId: 0,
  102. })
  103. .then((res) => {
  104. if (res.data.code == 200) {
  105. this.$set(this.courseList, this.itemIndex, res.data.rows[0]);
  106. }
  107. });
  108. },
  109. /**
  110. * 获取业务层次详情
  111. */
  112. courseBusiness(businessId) {
  113. this.$api.courseBusiness(businessId).then((res) => {
  114. this.businessData = res.data.data;
  115. });
  116. },
  117. jump(item, index) {
  118. this.itemIndex = index;
  119. this.$navTo.togo("/pages3/live/detail", {
  120. courseId: item.courseId,
  121. goodsId: this.goodsId,
  122. gradeId:0,
  123. orderGoodsId: this.orderGoodsId,
  124. });
  125. },
  126. courseCourseList() {
  127. let self = this;
  128. this.param.goodsId = this.goodsId;
  129. this.param.gradeId = this.gradeId;
  130. this.$api.courseCourseList(this.param).then((res) => {
  131. if (res.data.code == 200) {
  132. self.courseList.push.apply(self.courseList, res.data.rows);
  133. self.param.total = res.data.total;
  134. // if (res.data.rows.length) {
  135. // this.courseBusiness(res.data.rows[0].businessId);
  136. // }
  137. }
  138. });
  139. },
  140. appointment() {
  141. this.$navTo.togo("/pages2/appointment/index?orderGoodsId="+this.orderGoodsId);
  142. },
  143. },
  144. };
  145. </script>
  146. <style>
  147. page {
  148. background: #eaeef1;
  149. }
  150. </style>
  151. <style scope lang="scss">
  152. .box_progress {
  153. display: flex;
  154. justify-content: space-between;
  155. align-items: center;
  156. margin-top: 20rpx;
  157. }
  158. .bottomBox {
  159. background: #ffffff;
  160. width: 94%;
  161. border-bottom-left-radius: 24rpx;
  162. border-bottom-right-radius: 24rpx;
  163. margin: 0 auto;
  164. padding: 20rpx;
  165. }
  166. .content_box {
  167. display: flex;
  168. align-items: center;
  169. color: #999999;
  170. margin-top: 8rpx;
  171. }
  172. .content {
  173. color: #000000;
  174. margin: 0 8rpx;
  175. }
  176. .wk_icon {
  177. width: 24rpx;
  178. height: 24rpx;
  179. margin-right: 8rpx;
  180. }
  181. .class_item {
  182. width: 100%;
  183. background: #ffffff;
  184. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  185. border-radius: 24rpx;
  186. padding: 20rpx;
  187. z-index: 999;
  188. position: relative;
  189. }
  190. </style>