notice.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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.noticeManagementContent.title}}</text>
  12. </view>
  13. </view>
  14. <view class=" text-sm text-cut-2 subtitle">{{item.noticeManagementContent.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. import Base64 from 'base-64';
  34. export default {
  35. mixins: [MescrollMixin],
  36. data() {
  37. return {
  38. ids: [],
  39. list: [],
  40. downOption:{
  41. auto:false
  42. }
  43. }
  44. },
  45. filters: {
  46. formatHtml(str) {
  47. return decodeURIComponent(str).replace(/<[^>]+>/g, "");
  48. }
  49. },
  50. onLoad(options) {
  51. this.ids = JSON.parse(options.ids)
  52. this.isRead()
  53. },
  54. methods: {
  55. isRead() {
  56. if (this.$isEmpty(this.ids)) {
  57. return
  58. }
  59. let params = []
  60. this.ids.forEach(item => {
  61. let obj = {
  62. id: item,
  63. isRead: true
  64. }
  65. params.push(obj)
  66. })
  67. this.$api.notice.isRead(params)
  68. },
  69. jump(item) {
  70. uni.navigateTo({
  71. url: "detail?id=" + item.id
  72. })
  73. },
  74. downCallback() {
  75. setTimeout(() => {
  76. this.$refs.toast.info('刷新成功')
  77. this.mescroll.resetUpScroll();
  78. }, 1000)
  79. },
  80. upCallback(mescroll) {
  81. let params = {
  82. receiverId: this.vuex_userId,
  83. current: mescroll.num,
  84. size: mescroll.size,
  85. }
  86. try {
  87. this.$api.notice.list(params).then(res => {
  88. let data = res.data.records
  89. let total = res.data.total
  90. mescroll.endBySize(data.length, total);
  91. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  92. this.list = this.list.concat(data); //追加新数据
  93. })
  94. } catch (e) {
  95. this.mescroll.endErr()
  96. }
  97. },
  98. }
  99. }
  100. </script>
  101. <style lang="scss">
  102. page {
  103. background-color: #F3F3F3;
  104. font-size: 28rpx;
  105. }
  106. .subtitle {
  107. color: #7e7e7e;
  108. font-size: 28rpx;
  109. margin: 30rpx 0 10rpx 0;
  110. line-height: 52rpx;
  111. }
  112. .cart-view-box {
  113. padding: 25rpx 20rpx;
  114. .card-view {
  115. background-color: #FFFFFF;
  116. position: relative;
  117. border-radius: 10rpx;
  118. .head-img {
  119. width: 100%;
  120. height: 236rpx;
  121. }
  122. .content-view {
  123. padding: 27rpx 27rpx 15rpx;
  124. }
  125. }
  126. }
  127. </style>