index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. let value = (this.questionNum.rightNum / this.questionNum.totalNum ) * 100
  60. return value.toFixed(2) + '%'
  61. }
  62. }
  63. },
  64. methods: {
  65. changeNum(item) {
  66. this.number = item
  67. },
  68. getQuestionTempNum() {
  69. this.$http({
  70. url: `/goods/bank/questionTempNum/${this.orderGoodsId}`,
  71. method: 'get',
  72. }).then((res) => {
  73. if (res.data.code == 200) {
  74. this.questionNum = res.data.data || {}
  75. }
  76. })
  77. },
  78. startPractice() {
  79. uni.navigateTo({
  80. url:'/pages2/bank/questionBank?orderGoodsId='+ this.orderGoodsId + '&id=""' + '&goodsid=' + this.goodsId
  81. +'&moduleId=0' + '&chapterId=0' + '&entryType=random' + '&bankNum=' + this.number
  82. })
  83. }
  84. },
  85. }
  86. </script>
  87. <style lang="scss">
  88. .random_practice {
  89. width: 100%;
  90. padding: 24rpx 26rpx;
  91. background: #FAFAFA;
  92. }
  93. .contents {
  94. width: 100%;
  95. height: 100%;
  96. display: flex;
  97. flex-direction: column;
  98. align-items: center;
  99. .examSitu {
  100. width: 200rpx;
  101. height: 200rpx;
  102. margin-bottom: 56rpx;
  103. }
  104. .exam_si {
  105. color: #222222;
  106. font-size: 32rpx;
  107. font-weight: bold;
  108. margin: 80rpx 0rpx 40rpx 0rpx;
  109. }
  110. .nums {
  111. width: 100%;
  112. display: flex;
  113. align-items: center;
  114. justify-content: space-around;
  115. margin-bottom: 132rpx;
  116. .n_item {
  117. display: flex;
  118. flex-direction: column;
  119. align-items: center;
  120. .do_num {
  121. font-size: 48rpx;
  122. font-family: DIN-Medium, DIN;
  123. font-weight: 500;
  124. color: #222222;
  125. margin-bottom: 8rpx;
  126. }
  127. .word {
  128. font-size: 24rpx;
  129. font-family: PingFang SC-Medium, PingFang SC;
  130. font-weight: 500;
  131. color: #808DA4;
  132. }
  133. }
  134. }
  135. }
  136. .number_crad {
  137. width: 100%;
  138. padding: 0rpx 26rpx;
  139. text-align: center;
  140. background-color: #fff;
  141. margin-bottom: 178rpx;
  142. .title {
  143. font-size: 36rpx;
  144. font-family: PingFang SC-Medium, PingFang SC;
  145. font-weight: 500;
  146. color: #222222;
  147. margin: 56rpx 0rpx;
  148. }
  149. .crads {
  150. display: flex;
  151. flex-wrap: wrap;
  152. justify-content: space-between;
  153. .items {
  154. width: 204rpx;
  155. height: 96rpx;
  156. line-height: 96rpx;
  157. text-align: center;
  158. background: #F8F8FA;
  159. border-radius: 24rpx;
  160. margin-bottom: 28rpx;
  161. font-size: 48rpx;
  162. font-family: DIN Alternate-Bold, DIN Alternate;
  163. font-weight: bold;
  164. color: #222222;
  165. &.nactive {
  166. background: #E8F6FF;
  167. color: #3577E8;
  168. }
  169. }
  170. }
  171. .starts {
  172. width: 646rpx;
  173. height: 96rpx;
  174. line-height: 96rpx;
  175. text-align: center;
  176. color: #fff;
  177. font-size: 32rpx;
  178. font-weight: bold;
  179. background: #3577E8;
  180. border-radius: 24rpx;
  181. margin: 52rpx 0rpx 40rpx 0rpx;
  182. }
  183. }
  184. </style>