my_question.vue 3.4 KB

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