comment-item.vue 2.1 KB

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