messageDetail.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="center">
  3. <view class="message">
  4. <view class="item" v-for="l in list" @click="look(l.cate_id)">
  5. <view class="img"><image :src="type.image" mode=""></image></view>
  6. <view class="right">
  7. <view class="top">
  8. <view class="title">{{ type.name }}</view>
  9. <view class="time">{{ l.add_time }}</view>
  10. </view>
  11. <view class="bottom">
  12. <view class="concent clamp2">{{ l.detail }}</view>
  13. <view class="icon" v-show="l.unwatch_message > 0"></view>
  14. </view>
  15. </view>
  16. </view>
  17. <uni-load-more :status="loadingType"></uni-load-more>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import { getTime } from '@/utils/rocessor.js';
  23. import { message } from '@/api/finance.js';
  24. import uniLoadMore from '@/uview-ui/components/u-loadmore/u-loadmore.vue';
  25. export default {
  26. components: {
  27. uniLoadMore
  28. },
  29. data() {
  30. return {
  31. id: '',
  32. page: 1,
  33. limit: 10,
  34. list: [],
  35. type: {},
  36. loadingType: 'more'
  37. };
  38. },
  39. onLoad(option) {
  40. if (option.id) {
  41. this.id = option.id;
  42. }
  43. this.loadData();
  44. },
  45. //监听页面是否滚动到底部加载更多
  46. onReachBottom() {
  47. this.loadData();
  48. },
  49. methods: {
  50. loadData() {
  51. const obj = this;
  52. if (obj.loadingType == 'nomore' || obj.loadingType == 'loading') {
  53. return;
  54. }
  55. obj.loadingType == 'loading';
  56. message({ page: obj.page, limit: obj.limit }, obj.id).then(({ data }) => {
  57. console.log(data);
  58. if (obj.page == 1) {
  59. obj.type = data.cate;
  60. }
  61. data.list.forEach(e => {
  62. e.add_time = getTime(e.add_time);
  63. });
  64. obj.list = obj.list.concat(data.list);
  65. obj.page++;
  66. if (data.list.length == obj.limit) {
  67. obj.loadingType == 'more';
  68. } else {
  69. obj.loadingType == 'nomore';
  70. }
  71. });
  72. }
  73. }
  74. };
  75. </script>
  76. <style lang="scss">
  77. .center,
  78. page {
  79. height: 100%;
  80. width: 100%;
  81. background: #f8f8f8;
  82. }
  83. .message {
  84. margin-top: 20rpx;
  85. font-family: PingFangSC-Medium;
  86. .item {
  87. background-color: #fff;
  88. display: flex;
  89. padding: 30rpx;
  90. width: 100%;
  91. border-bottom: solid 1rpx #f8f8f8;
  92. .img {
  93. margin: auto 0;
  94. width: 110rpx;
  95. margin-left: 0rpx;
  96. image {
  97. width: 80rpx;
  98. height: 80rpx;
  99. }
  100. }
  101. .right {
  102. width: calc(100% - 110rpx);
  103. display: grid;
  104. align-content: space-between;
  105. .top {
  106. display: flex;
  107. justify-content: space-between;
  108. .title {
  109. color: #000;
  110. font-size: 30rpx;
  111. }
  112. .time {
  113. color: #999999;
  114. font-size: 25rpx;
  115. }
  116. }
  117. .bottom {
  118. display: flex;
  119. justify-content: space-between;
  120. .concent {
  121. width: calc(100% - 30rpx);
  122. color: #999999;
  123. font-size: 26rpx;
  124. }
  125. .icon {
  126. margin: auto 0;
  127. width: 10rpx;
  128. height: 10rpx;
  129. background-color: #fb555c;
  130. border-radius: 50%;
  131. }
  132. }
  133. }
  134. }
  135. }
  136. </style>