messageList.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view class="container">
  3. <scroll-view class="message-list-box" scroll-y="true" @scrolltolower="handleLoadMore()">
  4. <view class="message-row" v-for="(item, index1) in messageList" :key="index1">
  5. <cover-image class="message-head" :src="item.headImg"></cover-image>
  6. <view class="message-info-box">
  7. <view class="message-name">{{item.userName}}</view>
  8. <view class="message-date">{{item.leaMsgTime}}</view>
  9. <view class="message-text">{{item.leaMsgContent}}</view>
  10. <view class="message-img-box" v-for="(site, index2) in item.orderLeaImgResVOs" :key="index2">
  11. <cover-image class="message-img" :src="site.imgUrl"></cover-image>
  12. </view>
  13. </view>
  14. </view>
  15. </scroll-view>
  16. <view class="message-handle">
  17. <u-button type="success" shape="circle" :ripple="true" @click="addMessage" class="handle-custom">发布留言</u-button>
  18. </view>
  19. <u-top-tips ref="uTips"></u-top-tips>
  20. </view>
  21. </template>
  22. <script>
  23. const NET = require('@/utils/request')
  24. const API = require('@/config/api')
  25. export default {
  26. data() {
  27. return {
  28. orderId: '',
  29. tenantCode: '',
  30. pageIndex: 1,
  31. isOver: false,
  32. messageList: [],
  33. }
  34. },
  35. onLoad(options) {
  36. this.orderId = options.orderId
  37. this.tenantCode = options.tenantCode
  38. },
  39. onShow() {
  40. this.getMessageList()
  41. },
  42. methods: {
  43. // 懒加载
  44. handleLoadMore() {
  45. if (!this.isOver) {
  46. this.pageIndex++
  47. this.getMessageList()
  48. }
  49. },
  50. // 获取全部留言
  51. getMessageList() {
  52. NET.request(API.getMessageList + this.pageIndex + '/10', {
  53. flag: 1,
  54. orderId: this.orderId
  55. }, 'GET').then(res => {
  56. this.isOver = res.data.list.length != 10
  57. this.messageList = this.messageList.concat(res.data.list)
  58. }).catch(error => {
  59. this.$refs.uTips.show({
  60. title: error.data.msg,
  61. type: 'warning',
  62. })
  63. })
  64. },
  65. // 新增留言
  66. addMessage() {
  67. uni.navigateTo({
  68. url: '/pagesMain/messageForm?orderId=' + this.orderId + '&tenantCode=' + this.tenantCode
  69. });
  70. },
  71. }
  72. }
  73. </script>
  74. <style lang="less" scoped>
  75. page {
  76. width: 100%;
  77. height: 100%;
  78. }
  79. .container {
  80. width: 100%;
  81. height: 100%;
  82. float: left;
  83. position: relative;
  84. .message-list-box {
  85. width: 100%;
  86. height: calc(100% - 70px);
  87. float: left;
  88. .message-row {
  89. width: calc(100% - 30px);
  90. float: left;
  91. padding-bottom: 15px;
  92. border-bottom: 1px solid #F6F6F6;
  93. margin: 0 15px 15px 15px;
  94. .message-head {
  95. width: 50px;
  96. height: 50px;
  97. object-fit: cover;
  98. float: left;
  99. border-radius: 50%;
  100. overflow: hidden;
  101. }
  102. .message-info-box {
  103. width: calc(100% - 75px);
  104. float: right;
  105. .message-name {
  106. width: 50%;
  107. height: 30px;
  108. float: left;
  109. font-size: 15px;
  110. font-family: PingFang SC;
  111. color: #333333;
  112. line-height: 30px;
  113. overflow: hidden;
  114. text-overflow: ellipsis;
  115. white-space: nowrap;
  116. }
  117. .message-date {
  118. width: 50%;
  119. height: 30px;
  120. float: left;
  121. font-size: 12px;
  122. font-family: PingFang SC;
  123. color: #666666;
  124. text-align: right;
  125. line-height: 30px;
  126. overflow: hidden;
  127. text-overflow: ellipsis;
  128. white-space: nowrap;
  129. }
  130. .message-text {
  131. width: 100%;
  132. height: 20px;
  133. float: left;
  134. font-size: 12px;
  135. font-family: PingFang SC;
  136. color: #666666;
  137. line-height: 20px;
  138. overflow: hidden;
  139. text-overflow: ellipsis;
  140. white-space: nowrap;
  141. }
  142. .message-img-box {
  143. width: 100%;
  144. float: left;
  145. .message-img {
  146. width: 76px;
  147. height: 76px;
  148. object-fit: cover;
  149. float: left;
  150. margin: 0 10px 10px 0;
  151. }
  152. }
  153. }
  154. }
  155. }
  156. .message-handle {
  157. width: calc(100% - 30px);
  158. height: 40px;
  159. position: fixed;
  160. bottom: 20px;
  161. left: 15px;
  162. .handle-custom {
  163. background-color: #51A539;
  164. }
  165. }
  166. }
  167. </style>