class.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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" 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>
  44. </template>
  45. <script>
  46. export default {
  47. data() {
  48. return {
  49. list: [1, 2, 3],
  50. goodsList: [],
  51. param:{
  52. pageNum: 1,
  53. pageSize: 10
  54. },
  55. total: 0
  56. };
  57. },
  58. onLoad(option) {
  59. this.courseGoodsList();
  60. },
  61. onShow() {},
  62. onReachBottom() {
  63. if (this.goodsList.length < this.total) {
  64. this.param.pageNum++;
  65. this.courseGoodsList();
  66. }
  67. },
  68. methods: {
  69. appBeforeAddress(goodsId) {
  70. this.$api.appBeforeAddress({
  71. goodsId
  72. }).then(res => {
  73. if(res.data.code == 200) {
  74. uni.navigateToMiniProgram({
  75. appId: res.data.data.url,
  76. success(res) {
  77. // 打开成功
  78. }
  79. })
  80. } else {
  81. uni.showToast({
  82. title: res.data.msg,
  83. icon: 'none',
  84. })
  85. }
  86. })
  87. },
  88. courseGoodsList() {
  89. let self = this;
  90. this.$api.courseGoodsList(this.param).then(res => {
  91. if (res.data.code == 200) {
  92. self.goodsList.push.apply(self.goodsList, res.data.rows);
  93. self.total = res.data.total;
  94. }
  95. });
  96. },
  97. studyIn(v,i) {
  98. this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}`);
  99. },
  100. appointment(item) {
  101. var data = {
  102. goodsId: item.goodsId,
  103. gradeId: item.gradeId
  104. };
  105. this.$api.getApplysubscribe(data).then(res => {
  106. if (res.data.code === 500) {
  107. uni.showModal({
  108. showCancel: false,
  109. content: res.data.msg
  110. });
  111. }
  112. if (res.data.code === 200) {
  113. this.$navTo.togo('/pages2/appointment/index', {
  114. goodsId: item.goodsId,
  115. gradeId: item.gradeId
  116. });
  117. }
  118. });
  119. }
  120. }
  121. };
  122. </script>
  123. <style>
  124. page {
  125. background: #eaeef1;
  126. }
  127. </style>
  128. <style scope>
  129. .box_progress {
  130. display: flex;
  131. justify-content: space-between;
  132. align-items: center;
  133. margin-top: 20rpx;
  134. }
  135. .bottomBox {
  136. background: #ffffff;
  137. width: 94%;
  138. border-bottom-left-radius: 24rpx;
  139. border-bottom-right-radius: 24rpx;
  140. margin: 0 auto;
  141. padding: 20rpx;
  142. }
  143. .content_box {
  144. display: flex;
  145. align-items: center;
  146. color: #999999;
  147. margin-top: 8rpx;
  148. }
  149. .content {
  150. color: #000000;
  151. margin: 0 8rpx;
  152. }
  153. .wk_icon {
  154. width: 24rpx;
  155. height: 24rpx;
  156. margin-right: 8rpx;
  157. }
  158. .class_item {
  159. width: 100%;
  160. background: #ffffff;
  161. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  162. border-radius: 24rpx;
  163. padding: 20rpx;
  164. z-index: 999;
  165. position: relative;
  166. }
  167. </style>