comment.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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" @click="toDet(item)">
  7. <image class="item-img mr-16 flex-shrink0" :src="item.head_img" mode="aspectFill"></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="aspectFill"></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: {
  41. EnBlank
  42. },
  43. data() {
  44. return {
  45. navTitle: '',
  46. listData: [],
  47. page: 1,
  48. total: 0
  49. };
  50. },
  51. onLoad(data) {
  52. if (data) {
  53. this.messageList(data.type)
  54. if (data.type == 1) {
  55. this.navTitle = '系统消息'
  56. } else if (data.type == 2) {
  57. this.navTitle = '评论'
  58. } else {
  59. this.navTitle = '点赞'
  60. }
  61. }
  62. },
  63. mounted() {},
  64. methods: {
  65. toDet(item) {
  66. if (item.news_id > 0) {
  67. uni.navigateTo({
  68. url: "/pages-school/circle-info?news_id=" + item.news_id
  69. })
  70. }
  71. },
  72. scrolltolower() {
  73. if (this.listData.length < this.total) {
  74. this.page += 1;
  75. this.messageList();
  76. }
  77. },
  78. messageList(type) {
  79. messageList({
  80. type: type,
  81. page: this.page
  82. }).then((res) => {
  83. if (res.code == 1) {
  84. if (res.data.items.length > 0) {
  85. this.listData.push(...res.data.items)
  86. this.total = res.data.total;
  87. }
  88. }
  89. })
  90. }
  91. },
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. .content-box {
  96. padding: 24rpx 24rpx 0;
  97. }
  98. .item-img {
  99. width: 80rpx;
  100. height: 80rpx;
  101. }
  102. .item-right {
  103. width: 100%;
  104. padding: 0 0 24rpx 0;
  105. border-bottom: 2rpx solid #F9F9F9;
  106. }
  107. .right-img {
  108. width: 140rpx;
  109. height: 140rpx;
  110. border-radius: 12rpx;
  111. }
  112. </style>