liuyan.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. type:1
  59. }
  60. this.$u.get('/mentor/leave-message', params).then(res => {
  61. console.log(res, 'liuyan')
  62. // this.liuyan = res.data.list
  63. let data = res.data.list
  64. if (this.page > 1 && data.length == 0) {
  65. uni.showToast({
  66. title: '暂无更多',
  67. icon: 'none'
  68. })
  69. this.last = true
  70. } else {
  71. this.liuyan = this.liuyan.concat(data)
  72. }
  73. // this.page.total = res.data.meta.pagination.total
  74. })
  75. },
  76. }
  77. }
  78. </script>
  79. <style lang="scss">
  80. .liuyan_content{
  81. padding: 16px;
  82. .enptyStatus{
  83. display: flex;
  84. justify-content: center;
  85. align-items: center;
  86. flex-direction: column;
  87. padding: 30px 10px;
  88. image{
  89. width: 120px;
  90. height: 150px;
  91. margin-top: 100px;
  92. }
  93. .words{
  94. color: #ffae21;
  95. font-size: 18px;
  96. padding-top: 18px;
  97. }
  98. }
  99. .item_wrap{
  100. .item{
  101. display: flex;
  102. padding: 8px 0 0;
  103. border-bottom: 1px solid #f6f8f9;
  104. image{
  105. width: 32px;
  106. height: 32px;
  107. border-radius: 50%;
  108. margin-right: 10px;
  109. flex-shrink: 0;
  110. }
  111. .info{
  112. padding-bottom: 8px;
  113. width: calc(100% - 42px);
  114. .info_top{
  115. width: 100%;
  116. display: flex;
  117. justify-content: space-between;
  118. }
  119. .name{
  120. font-size: 14px;
  121. color: #333333;
  122. margin-bottom: 4px;
  123. line-height: 20px;
  124. }
  125. .info_content{
  126. line-height: 22px;
  127. font-size: 14px;
  128. color: #666;
  129. margin-bottom: 5px;
  130. text-align: justify;
  131. word-break:break-all
  132. }
  133. .time{
  134. color: #999;
  135. font-size: 13px;
  136. }
  137. .huifu_wrap{
  138. background-color: #f4f4f4;
  139. padding: 10px;
  140. margin-top: 10px;
  141. .huifu{
  142. margin-bottom: 10px;
  143. text{
  144. color: #333333;
  145. }
  146. .huifu_name{
  147. color: #909399;
  148. }
  149. }
  150. }
  151. }
  152. }
  153. }
  154. }
  155. </style>