indirectPromotionList.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="page">
  3. <view :style="{height:height}" class="list">
  4. <mescroll-uni ref="mescrollRef" @init="mescrollInit" :height="height" :down="downOption" @down="downCallback"
  5. :up="upOption" @up="upCallback" @emptyclick="emptyClick">
  6. <view class="flex-row justify-between item" v-for="(item,index) in 10">
  7. <view class="flex-row avatar">
  8. <image :src="'/static/ud4.png'"></image>
  9. </view>
  10. <view class="flex-col justify-between userMsg">
  11. <view class=" flex-row justify-between">
  12. <text class="name">张辉</text>
  13. <text class="time">2024-01-29 12:00:00</text>
  14. </view>
  15. <view class="flex-col justify-between">
  16. <text class="name">上级:简德兴</text>
  17. </view>
  18. </view>
  19. </view>
  20. </mescroll-uni>
  21. </view>
  22. <!--#ifdef H5-->
  23. <liu-drag-button @clickBtn="back">返回</liu-drag-button>
  24. <!--#endif-->
  25. </view>
  26. </template>
  27. <script>
  28. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  29. import MescrollMoreItemMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more-item.js"
  30. export default {
  31. mixins: [MescrollMixin, MescrollMoreItemMixin], // 注意此处还需使用MescrollMoreItemMixin (必须写在MescrollMixin后面)
  32. components: {},
  33. data() {
  34. return {
  35. height:'',
  36. downOption: {
  37. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  38. },
  39. upOption: {
  40. auto: false, // 不自动加载
  41. // page: {
  42. // num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  43. // size: 10 // 每页数据的数量
  44. // },
  45. noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  46. empty: {
  47. icon: '',
  48. tip: '暂无内容', // 提示
  49. // btnText: '去看看'
  50. },
  51. textNoMore: '没有更多了'
  52. },
  53. list: [],
  54. }
  55. },
  56. onLoad(e) {
  57. let sysInfo = uni.getSystemInfoSync()
  58. this.height = sysInfo.windowHeight - 70 + 'px' //除标题栏栏外的屏幕可用高度
  59. },
  60. methods: {
  61. back() {
  62. uni.navigateBack({
  63. delta: 1
  64. })
  65. },
  66. /*下拉刷新的回调 */
  67. downCallback() {
  68. // 这里加载你想下拉刷新的数据, 比如刷新轮播数据
  69. // loadSwiper();
  70. // 下拉刷新的回调,默认重置上拉加载列表为第一页 (自动执行 page.num=1, 再触发upCallback方法 )
  71. this.mescroll.resetUpScroll()
  72. },
  73. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  74. upCallback(page) {
  75. let status = this.index
  76. if (this.index === 3){
  77. status = 4
  78. }
  79. //联网加载数据
  80. this.mescroll.endSuccess(10, false);
  81. // this.$api.service.performanceList({
  82. // pageNum: page.num,
  83. // pageSize: 10,
  84. // type:this.index
  85. // }).then((res) => {
  86. // //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
  87. // this.mescroll.endSuccess(res.data.data.records.length, res.data.data.records.length === 10);
  88. // //设置列表数据
  89. // if (page.num === 1) this.list = []; //如果是第一页需手动制空列表
  90. // res.data.data.records.forEach(i=>{
  91. // if (i.avatar){
  92. // i.avatar = i.avatar.replace(/^http:/, "https:")
  93. // }
  94. // })
  95. // this.list = this.list.concat(res.data.data.records); //追加新数据
  96. // console.log(this.list)
  97. // }).catch((err) => {
  98. // //联网失败, 结束加载
  99. // this.mescroll.endErr();
  100. // })
  101. },
  102. //点击空布局按钮的回调
  103. emptyClick() {
  104. uni.showToast({
  105. title: '点击了按钮,具体逻辑自行实现'
  106. })
  107. },
  108. }
  109. }
  110. </script>
  111. <style lang="scss" scoped>
  112. @import './index.rpx.css';
  113. </style>