comment-item.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view>
  3. <view class="user ss-flex ss-m-b-14">
  4. <view class="ss-m-r-20 ss-flex">
  5. <image class="avatar" :src="sheep.$url.cdn(item.user_avatar)"></image>
  6. </view>
  7. <view class="nickname ss-m-r-20">
  8. {{ item.user_nickname }}
  9. </view>
  10. <view class="">
  11. <uni-rate :readonly="true" v-model="item.level" size="18" />
  12. </view>
  13. </view>
  14. <view class="content">
  15. {{ item.content }}
  16. </view>
  17. <view class="ss-m-t-24" v-if="item.images?.length">
  18. <scroll-view class="scroll-box" scroll-x scroll-anchoring>
  19. <view class="ss-flex">
  20. <view v-for="(item, index) in item.images" :key="item" class="ss-m-r-10">
  21. <su-image
  22. class="content-img"
  23. isPreview
  24. :previewList="state.commentImages"
  25. :current="index"
  26. :src="item"
  27. :height="120"
  28. :width="120"
  29. mode="aspectFill"
  30. ></su-image>
  31. </view>
  32. </view>
  33. </scroll-view>
  34. </view>
  35. <view class="ss-m-t-20 reply-box" v-if="item.reply_time">
  36. <view class="reply-title">商家回复</view>
  37. <view class="reply-content">{{ item.reply_content }}</view>
  38. </view>
  39. </view>
  40. </template>
  41. <script setup>
  42. import sheep from '@/sheep';
  43. import { reactive } from 'vue';
  44. const props = defineProps({
  45. item: {
  46. type: Object,
  47. default() {},
  48. },
  49. });
  50. const state = reactive({
  51. commentImages: [],
  52. });
  53. props.item.images?.forEach((i) => {
  54. state.commentImages.push(sheep.$url.cdn(i));
  55. });
  56. </script>
  57. <style lang="scss" scoped>
  58. .avatar {
  59. width: 52rpx;
  60. height: 52rpx;
  61. border-radius: 50%;
  62. }
  63. .nickname {
  64. font-size: 26rpx;
  65. font-weight: 500;
  66. color: #999999;
  67. }
  68. .content {
  69. width: 636rpx;
  70. font-size: 26rpx;
  71. font-weight: 400;
  72. color: #333333;
  73. }
  74. .reply-box {
  75. position: relative;
  76. }
  77. .reply-title {
  78. position: absolute;
  79. left: 0;
  80. top: 0;
  81. font-weight: 600;
  82. font-size: 26rpx;
  83. line-height: 40rpx;
  84. color: #666666;
  85. }
  86. .reply-content {
  87. text-indent: 108rpx;
  88. font-weight: 400;
  89. font-size: 26rpx;
  90. line-height: 40rpx;
  91. color: #333333;
  92. }
  93. </style>