my_question.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view style="padding: 30rpx">
  3. <nav-bar title="自购题卷"></nav-bar>
  4. <view
  5. v-for="(item, index) in list"
  6. :key="index"
  7. style="margin-bottom: 30rpx"
  8. @click="studyIn(item, index)"
  9. >
  10. <view class="class_item">
  11. <image
  12. class="img"
  13. :src="$method.splitImgHost(item.coverUrl, true)"
  14. ></image>
  15. <view style="color: #333333; font-weight: bold; font-size: 32rpx">
  16. {{ item.goodsName }}
  17. </view>
  18. <view
  19. class="content_box"
  20. v-if="item.serviceStartTime && item.serviceEndTime"
  21. >
  22. <image src="/static/icon/wk_icon2.png" class="wk_icon"></image>
  23. 学习服务期:<text class="content">
  24. {{ $method.timestampToTime(item.serviceStartTime, true, true) }}-{{
  25. $method.timestampToTime(item.serviceEndTime, true, true)
  26. }}
  27. </text>
  28. </view>
  29. </view>
  30. <view class="bottomBox">
  31. <view style="color: #999999; font-size: 24rpx"
  32. >刷题进度:{{ item.doNum }}/{{ item.totalNum }}</view
  33. >
  34. <view class="box_progress">
  35. <view style="width: 60%">
  36. <u-line-progress
  37. :show-percent="false"
  38. height="22"
  39. active-color="#007AFF"
  40. :percent="(item.doNum / item.totalNum) * 100"
  41. ></u-line-progress>
  42. </view>
  43. <view>
  44. <!-- <navigator hover-class="none" :url="'/pages2/bank/question_detail?id='+item.goodsId"> -->
  45. <view class="btn">进入刷题</view>
  46. <!-- </navigator> -->
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view v-if="list.length == 0">
  52. <u-empty text="暂无题库" margin-top="500" mode="list"></u-empty
  53. ></view>
  54. </view>
  55. </template>
  56. <script>
  57. export default {
  58. data() {
  59. return {
  60. list: [],
  61. param: {
  62. pageNum: 1,
  63. pageSize: 10,
  64. },
  65. total: 0,
  66. itemIndex: "",
  67. };
  68. },
  69. onLoad(option) {
  70. this.listGoodsUserQuestion();
  71. },
  72. onShow() {
  73. if (this.itemIndex !== "") {
  74. this.refreshByIndex();
  75. }
  76. },
  77. onReachBottom() {
  78. if (this.list.length < this.total) {
  79. this.param.pageNum++;
  80. this.listGoodsUserQuestion();
  81. }
  82. },
  83. methods: {
  84. listGoodsUserQuestion() {
  85. this.$api.listGoodsUserQuestion(this.param).then((res) => {
  86. this.list = [...this.list, ...res.data.rows];
  87. this.total = res.data.total;
  88. });
  89. },
  90. studyIn(item, index) {
  91. console.log(item);
  92. this.itemIndex = index;
  93. let sysTime = this.$method.timest();
  94. if (
  95. item.serviceStartTime &&
  96. item.serviceEndTime &&
  97. (sysTime <= item.serviceStartTime ||
  98. this.sysTime >= item.serviceEndTime)
  99. ) {
  100. uni.showToast({
  101. icon: "none",
  102. title: "不在学习服务期,不能进入学习",
  103. });
  104. return;
  105. }
  106. uni.navigateTo({
  107. url:
  108. "/pages2/bank/question_detail?id=" +
  109. item.goodsId +
  110. "&orderGoodsId=" +
  111. item.orderGoodsId,
  112. });
  113. },
  114. refreshByIndex() {
  115. console.log("refreshByIndex");
  116. this.$api
  117. .listGoodsUserQuestion({
  118. pageNum: this.itemIndex + 1,
  119. pageSize: 1,
  120. })
  121. .then((res) => {
  122. this.$set(this.list, this.itemIndex, res.data.rows[0]);
  123. });
  124. },
  125. },
  126. };
  127. </script>
  128. <style >
  129. page {
  130. background: #eaeef1;
  131. }
  132. </style>
  133. <style lang="scss" scope>
  134. .box_progress {
  135. display: flex;
  136. justify-content: space-between;
  137. align-items: center;
  138. margin-top: 20rpx;
  139. .btn {
  140. width: 165rpx;
  141. height: 48rpx;
  142. background: #007aff;
  143. border-radius: 16rpx;
  144. line-height: 48rpx;
  145. text-align: center;
  146. color: #fff;
  147. font-size: 30rpx;
  148. }
  149. }
  150. .bottomBox {
  151. background: #ffffff;
  152. width: 94%;
  153. border-bottom-left-radius: 24rpx;
  154. border-bottom-right-radius: 24rpx;
  155. margin: 0 auto;
  156. padding: 20rpx;
  157. }
  158. .content_box {
  159. display: flex;
  160. align-items: center;
  161. color: #999999;
  162. margin-top: 8rpx;
  163. }
  164. .content {
  165. color: #000000;
  166. margin: 0 8rpx;
  167. }
  168. .wk_icon {
  169. width: 24rpx;
  170. height: 24rpx;
  171. margin-right: 8rpx;
  172. }
  173. .class_item {
  174. width: 100%;
  175. height: 514rpx;
  176. background: #ffffff;
  177. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  178. border-radius: 24rpx;
  179. padding: 20rpx;
  180. z-index: 999;
  181. position: relative;
  182. .img {
  183. width: 100%;
  184. border-radius: 24rpx;
  185. height: 376rpx;
  186. }
  187. }
  188. </style>