index.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view>
  3. <!-- 答题组件 -->
  4. <kz-question mode="VIEW" pageType="WRONG" title="我的错题" :questions="list" v-show="!showNodata" :canDeleteWrong="true"
  5. v-on:refresh="refresh"></kz-question>
  6. <!-- 暂无数据 -->
  7. <tui-no-data imgUrl="/static/img/img_noorder_3x.png" v-if="showNodata">暂无数据</tui-no-data>
  8. <login ref="login" v-on:succ="ajax"></login>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. data () {
  14. return {
  15. list: [],
  16. total: 0,
  17. page: 1,
  18. over: 0,
  19. questionIds: [],
  20. showNodata: false
  21. }
  22. },
  23. onLoad (e) {
  24. this.questionIds = e.question_ids
  25. this.ajax()
  26. },
  27. methods: {
  28. ajax () {
  29. this.http('question/wrongList', { page: this.page, question_ids: this.questionIds }, 'post').then(res => {
  30. this.total = res.data.total;
  31. // this.choice[2] = res.data.total;
  32. var list = res.data.list.data;
  33. for (var i in list) {
  34. list[i]['log_id'] = list[i]['id']
  35. list[i] = Object.assign(list[i], list[i]['question']);
  36. }
  37. this.list = this.list || [];
  38. this.list = this.list.concat(list);
  39. this.page++;
  40. if (!res.data.list.has_more) {
  41. this.over = 1;
  42. }
  43. this.showNodata = this.list.length == 0
  44. });
  45. },
  46. refresh () {
  47. this.page = 1
  48. this.list = []
  49. this.ajax()
  50. }
  51. }
  52. }
  53. </script>
  54. <style>
  55. </style>