todayPromotionList.vue 3.7 KB

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