class.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view style="padding: 30rpx;">
  3. <navigator hover-class="none" :url="`/pages2/wd/course?id=${item.goodsId}&gid=${item.gradeId}`" v-for="(item, index) in goodsList" :key="index" style="margin-bottom: 30rpx;">
  4. <view class="class_item">
  5. <image :src="$method.splitImgHost(item.coverUrl, true)" style="height: 316rpx;width: 100%;border-radius: 24rpx;"></image>
  6. <view style="color: #333333;font-weight: bold;font-size: 32rpx;">{{ item.goodsName }}</view>
  7. <view class=".content_box">
  8. <image src="/static/icon/wk_icon1.png" class="wk_icon"></image>
  9. <text class="content">{{ item.courseNum }}</text>
  10. <text class="content">{{ item.secAllNum }}</text>
  11. <text class="content">{{ item.classHours }}</text>
  12. 学时
  13. </view>
  14. <view class=".content_box">
  15. <image src="/static/icon/wk_icon2.png" class="wk_icon"></image>
  16. 学习有效期:
  17. <text class="content">{{ $method.timestampToTime(item.validityStartTime) }} - {{ $method.timestampToTime(item.validityEndTime) }}</text>
  18. </view>
  19. </view>
  20. <view class="bottomBox">
  21. <view class=".content_box">
  22. <image src="/static/icon/wk_icon3.png" class="wk_icon"></image>
  23. 学习进度:{{ item.stuAllNum }}/{{ item.secAllNum }}
  24. </view>
  25. <view class="box_progress">
  26. <view style="width: 60%;"><u-line-progress :showText="false" height="22" active-color="#ff9900" :show-percent="false" :percent="(item.stuAllNum / item.secAllNum) * 100"></u-line-progress></view>
  27. <view><u-button type="warning" size="mini" @click.stop="studyIn(item.goodsId,item.gradeId)">进入学习</u-button></view>
  28. </view>
  29. <view class="box_progress" v-if="item.applyStatus === 1">
  30. <view style="width: 60%;">
  31. <text style="color: #333333;white-space: nowrap;text-overflow: ellipsis;">{{ item.applyName }}</text>
  32. </view>
  33. <view><u-button :plain="true" type="primary" size="mini" @click.stop="appointment(item)">预约考试</u-button></view>
  34. </view>
  35. <view class="box_progress" v-if="item.beforeStatus === 1">
  36. <view style="width: 60%;">
  37. <text style="color: #2979ff;white-space: nowrap;text-overflow: ellipsis;">{{ item.beforeName }}</text>
  38. </view>
  39. <view><u-button type="primary" size="mini" @click="appBeforeAddress(item.goodsId)">进入刷题</u-button></view>
  40. </view>
  41. </view>
  42. </navigator>
  43. <view v-if="goodsList.length==0">
  44. <u-empty text="暂无网课" margin-top="500" mode="list"></u-empty></view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. list: [1, 2, 3],
  53. goodsList: [],
  54. param:{
  55. pageNum: 1,
  56. pageSize: 10
  57. },
  58. total: 0
  59. };
  60. },
  61. onLoad(option) {
  62. this.courseGoodsList();
  63. },
  64. onShow() {},
  65. onReachBottom() {
  66. if (this.goodsList.length < this.total) {
  67. this.param.pageNum++;
  68. this.courseGoodsList();
  69. }
  70. },
  71. methods: {
  72. appBeforeAddress(goodsId) {
  73. this.$api.appBeforeAddress({
  74. goodsId
  75. }).then(res => {
  76. if(res.data.code == 200) {
  77. uni.navigateToMiniProgram({
  78. appId: res.data.data.url,
  79. success(res) {
  80. // 打开成功
  81. }
  82. })
  83. } else {
  84. uni.showToast({
  85. title: res.data.msg,
  86. icon: 'none',
  87. })
  88. }
  89. })
  90. },
  91. courseGoodsList() {
  92. let self = this;
  93. this.$api.courseGoodsList(this.param).then(res => {
  94. if (res.data.code == 200) {
  95. self.goodsList.push.apply(self.goodsList, res.data.rows);
  96. self.total = res.data.total;
  97. }
  98. });
  99. },
  100. studyIn(v,i) {
  101. this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}`);
  102. },
  103. appointment(item) {
  104. var data = {
  105. goodsId: item.goodsId,
  106. gradeId: item.gradeId
  107. };
  108. this.$api.getApplysubscribe(data).then(res => {
  109. if (res.data.code === 500) {
  110. uni.showModal({
  111. showCancel: false,
  112. content: res.data.msg
  113. });
  114. }
  115. if (res.data.code === 200) {
  116. this.$navTo.togo('/pages2/appointment/index', {
  117. goodsId: item.goodsId,
  118. gradeId: item.gradeId
  119. });
  120. }
  121. });
  122. }
  123. }
  124. };
  125. </script>
  126. <style>
  127. page {
  128. background: #eaeef1;
  129. }
  130. </style>
  131. <style scope>
  132. .box_progress {
  133. display: flex;
  134. justify-content: space-between;
  135. align-items: center;
  136. margin-top: 20rpx;
  137. }
  138. .bottomBox {
  139. background: #ffffff;
  140. width: 94%;
  141. border-bottom-left-radius: 24rpx;
  142. border-bottom-right-radius: 24rpx;
  143. margin: 0 auto;
  144. padding: 20rpx;
  145. }
  146. .content_box {
  147. display: flex;
  148. align-items: center;
  149. color: #999999;
  150. margin-top: 8rpx;
  151. }
  152. .content {
  153. color: #000000;
  154. margin: 0 8rpx;
  155. }
  156. .wk_icon {
  157. width: 24rpx;
  158. height: 24rpx;
  159. margin-right: 8rpx;
  160. }
  161. .class_item {
  162. width: 100%;
  163. background: #ffffff;
  164. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  165. border-radius: 24rpx;
  166. padding: 20rpx;
  167. z-index: 999;
  168. position: relative;
  169. }
  170. </style>