comment.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 box-border-box" 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 box-border-box">
  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 text-overflow-ellipsis" :class="item.news_id ==0?'msg-class-tow':'msg-class'">
  17. {{item.msg}}
  18. </view>
  19. </view>
  20. <image v-if="item.news_id !=0 " 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. import {
  40. alumnInfo,
  41. } from '@/api/alumni.js';
  42. import tools from "@/service/tools";
  43. export default {
  44. components: {
  45. EnBlank
  46. },
  47. data() {
  48. return {
  49. navTitle: '',
  50. listData: [],
  51. page: 1,
  52. total: 0,
  53. dataType: ''
  54. };
  55. },
  56. onLoad(data) {
  57. if (data) {
  58. this.dataType = data.type
  59. this.messageList(data.type)
  60. if (data.type == 1) {
  61. this.navTitle = '系统消息'
  62. } else if (data.type == 2) {
  63. this.navTitle = '评论'
  64. } else {
  65. this.navTitle = '点赞'
  66. }
  67. }
  68. },
  69. mounted() {},
  70. methods: {
  71. toDet(item) {
  72. if (item.news_id > 0) {
  73. alumnInfo({
  74. news_id: item.news_id
  75. }).then((res) => {
  76. if (res.code === 1) {
  77. uni.navigateTo({
  78. url: "/pages-school/circle-info?news_id=" + item.news_id
  79. })
  80. } else {
  81. tools.error(res.msg)
  82. }
  83. })
  84. }
  85. },
  86. scrolltolower() {
  87. if (this.listData.length < this.total) {
  88. this.page += 1;
  89. this.messageList(this.dataType);
  90. }
  91. },
  92. messageList(type) {
  93. messageList({
  94. type: type,
  95. page: this.page
  96. }).then((res) => {
  97. if (res.code == 1) {
  98. if (res.data.items.length > 0) {
  99. this.listData.push(...res.data.items)
  100. this.total = res.data.total;
  101. }
  102. }
  103. })
  104. }
  105. },
  106. }
  107. </script>
  108. <style lang="scss" scoped>
  109. .msg-class{
  110. max-width: 420rpx;
  111. word-wrap: break-word;
  112. }
  113. .msg-class-tow{
  114. word-break: break-all;
  115. word-wrap: break-word;
  116. }
  117. .content-box {
  118. padding: 24rpx 24rpx 0;
  119. }
  120. .item-img {
  121. width: 80rpx;
  122. height: 80rpx;
  123. }
  124. .item-right {
  125. width: 100%;
  126. padding: 0 0 24rpx 0;
  127. border-bottom: 2rpx solid #F9F9F9;
  128. }
  129. .right-img {
  130. width: 140rpx;
  131. height: 140rpx;
  132. border-radius: 12rpx;
  133. }
  134. </style>