collection.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="">
  3. <view class="es-fx box">
  4. <mescroll-body :sticky="true" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
  5. :down="downOption" :up="upOption">
  6. <view class="" v-if="list.length>0">
  7. <view class="es es-ac es-pl-28 es-pr-28 es-pt-28 es-pb-28 border-line"
  8. style="background-color: #fff;" @click="detail(item)" v-for="(item,index) in list"
  9. :key="item.collectionId">
  10. <image class="es-w-150 es-h-150 es-br-10" style="flex-shrink: 0;" :src="item.coverUrl || ''"
  11. mode="aspectFill"></image>
  12. <view class="es es-ver flex es-h-150 es-pl-28"
  13. style="justify-content: space-evenly;overflow: hidden;">
  14. <view class="es es-ac" style="overflow: hidden;">
  15. <image class="es-h-40 es-w-40 es-mr-16" style="flex-shrink: 0;"
  16. src="/static/images/mine/dd_mg.png" mode="aspectFill"></image>
  17. <text class="flex es-fs-32 es-fw-600 textOne">{{item.title}}</text>
  18. </view>
  19. <view class="es-fs-30" style="color: #777;">1.3w播放 · 更新至第7集</view>
  20. </view>
  21. </view>
  22. </view>
  23. </mescroll-body>
  24. </view>
  25. <view class="footer">
  26. <button class="footer-btn" @click="navTo('/pages/expert/collectionEdit')">创建合集</button>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  32. import {
  33. videoCollectionMyList,
  34. } from "@/api/expert.js"
  35. export default {
  36. mixins: [MescrollMixin],
  37. data() {
  38. return {
  39. list: [],
  40. mescroll: null,
  41. downOption: { //下拉刷新
  42. use: true,
  43. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  44. },
  45. upOption: {
  46. onScroll: false,
  47. use: true, // 是否启用上拉加载; 默认true
  48. page: {
  49. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  50. size: 10 // 每页数据的数量,默认10
  51. },
  52. noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  53. textNoMore: "已经到底了",
  54. empty: {
  55. icon: 'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
  56. tip: '暂无数据'
  57. }
  58. },
  59. }
  60. },
  61. onUnload() {
  62. uni.removeStorageSync('collectionData')
  63. },
  64. methods: {
  65. mescrollInit(mescroll) {
  66. this.mescroll = mescroll;
  67. },
  68. downCallback(mescroll) {
  69. mescroll.resetUpScroll()
  70. },
  71. async upCallback(page) {
  72. let that = this;
  73. let params = {
  74. status: 1,
  75. pageNum: page.num,
  76. pageSize: page.size
  77. }
  78. const res = await videoCollectionMyList(params)
  79. if (res.code == 200) {
  80. if (page.num == 1) that.list = []
  81. that.list = that.list.concat(res.data.list);
  82. that.mescroll.endBySize(res.data.list.length, res.data.total);
  83. } else {
  84. uni.showToast({
  85. icon: 'none',
  86. title: "请求失败",
  87. });
  88. that.dataList = null;
  89. that.mescroll.endErr();
  90. }
  91. },
  92. navTo(url) {
  93. this.$loginNavTo(url)
  94. },
  95. detail(data) {
  96. uni.setStorageSync('collectionData', data)
  97. this.navTo('/pages/expert/collectionDetail')
  98. },
  99. }
  100. }
  101. </script>
  102. <style scoped lang="scss">
  103. .border-line {
  104. position: relative;
  105. &::after {
  106. position: absolute;
  107. left: 28rpx;
  108. right: 28rpx;
  109. bottom: 0;
  110. content: "";
  111. border-bottom: 1px solid #f7f7f7;
  112. width: calc(100% - 56rpx);
  113. transform: scaleY(0.5);
  114. border-top-color: #f7f7f7;
  115. border-right-color: #f7f7f7;
  116. border-left-color: #f7f7f7;
  117. }
  118. }
  119. .footer {
  120. width: 100%;
  121. height: 142rpx;
  122. padding: 20rpx 24rpx;
  123. box-sizing: border-box;
  124. position: fixed;
  125. bottom: var(--window-bottom);
  126. left: 0;
  127. background: #FFFFFF;
  128. &-btn {
  129. height: 92rpx;
  130. background: #FF5C03;
  131. border-radius: 12rpx;
  132. font-weight: 400;
  133. font-size: 34rpx;
  134. color: #FFFFFF;
  135. line-height: 92rpx;
  136. text-align: center;
  137. &::after {
  138. border: none;
  139. }
  140. }
  141. }
  142. .box {
  143. padding-bottom: 142rpx;
  144. }
  145. </style>