小说小程序前端代码仓库(小程序)
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.

145 lines
2.5 KiB

  1. <template>
  2. <view class="comment-card">
  3. <uv-avatar :src="item.hanHaiMember.headImage" size="44" shape="circle" class="avatar" />
  4. <view class="comment-main">
  5. <view class="comment-header">
  6. <text class="username">{{ item.hanHaiMember.nickName }}</text>
  7. <text class="from">来自{{ item.commonShop.name }}</text>
  8. </view>
  9. <view class="comment-content">{{ item.comment }}</view>
  10. <view class="comment-footer">
  11. <text class="comment-time">{{ item.createTime }}</text>
  12. <view class="reply-btn-wrap"
  13. v-if="edit"
  14. @click="deleteItem(item)">
  15. <text class="reply-btn">删除</text>
  16. </view>
  17. <view class="reply-btn-wrap"
  18. v-else
  19. @click="goToReply(item)">
  20. <text class="reply-btn">回复</text>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. props: ['item', 'edit'],
  29. data() {
  30. return {
  31. }
  32. },
  33. methods: {
  34. goToReply(item) {
  35. // this.$fetch('updateCommentRead', {
  36. // commentId : item.id,
  37. // })
  38. uni.navigateTo({
  39. url: '/pages_order/comment/respondComments?id=' + item.id
  40. })
  41. },
  42. deleteItem(item){
  43. uni.showModal({
  44. title : '确认删除该评论吗',
  45. success : (r) => {
  46. if (r.confirm) {
  47. this.$fetch('deleteComment', {
  48. commentId : item.id,
  49. }).then(res => {
  50. this.$emit('getData')
  51. })
  52. }
  53. }
  54. })
  55. },
  56. }
  57. }
  58. </script>
  59. <style scoped lang="scss">
  60. .comment-card {
  61. display: flex;
  62. align-items: flex-start;
  63. margin-bottom: 32rpx;
  64. .avatar {
  65. width: 56rpx;
  66. height: 56rpx;
  67. border-radius: 50%;
  68. margin-right: 16rpx;
  69. flex-shrink: 0;
  70. }
  71. .comment-main {
  72. flex: 1;
  73. display: flex;
  74. flex-direction: column;
  75. margin-left: 10rpx;
  76. }
  77. .comment-header {
  78. display: flex;
  79. align-items: center;
  80. gap: 12rpx;
  81. margin-bottom: 4rpx;
  82. }
  83. .username {
  84. font-size: 26rpx;
  85. color: #222;
  86. font-weight: 500;
  87. }
  88. .from {
  89. font-size: 22rpx;
  90. color: #bdbdbd;
  91. }
  92. .comment-content {
  93. font-size: 26rpx;
  94. color: #333;
  95. margin-bottom: 12rpx;
  96. }
  97. .comment-footer {
  98. display: flex;
  99. align-items: center;
  100. font-size: 22rpx;
  101. color: #bdbdbd;
  102. justify-content: space-between;
  103. padding-right: 8rpx;
  104. }
  105. .comment-time {
  106. color: #bdbdbd;
  107. }
  108. .reply-btn-wrap {
  109. display: flex;
  110. align-items: center;
  111. cursor: pointer;
  112. }
  113. .reply-btn {
  114. color: #223a6b;
  115. font-weight: 500;
  116. margin-left: 0;
  117. font-size: 24rpx;
  118. }
  119. .history-section {
  120. margin-top: 24rpx;
  121. }
  122. }
  123. </style>