list.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <view class="safe-area-inset-bottom margin-top-10">
  3. <mescroll-body :height="height" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
  4. :down="downOption" :up="upOption">
  5. <view @click="jump(item)" class="cart-view-box" v-for="(item,index) in list" :key="index">
  6. <view class="text-gray text-center text-sm">{{item.createTime}}</view>
  7. <view class="bg-white margin-top-10 radius card-view">
  8. <view class="content-view">
  9. <view class="flex">
  10. <view class="center">
  11. <text class=" text-lg text-cut" style="color: #000000;">{{item.title}}</text>
  12. </view>
  13. </view>
  14. <view class=" text-sm text-cut-2 subtitle">{{item.content | formatHtml}}</view>
  15. <view class="flex text-gray justify-between "
  16. style=" border-top: 1rpx solid #f2f2f2;box-sizing: border-box;padding-top: 15rpx;">
  17. <view class="text-df ">
  18. <text>查看详情</text>
  19. </view>
  20. <view style="padding-top: 8rpx;">
  21. <text class="cuIcon-right "></text>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </mescroll-body>
  28. <toast ref="toast"></toast>
  29. </view>
  30. </template>
  31. <script>
  32. import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
  33. export default {
  34. mixins: [MescrollMixin],
  35. data() {
  36. return {
  37. list: [],
  38. downOption:{
  39. auto:false
  40. }
  41. }
  42. },
  43. filters: {
  44. formatHtml(str) {
  45. try{
  46. str= decodeURIComponent(str).replace(/<[^>]+>/g, "")
  47. }catch(e){
  48. console.log(e);
  49. }
  50. return str
  51. }
  52. },
  53. methods: {
  54. jump(item) {
  55. uni.navigateTo({
  56. url:"./detail?id="+item.id
  57. })
  58. },
  59. downCallback() {
  60. setTimeout(() => {
  61. this.$refs.toast.info('刷新成功')
  62. this.mescroll.resetUpScroll();
  63. }, 1000)
  64. },
  65. upCallback(mescroll) {
  66. let params = {
  67. senderId: this.vuex_shopId,
  68. current: mescroll.num,
  69. size: mescroll.size,
  70. }
  71. try {
  72. this.$api.notice.list(params).then(res => {
  73. let data = res.data.records
  74. let total = res.data.total
  75. mescroll.endBySize(data.length, total);
  76. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  77. this.list = this.list.concat(data); //追加新数据
  78. })
  79. } catch (e) {
  80. this.mescroll.endErr()
  81. }
  82. },
  83. }
  84. }
  85. </script>
  86. <style lang="scss">
  87. page {
  88. background-color: #F3F3F3;
  89. font-size: 28rpx;
  90. }
  91. .subtitle {
  92. color: #7e7e7e;
  93. font-size: 28rpx;
  94. margin: 30rpx 0 10rpx 0;
  95. line-height: 52rpx;
  96. }
  97. .cart-view-box {
  98. padding: 25rpx 20rpx;
  99. .card-view {
  100. background-color: #FFFFFF;
  101. position: relative;
  102. border-radius: 10rpx;
  103. .head-img {
  104. width: 100%;
  105. height: 236rpx;
  106. }
  107. .content-view {
  108. padding: 27rpx 27rpx 15rpx;
  109. }
  110. }
  111. }
  112. </style>