course.vue 5.2 KB

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