学员端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.1 KiB

10 months ago
11 months ago
1 year ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="我的收藏"></topNavbar>
  4. <view class="pad">
  5. <view class="searcBox">
  6. <searchRow placeholder="搜索视频名称" @searchFn="searchFn"/>
  7. </view>
  8. <view class="ul">
  9. <view class="li" v-for="(item,index) in list" :key="index" @click="$goPage('/pages/indexEntry/publicVideo/videoDetail/videoDetail?id='+ item.id)">
  10. <videoItem :item="item"></videoItem>
  11. </view>
  12. </view>
  13. <view style="padding-bottom: 20rpx;" v-if="list.length">
  14. <u-loadmore :status="status" />
  15. </view>
  16. <nodata v-if="!list.length"></nodata>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import videoItem from './videoItem.vue'
  22. import { getcollectVideo } from '@/config/api.js'
  23. export default {
  24. components: { videoItem },
  25. data() {
  26. return {
  27. list: [],
  28. params: {
  29. phone: '',
  30. title: '',
  31. pageNo: 1,
  32. pageSize: 20
  33. },
  34. total: 20,
  35. status: 'loading'
  36. }
  37. },
  38. onLoad() {
  39. this.params.phone = this.vuex_userInfo.phone
  40. this.getcollectVideoFn()
  41. },
  42. onPullDownRefresh() {
  43. this.params.pageNo = 1
  44. this.list = []
  45. this.getcollectVideoFn().then(()=>{
  46. uni.stopPullDownRefresh()
  47. })
  48. },
  49. onReachBottom() {
  50. if(this.total>this.list.length) {
  51. this.getcollectVideoFn()
  52. }
  53. },
  54. methods: {
  55. searchFn(val) {
  56. this.params.title = val
  57. this.list = []
  58. this.params.pageNo = 1
  59. this.getcollectVideoFn()
  60. },
  61. async getcollectVideoFn() {
  62. const {data: res} = await getcollectVideo(this.params)
  63. this.params.pageNo ++
  64. this.list.push(...res.list)
  65. this.total = res.total
  66. if(this.list.length>=this.total) this.status = 'nomore'
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .ul {
  73. width: 100%;
  74. display: flex;
  75. justify-content: space-between;
  76. flex-wrap: wrap;
  77. .li {
  78. width: 100%;
  79. width: 48%;
  80. height: 260rpx;
  81. background: #FFFFFF;
  82. box-shadow: 0px 8rpx 20rpx 0px rgba(0,0,0,0.04), 2rpx 2rpx 8rpx 0px rgba(0,0,0,0.06);
  83. border-radius: 16rpx;
  84. margin-bottom: 24rpx;
  85. padding: 16rpx;
  86. }
  87. }
  88. .searcBox {
  89. padding: 0rpx 0 32rpx 0;
  90. }
  91. </style>