comment.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view class="flex-common-css bgc-f">
  3. <Nav :title="navTitle" titleColor="#333" bgckgroundBox='#fff'></Nav>
  4. <scroll-view :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
  5. <view class="content-box box-border-box">
  6. <view class="item-box display-flex mb-26" v-for="(item,index) in listData">
  7. <image class="item-img mr-16 flex-shrink0" :src="item.head_img" mode=""></image>
  8. <view class="item-right flex-justify-space">
  9. <view class="common-view-css mr-46">
  10. <view class="mb-4 fc-3 fs-28">
  11. {{item.nickname}}
  12. </view>
  13. <view class="fs-24 fc-9 mb-16">
  14. {{item.created_date}}
  15. </view>
  16. <view class="fs-30 fc-3">
  17. {{item.msg}}
  18. </view>
  19. </view>
  20. <image class="right-img" :src="item.image[0]" mode=""></image>
  21. </view>
  22. </view>
  23. </view>
  24. <view v-if="listData.length === 0" class="scroll-view-css">
  25. <EnBlank :customSrc='true'>
  26. <template v-slot:blankImg>
  27. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  28. </template>
  29. </EnBlank>
  30. </view>
  31. </scroll-view>
  32. </view>
  33. </template>
  34. <script>
  35. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  36. import {
  37. messageList
  38. } from "@/api/message.js"
  39. export default {
  40. components: {EnBlank},
  41. data() {
  42. return {
  43. navTitle: '',
  44. listData: [],
  45. page: 1,
  46. total:0
  47. };
  48. },
  49. onLoad(data) {
  50. if (data) {
  51. this.messageList(data.type)
  52. if (data.type == 1) {
  53. this.navTitle = '系统消息'
  54. } else if (data.type == 2) {
  55. this.navTitle = '评论'
  56. } else {
  57. this.navTitle = '点赞'
  58. }
  59. }
  60. },
  61. mounted() {},
  62. methods: {
  63. scrolltolower() {
  64. if(this.listData.length < this.total){
  65. this.page += 1;
  66. this.messageList();
  67. }
  68. },
  69. messageList(type) {
  70. messageList({
  71. type: type,
  72. page: this.page
  73. }).then((res) => {
  74. if (res.code == 1) {
  75. if (res.data.items.length > 0) {
  76. this.listData.push(...res.data.items)
  77. this.total = res.data.total;
  78. }
  79. }
  80. })
  81. }
  82. },
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .content-box {
  87. padding: 24rpx 24rpx 0;
  88. }
  89. .item-img {
  90. width: 80rpx;
  91. height: 80rpx;
  92. }
  93. .item-right {
  94. width: 100%;
  95. padding: 0 0 24rpx 0;
  96. border-bottom: 2rpx solid #F9F9F9;
  97. }
  98. .right-img {
  99. width: 140rpx;
  100. height: 140rpx;
  101. border-radius: 12rpx;
  102. }
  103. </style>