小说小程序前端代码仓库(小程序)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.5 KiB

  1. <template>
  2. <view class="my-comment-page">
  3. <navbar title="我的评论" :leftClick="true" @leftClick="goBack" />
  4. <view class="comment-section">
  5. <view class="section-title">未读评论·{{ unreadComments.length }}</view>
  6. <myCommentItem :item="item" v-for="(item, idx) in unreadComments" :key="idx"/>
  7. <uv-empty mode="list" v-if="unreadComments.length == 0"></uv-empty>
  8. </view>
  9. <view class="comment-section history-section">
  10. <view class="section-title">历史评论</view>
  11. <!-- <view v-for="(item, idx) in list" :key="idx" class="comment-card">
  12. <uv-avatar :src="item.hanHaiMember.headImage" size="44" shape="circle" class="avatar" />
  13. <view class="comment-main">
  14. <view class="comment-header">
  15. <text class="username">{{ item.hanHaiMember.nickName }}</text>
  16. <text class="from">来自{{ item.commonShop.name }}</text>
  17. </view>
  18. <view class="comment-content">{{ item.comment }}</view>
  19. <view class="comment-footer">
  20. <text class="comment-time">{{ item.createTime }}</text>
  21. <view class="reply-btn-wrap" @click="goToReply(item)">
  22. <text class="reply-btn">回复</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view> -->
  27. <uv-empty mode="list" v-if="list.length == 0"></uv-empty>
  28. <myCommentItem :item="item" v-for="(item, idx) in list" :key="idx"/>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import mixinsList from '@/mixins/list.js'
  34. import myCommentItem from '../components/comment/myCommentItem.vue'
  35. export default {
  36. mixins: [mixinsList],
  37. components: {
  38. myCommentItem,
  39. },
  40. data() {
  41. return {
  42. mixinsListApi : 'getMyCommentList',
  43. unreadComments: [],
  44. }
  45. },
  46. onLoad() {
  47. this.queryParams.type = 'Y'
  48. },
  49. onShow() {
  50. this.getList()
  51. },
  52. methods: {
  53. //获取未读
  54. getList(){
  55. this.$fetch('getMyCommentList', {
  56. type : 'N',
  57. pageNo: 1,
  58. pageSize: 100000
  59. }).then(res => {
  60. this.unreadComments = res.records
  61. this.unreadComments.forEach(n => {
  62. this.updateCommentRead(n.id)
  63. })
  64. })
  65. },
  66. updateCommentRead(commentId){
  67. this.$fetch('updateCommentRead', {
  68. commentId
  69. })
  70. },
  71. }
  72. }
  73. </script>
  74. <style scoped lang="scss">
  75. .my-comment-page {
  76. min-height: 100vh;
  77. background: #f8f8f8;
  78. display: flex;
  79. flex-direction: column;
  80. }
  81. .comment-section {
  82. background: #fff;
  83. margin: 24rpx 24rpx 0 24rpx;
  84. border-radius: 16rpx;
  85. padding: 24rpx 24rpx 0 24rpx;
  86. margin-bottom: 24rpx;
  87. }
  88. .section-title {
  89. color: #222;
  90. font-size: 28rpx;
  91. font-weight: 500;
  92. margin-bottom: 16rpx;
  93. }
  94. </style>