index.vue 1.3 KB

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