down.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <view>
  3. <view class="cl-one">
  4. <video-list :flag="1" :list="list"></video-list>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. import videoList from '../../index/components/wordlist.vue';
  10. export default {
  11. components: {
  12. videoList
  13. },
  14. data() {
  15. return {
  16. list: [],
  17. status:'loadmore',
  18. page:1,
  19. pagenum:10,
  20. };
  21. },
  22. onPullDownRefresh() {
  23. this.page=1;
  24. this.list=[];
  25. this.getInfoList();
  26. setTimeout(res => {
  27. uni.stopPullDownRefresh();
  28. }, 1000);
  29. },
  30. onReachBottom() {
  31. if (this.status == 'nomore') return;
  32. this.status = 'loadmore';
  33. this.page = ++this.page;
  34. this.getInfoList();
  35. },
  36. onLoad() {
  37. this.getInfoList();
  38. },
  39. methods: {
  40. getInfoList() {
  41. let url = 'user/myDownList';
  42. this.$api
  43. .request(url, {
  44. page: this.page,
  45. limit: this.pagenum
  46. })
  47. .then(data => {
  48. if (data.code == '200') {
  49. this.list = this.list.concat(data.data);
  50. if (data.data.length < this.pagnum) {
  51. this.status = 'nomore';
  52. }
  53. } else {
  54. this.$api.toast(data.msg);
  55. }
  56. });
  57. },
  58. }
  59. };
  60. </script>
  61. <style lang="scss" scoped>
  62. .cl-one{
  63. background-color: #fff;
  64. padding: 0 30rpx;
  65. }
  66. </style>