ld-comment.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view class="ct-list">
  3. <view
  4. class="ct-item u-border-one-one pd40"
  5. v-for="(v, i) in value"
  6. :key="i"
  7. >
  8. <view>
  9. <view class="u-flex-center-sba">
  10. <view class="u-flex">
  11. <image
  12. class="u-avatar83"
  13. v-if="v.userAvatar"
  14. :src="v.userAvatar"
  15. ></image>
  16. <image class="u-avatar83" v-else :src="$defaultAvata"></image>
  17. <view class="u-font28 u-1A1A1A u-ml20 avatar-start">
  18. <view class="u-text-width">{{ v.userNickname || "" }}</view>
  19. <view class="comment-start">
  20. <!-- <text v-for="(item,index) in 5" :key="index" class="iconfont2" :class="v.commentScore >=item?'grade-active':'u-B3B3B3'" style="font-size: 35rpx;margin-right: 11.5rpx;">&#xe60f;</text> -->
  21. <uv-rate
  22. :count="5"
  23. v-model="v.commentScore"
  24. readonly
  25. activeColor="#ffc336"
  26. inactiveColor="#B3B3B3"
  27. size="35rpx"
  28. gutter="4rpx"
  29. ></uv-rate>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="u-font24 u-999 time">{{ v.commentTime }}</view>
  34. </view>
  35. <view class="ml100">
  36. <view style="margin-top: 10rpx" class="u-font28 u-999">{{
  37. v.comment
  38. }}</view>
  39. <view class="u-mt15 ctImg" v-if="v.commentImages">
  40. <image
  41. class="u-ctImg180"
  42. v-for="(imgItem, index) in v.commentImages"
  43. :key="index"
  44. :src="imgItem"
  45. mode=""
  46. @click.stop="previewImage(v.commentImages, index)"
  47. ></image>
  48. </view>
  49. </view>
  50. </view>
  51. <view v-if="v.reply && v.reply.content">
  52. <view class="ml100">
  53. <view class="u-font28 u-999">商家回复:{{ v.reply.content }}</view>
  54. </view>
  55. </view>
  56. </view>
  57. <view v-if="value.length == 0">
  58. <view class="no-data">
  59. <image :src="$handleImageUrl('/nodata.png')"></image>
  60. <div>暂无评价~</div>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <script setup name="ld-comment">
  66. import { ref, watch } from "vue";
  67. const props = defineProps({
  68. value: {
  69. type: Array,
  70. default: function () {
  71. return [];
  72. },
  73. },
  74. });
  75. const gradeNum = ref(3);
  76. const dealImg = (v) => {
  77. let result = [];
  78. if (v) {
  79. result = v.split(",");
  80. }
  81. return result;
  82. };
  83. const previewImage = (imgList, index) => {
  84. uni.previewImage({
  85. urls: imgList,
  86. current: index,
  87. });
  88. };
  89. </script>
  90. <style lang="scss">
  91. .u-flex-center-sba {
  92. display: flex;
  93. flex-direction: row;
  94. // align-items: center;
  95. justify-content: space-between;
  96. }
  97. .avatar-start {
  98. display: flex;
  99. height: 83rpx;
  100. flex-direction: column;
  101. justify-content: space-between;
  102. }
  103. .comment-start {
  104. // margin-top: 20rpx;
  105. }
  106. .time {
  107. font-size: 24rpx;
  108. }
  109. .ml100 {
  110. margin-left: 100rpx;
  111. }
  112. .pd40 {
  113. padding-top: 40rpx;
  114. padding-bottom: 40rpx;
  115. }
  116. .ctImg image:not(:nth-child(3n)) {
  117. margin-right: 10rpx;
  118. }
  119. .grade-active {
  120. color: #ffc336;
  121. }
  122. .u-B3B3B3 {
  123. color: #b3b3b3;
  124. }
  125. .no-data {
  126. text-align: center;
  127. padding: 20rpx 0;
  128. color: #999999;
  129. }
  130. .no-data image {
  131. width: 430rpx;
  132. height: 278rpx;
  133. }
  134. .u-avatar83 {
  135. width: 83rpx;
  136. height: 83rpx;
  137. border-radius: 50%;
  138. }
  139. </style>