publicCourse.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view class="content">
  3. <view class="content-list">
  4. <view class="content-list-item" v-for="(item, index) in videoList" :key="index">
  5. <view class="content-list-item-image">
  6. <u-image class="image" width="100%" height="224rpx" :src="item.image" />
  7. <view class="play-btn">
  8. <u-image width="70rpx" height="70rpx" src="/static/img/play-video-icon.svg" />
  9. </view>
  10. </view>
  11. <view class="content-list-item-title">
  12. <text>{{ item.title }}</text>
  13. </view>
  14. <view class="content-list-item-subtitle">
  15. <text>{{ item.subtitle }}</text>
  16. </view>
  17. </view>
  18. </view>
  19. <u-loadmore :status="status" />
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. status: 'loadmore',
  27. videoList: [
  28. { image: '', title: '诞生', subtitle: '颂军魂' },
  29. { image: '', title: '诞生', subtitle: '颂军魂' },
  30. { image: '', title: '诞生', subtitle: '颂军魂' },
  31. { image: '', title: '诞生', subtitle: '颂军魂' },
  32. { image: '', title: '诞生', subtitle: '颂军魂' },
  33. { image: '', title: '诞生', subtitle: '颂军魂' },
  34. { image: '', title: '诞生', subtitle: '颂军魂' },
  35. { image: '', title: '诞生', subtitle: '颂军魂' },
  36. { image: '', title: '诞生', subtitle: '颂军魂' },
  37. { image: '', title: '诞生', subtitle: '颂军魂' }
  38. ],
  39. page: {
  40. num: 1,
  41. size: 10,
  42. total: 0
  43. }
  44. };
  45. },
  46. onLoad(options) {
  47. uni.setNavigationBarTitle({
  48. title: '颂军魂'
  49. });
  50. },
  51. onPullDownRefresh() {
  52. Object.assign(this, {
  53. status: 'loadmore',
  54. videoList: [
  55. { image: '', title: '诞生', subtitle: '颂军魂' },
  56. { image: '', title: '诞生', subtitle: '颂军魂' },
  57. { image: '', title: '诞生', subtitle: '颂军魂' },
  58. { image: '', title: '诞生', subtitle: '颂军魂' },
  59. { image: '', title: '诞生', subtitle: '颂军魂' },
  60. { image: '', title: '诞生', subtitle: '颂军魂' },
  61. { image: '', title: '诞生', subtitle: '颂军魂' },
  62. { image: '', title: '诞生', subtitle: '颂军魂' },
  63. { image: '', title: '诞生', subtitle: '颂军魂' },
  64. { image: '', title: '诞生', subtitle: '颂军魂' }
  65. ],
  66. page: {
  67. num: 1,
  68. size: 10,
  69. total: 0
  70. }
  71. });
  72. setTimeout(() => {
  73. this.handleVideoList();
  74. uni.stopPullDownRefresh(); //停止刷新
  75. }, 1000);
  76. },
  77. onReachBottom() {
  78. if (this.page.num >= this.page.total) return;
  79. this.status = 'loading';
  80. this.page.num = ++this.page.num;
  81. setTimeout(() => {
  82. this.handleVideoList();
  83. }, 1500);
  84. },
  85. methods: {
  86. handleVideoList() {
  87. this.videoList = this.videoList.concat([
  88. { image: '', title: '诞生', subtitle: '颂军魂' },
  89. { image: '', title: '诞生', subtitle: '颂军魂' },
  90. { image: '', title: '诞生', subtitle: '颂军魂' },
  91. { image: '', title: '诞生', subtitle: '颂军魂' },
  92. { image: '', title: '诞生', subtitle: '颂军魂' },
  93. { image: '', title: '诞生', subtitle: '颂军魂' },
  94. { image: '', title: '诞生', subtitle: '颂军魂' },
  95. { image: '', title: '诞生', subtitle: '颂军魂' },
  96. { image: '', title: '诞生', subtitle: '颂军魂' },
  97. { image: '', title: '诞生', subtitle: '颂军魂' }
  98. ]);
  99. this.page.total = 100;
  100. if (this.page.num >= this.page.total) this.status = 'nomore';
  101. else this.status = 'loading';
  102. }
  103. }
  104. };
  105. </script>
  106. <style lang="scss" scoped>
  107. @import './publicCourse.scss';
  108. </style>