free_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></view>
  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.bankQuestionListFreeGoodsList();
  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.bankQuestionListFreeGoodsList();
  59. }
  60. },
  61. methods: {
  62. bankQuestionListFreeGoodsList() {
  63. this.$api.bankQuestionListFreeGoodsList(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. this.itemIndex = index;
  70. let sysTime = this.$method.timest()
  71. if (item.serviceStartTime && item.serviceEndTime && (sysTime <= item.serviceStartTime || this.sysTime >= item.serviceEndTime)) {
  72. uni.showToast({
  73. icon: 'none',
  74. title: '不在学习服务期,不能进入学习'
  75. })
  76. return;
  77. }
  78. uni.navigateTo({
  79. url:'/pages2/bank/question_detail?id='+item.goodsId+'&orderGoodsId='+item.orderGoodsId
  80. })
  81. },
  82. refreshByIndex() {
  83. console.log('refreshByIndex')
  84. this.$api.bankQuestionListFreeGoodsList({
  85. pageNum:this.itemIndex+1,
  86. pageSize:1,
  87. }).then(res => {
  88. this.$set(this.list,this.itemIndex,res.data.rows[0])
  89. })
  90. }
  91. },
  92. }
  93. </script>
  94. <style >
  95. page {
  96. background: #EAEEF1;
  97. }
  98. </style>
  99. <style lang="scss" scope>
  100. .box_progress{
  101. display: flex;
  102. justify-content:space-between;
  103. align-items: center;
  104. margin-top: 20rpx;
  105. .btn {
  106. width: 165rpx;
  107. height: 48rpx;
  108. background: #007AFF;
  109. border-radius: 16rpx;
  110. line-height: 48rpx;
  111. text-align: center;
  112. color:#fff;
  113. font-size: 30rpx;
  114. }
  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. height: 514rpx;
  142. background: #FFFFFF;
  143. box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
  144. border-radius: 24rpx;
  145. padding: 20rpx;
  146. z-index: 999;
  147. position: relative;
  148. .img {
  149. width:100%;
  150. border-radius: 24rpx;
  151. height: 376rpx;
  152. }
  153. }
  154. </style>