index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <view class="random_practice">
  3. <nav-bar title="随机练习"></nav-bar>
  4. <view class="contents">
  5. <view>试卷情况</view>
  6. <view>本题库共{{ questionNum.totalNum || 0 }}道题,剩余800题,你已做{{ questionNum.doNum || 0}}</view>
  7. <view class="number_crad">
  8. <view>选择做题数量</view>
  9. <view v-for="(item, index) in numberLists" :key="index" class="items" @click="changeNum(item)">
  10. {{item}}
  11. </view>
  12. <view class="starts" @click="startPractice()">
  13. 开始做题
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. goodsId: '',
  24. orderGoodsId: '',
  25. numberLists: [5, 10, 15, 20, 50, 100],
  26. number: 5,
  27. questionNum: {}
  28. }
  29. },
  30. onLoad(option) {
  31. this.goodsId = option.goodsId
  32. this.orderGoodsId = option.orderGoodsId
  33. },
  34. onShow() {
  35. this.getQuestionTempNum()
  36. },
  37. methods: {
  38. changeNum(item) {
  39. console.log(item);
  40. this.number = item
  41. },
  42. getQuestionTempNum() {
  43. this.$http({
  44. url: `/goods/bank/questionTempNum/${this.orderGoodsId}`,
  45. method: 'get',
  46. }).then((res) => {
  47. if (res.data.code == 200) {
  48. this.questionNum = res.data.data || {}
  49. }
  50. })
  51. },
  52. startPractice() {
  53. uni.navigateTo({
  54. url:'/pages2/bank/questionBank?orderGoodsId='+ this.orderGoodsId + '&id=""' + '&goodsid=' + this.goodsId
  55. +'&moduleId=0' + '&chapterId=0' + '&entryType=random' + '&bankNum=' + this.number
  56. })
  57. }
  58. },
  59. }
  60. </script>
  61. <style lang="scss">
  62. .number_crad {
  63. .items {
  64. margin-bottom: 28rpx;
  65. }
  66. .starts {
  67. width: 646rpx;
  68. height: 96rpx;
  69. line-height: 96rpx;
  70. text-align: center;
  71. color: #fff;
  72. font-size: 32rpx;
  73. font-weight: bold;
  74. background: #3577E8;
  75. border-radius: 24rpx;
  76. }
  77. }
  78. </style>