my_question.vue 3.9 KB

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