class.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view style="padding: 30rpx;">
  3. <navigator :url="'/pages2/wd/course?id=' + item.goodsId" 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)">进入学习</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">进入刷题</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. courseGoodsList() {
  70. let self = this;
  71. this.$api.courseGoodsList(this.param).then(res => {
  72. if (res.data.code == 200) {
  73. self.goodsList.push.apply(self.goodsList, res.data.rows);
  74. self.total = res.data.total;
  75. }
  76. });
  77. },
  78. studyIn(v) {
  79. this.$navTo.togo('/pages2/wd/course?id=' + v);
  80. },
  81. appointment(item) {
  82. var data = {
  83. goodsId: item.goodsId,
  84. gradeId: item.gradeId
  85. };
  86. this.$api.getApplysubscribe(data).then(res => {
  87. if (res.data.code === 500) {
  88. uni.showModal({
  89. showCancel: false,
  90. content: res.data.msg
  91. });
  92. }
  93. if (res.data.code === 200) {
  94. this.$navTo.togo('/pages2/appointment/index', {
  95. goodsId: item.goodsId,
  96. gradeId: item.gradeId
  97. });
  98. }
  99. });
  100. }
  101. }
  102. };
  103. </script>
  104. <style>
  105. page {
  106. background: #eaeef1;
  107. }
  108. </style>
  109. <style scope>
  110. .box_progress {
  111. display: flex;
  112. justify-content: space-between;
  113. align-items: center;
  114. margin-top: 20rpx;
  115. }
  116. .bottomBox {
  117. background: #ffffff;
  118. width: 94%;
  119. border-bottom-left-radius: 24rpx;
  120. border-bottom-right-radius: 24rpx;
  121. margin: 0 auto;
  122. padding: 20rpx;
  123. }
  124. .content_box {
  125. display: flex;
  126. align-items: center;
  127. color: #999999;
  128. margin-top: 8rpx;
  129. }
  130. .content {
  131. color: #000000;
  132. margin: 0 8rpx;
  133. }
  134. .wk_icon {
  135. width: 24rpx;
  136. height: 24rpx;
  137. margin-right: 8rpx;
  138. }
  139. .class_item {
  140. width: 100%;
  141. background: #ffffff;
  142. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  143. border-radius: 24rpx;
  144. padding: 20rpx;
  145. z-index: 999;
  146. position: relative;
  147. }
  148. </style>