liuyan.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="liuyan_content">
  3. <view class="empty" v-if="liuyan.length==0">
  4. <view class="enptyStatus">
  5. <image src="../../static/empty.png" mode=""></image>
  6. <view class="words">
  7. 暂无内容
  8. </view>
  9. </view>
  10. </view>
  11. <view class="item_wrap">
  12. <view class="item" v-for="(item,index) in liuyan" :key="index">
  13. <image :src="item.user?item.user.headimg:''" mode=""></image>
  14. <view class="info">
  15. <view class="info_top">
  16. <view class="name">
  17. {{ item.user ? item.user.name : '--' }}
  18. </view>
  19. <view class="time">
  20. {{ item.created_at.split(' ')[0] }}
  21. </view>
  22. </view>
  23. <view class="info_content">
  24. {{item.body}}
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. liuyan:[],
  36. tea_id:'',
  37. page: 1,
  38. last :false
  39. }
  40. },
  41. async onLoad(options) {
  42. this.tea_id = options.tea_id
  43. this.get_liuyan()
  44. },
  45. onReachBottom() {
  46. if (!this.last) {
  47. this.page++
  48. }
  49. console.log(this.page)
  50. this.get_liuyan()
  51. },
  52. methods: {
  53. // 留言列表
  54. get_liuyan() {
  55. let params = {
  56. // teacher_id:this.tea_id,
  57. page:this.page
  58. }
  59. this.$u.get('/mentor/leave-message', params).then(res => {
  60. console.log(res, 'liuyan')
  61. // this.liuyan = res.data.list
  62. let data = res.data.list
  63. if (this.page > 1 && data.length == 0) {
  64. uni.showToast({
  65. title: '暂无更多',
  66. icon: 'none'
  67. })
  68. this.last = true
  69. } else {
  70. this.liuyan = this.liuyan.concat(data)
  71. }
  72. // this.page.total = res.data.meta.pagination.total
  73. })
  74. },
  75. }
  76. }
  77. </script>
  78. <style lang="scss">
  79. .liuyan_content{
  80. padding: 16px;
  81. .enptyStatus{
  82. display: flex;
  83. justify-content: center;
  84. align-items: center;
  85. flex-direction: column;
  86. padding: 30px 10px;
  87. image{
  88. width: 120px;
  89. height: 150px;
  90. margin-top: 100px;
  91. }
  92. .words{
  93. color: #ffae21;
  94. font-size: 18px;
  95. padding-top: 18px;
  96. }
  97. }
  98. .item_wrap{
  99. .item{
  100. display: flex;
  101. padding: 8px 0 0;
  102. border-bottom: 1px solid #f6f8f9;
  103. image{
  104. width: 32px;
  105. height: 32px;
  106. border-radius: 50%;
  107. margin-right: 10px;
  108. flex-shrink: 0;
  109. }
  110. .info{
  111. padding-bottom: 8px;
  112. width: calc(100% - 42px);
  113. .info_top{
  114. width: 100%;
  115. display: flex;
  116. justify-content: space-between;
  117. }
  118. .name{
  119. font-size: 14px;
  120. color: #333333;
  121. margin-bottom: 4px;
  122. line-height: 20px;
  123. }
  124. .info_content{
  125. line-height: 22px;
  126. font-size: 14px;
  127. color: #666;
  128. margin-bottom: 5px;
  129. text-align: justify;
  130. word-break:break-all
  131. }
  132. .time{
  133. color: #999;
  134. font-size: 13px;
  135. }
  136. .huifu_wrap{
  137. background-color: #f4f4f4;
  138. padding: 10px;
  139. margin-top: 10px;
  140. .huifu{
  141. margin-bottom: 10px;
  142. text{
  143. color: #333333;
  144. }
  145. .huifu_name{
  146. color: #909399;
  147. }
  148. }
  149. }
  150. }
  151. }
  152. }
  153. }
  154. </style>