index.vue 5.2 KB

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