todayPromotionList.vue 3.8 KB

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