message.vue 2.4 KB

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