index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <view class="random_practice">
  3. <nav-bar title="随机练习"></nav-bar>
  4. <view class="contents">
  5. <image src="/pages2/static/random/exam_situ.png" class="examSitu"></image>
  6. <view class="exam_si">试卷情况</view>
  7. <view class="total_Num">本题库共{{ questionNum.totalNum || 0 }}道题,剩余{{ questionNum.totalNum - questionNum.doNum }}题,你已做</view>
  8. <view class="do_num">
  9. <text class="one">{{ questionNum.doNum || 0}}</text> 题
  10. </view>
  11. <view class="number_crad">
  12. <view class="title">选择做题数量</view>
  13. <view class="crads">
  14. <view v-for="(item, index) in numberLists" :key="index" class="items"
  15. :class="{nactive: item == number}" @click="changeNum(item)">
  16. {{item}}
  17. </view>
  18. </view>
  19. <view class="starts" @click="startPractice()">
  20. 开始做题
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. goodsId: '',
  31. orderGoodsId: '',
  32. numberLists: [5, 10, 15, 20, 50, 100],
  33. number: 5,
  34. questionNum: {}
  35. }
  36. },
  37. onLoad(option) {
  38. this.goodsId = option.goodsId
  39. this.orderGoodsId = option.orderGoodsId
  40. },
  41. onShow() {
  42. this.getQuestionTempNum()
  43. },
  44. methods: {
  45. changeNum(item) {
  46. console.log(item);
  47. this.number = item
  48. },
  49. getQuestionTempNum() {
  50. this.$http({
  51. url: `/goods/bank/questionTempNum/${this.orderGoodsId}`,
  52. method: 'get',
  53. }).then((res) => {
  54. if (res.data.code == 200) {
  55. this.questionNum = res.data.data || {}
  56. }
  57. })
  58. },
  59. startPractice() {
  60. uni.navigateTo({
  61. url:'/pages2/bank/questionBank?orderGoodsId='+ this.orderGoodsId + '&id=""' + '&goodsid=' + this.goodsId
  62. +'&moduleId=0' + '&chapterId=0' + '&entryType=random' + '&bankNum=' + this.number
  63. })
  64. }
  65. },
  66. }
  67. </script>
  68. <style lang="scss">
  69. .random_practice {
  70. width: 100%;
  71. padding: 24rpx 26rpx;
  72. background: #FFFFFF;
  73. }
  74. .contents {
  75. width: 100%;
  76. height: 100%;
  77. display: flex;
  78. flex-direction: column;
  79. align-items: center;
  80. .examSitu {
  81. width: 200rpx;
  82. height: 200rpx;
  83. }
  84. .exam_si {
  85. color: #222222;
  86. font-size: 32rpx;
  87. font-weight: bold;
  88. margin: 26rpx 0rpx 24rpx 0rpx;
  89. }
  90. .total_Num {
  91. font-size: 28rpx;
  92. color: #888691;
  93. margin-bottom: 24rpx;
  94. }
  95. .do_num {
  96. font-size: 32rpx;
  97. font-family: PingFang SC-Bold, PingFang SC;
  98. font-weight: bold;
  99. color: #222222;
  100. .one {
  101. font-size: 120rpx;
  102. font-family: DIN Alternate-Bold, DIN Alternate;
  103. }
  104. }
  105. }
  106. .number_crad {
  107. width: 100%;
  108. padding: 0rpx 26rpx;
  109. text-align: center;
  110. .title {
  111. font-size: 36rpx;
  112. font-family: PingFang SC-Medium, PingFang SC;
  113. font-weight: 500;
  114. color: #222222;
  115. margin: 56rpx 0rpx;
  116. }
  117. .crads {
  118. display: flex;
  119. flex-wrap: wrap;
  120. justify-content: space-between;
  121. .items {
  122. width: 204rpx;
  123. height: 96rpx;
  124. line-height: 96rpx;
  125. text-align: center;
  126. background: #F8F8FA;
  127. border-radius: 24rpx;
  128. margin-bottom: 28rpx;
  129. font-size: 48rpx;
  130. font-family: DIN Alternate-Bold, DIN Alternate;
  131. font-weight: bold;
  132. color: #222222;
  133. &.nactive {
  134. background: #E8F6FF;
  135. color: #3577E8;
  136. }
  137. }
  138. }
  139. .starts {
  140. width: 646rpx;
  141. height: 96rpx;
  142. line-height: 96rpx;
  143. text-align: center;
  144. color: #fff;
  145. font-size: 32rpx;
  146. font-weight: bold;
  147. background: #3577E8;
  148. border-radius: 24rpx;
  149. margin: 52rpx 0rpx 40rpx 0rpx;
  150. }
  151. }
  152. </style>