wangzhibo
4 天以前 10595d8632f959d0954d1939243196f4eed02372
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<template>
    <view class="comment-item">
        <view class="inner">
            <view class="user">
                <cl-avatar :size="70" :src="item.avatarUrl" />
 
                <cl-row :margin="[4, 0, 0, 20]">
                    <cl-text :size="24" block :margin="[0, 0, 4, 0]">{{ item.nickName }}</cl-text>
                    <cl-rate disabled :size="24" v-model="item.starCount" />
                </cl-row>
            </view>
 
            <cl-text
                :ellipsis="demo ? 2 : undefined"
                block
                :line-height="1.5"
                :margin="[20, 0, 0, 0]"
                >{{ item.content }}</cl-text
            >
        </view>
 
        <view class="pics" v-if="!isEmpty(item.pics)">
            <cl-image
                :size="120"
                :src="resizeImage(item.pics[0], 120)"
                :preview-list="item.pics"
                :radius="12"
            />
            <text class="num" v-if="1 || item.pics.length > 1">+{{ item.pics.length }}</text>
        </view>
    </view>
</template>
 
<script lang="ts" setup>
import { type PropType } from "vue";
import { isEmpty } from "lodash-es";
import { useUpload } from "/@/cool";
 
defineProps({
    item: {
        type: Object as PropType<Eps.GoodsCommentEntity>,
        default: () => ({}),
    },
    demo: Boolean,
});
 
const { resizeImage } = useUpload();
</script>
 
<style lang="scss" scoped>
.comment-item {
    display: flex;
 
    .inner {
        flex: 1;
 
        .user {
            display: flex;
            align-items: center;
        }
    }
 
    .pics {
        position: relative;
        margin-left: 24rpx;
 
        .num {
            position: absolute;
            top: 84rpx;
            right: 10rpx;
            font-size: 20rpx;
            background-color: rgba(0, 0, 0, 0.6);
            color: #fff;
            padding: 4rpx;
            border-radius: 6rpx;
            letter-spacing: 1rpx;
            line-height: 1;
        }
    }
}
</style>