<template>
    <view>
		<!-- 展示所有数据 -->
        <view v-if="evalArr.length!=0" class="borbot padding20 bacb" v-for="(item,index) in evalArr" :key="index">
            <view class="disac">
                <image style="width: 70rpx; height: 70rpx;border-radius: 100%;" :src="item.src" mode=""></image>
                <view class="margin-z20">
                    <view class="fon28">{{item.name}}</view>
                    <rate :size="24" :gutter="10" :value="item.xingj" :readonly="true"></rate>
                   <!-- <view>
                        <image style="width: 162rpx;height: 23rpx;" :src="item.xingj" mode=""></image>
                    </view> -->
                </view>
            </view>
            <view :class="isShow ? '':'clips2'" class="fon28 margin-s10 " style="color: #686868;">{{item.content}}</view>
            <view v-if="isEval">
                <scroll-view scroll-x="true">
                    <view class="disac margin-sx10">
                        <block v-for="(itemimg,indeximg) in item.imgList" :key="indeximg">
                            <image @tap="previewImg(indeximg,item.imgList)" class="margin-y20 flexs radius10" style="width: 200rpx;height: 200rpx;" :src="itemimg.src" mode=""></image>
                        </block>
                    </view>
                </scroll-view>
            </view>
            <view class="fon26 disac margin-s10" style="color: #949494;">
                <view class="clips1">{{item.title}}</view>
                <view class="margin-z20 flexs">{{item.time}}</view>
            </view>
        </view>
		<view v-if="evalArr.length==0 && isShow==true" class="zanwu">暂无更多该商品评论信息</view>
    </view>
</template>

<script>
    import rate from '@/components/rate.vue';
    export default {
        components:{
            rate
        },
        props:{
            evalArr:{
                type:Array,
                default:function(){
                    return []
                }
            },
            isEval:{//是否显示评论图片
                type:Boolean,
                default:false
            },
			isShow:{
				type:Boolean,
				default:true
			},
			len:{
				type:Number,
				default:0
				
			}
        },
        data() {
            return {
                rateNum:5
            };
        },
        methods:{
            // 预览图片多张
            previewImg(index,arr) {
                let _this = this;
                let imgsArray = [];
                for (let i = 0; i < arr.length; i++) {
                    if (arr[i].src!= '') {
                        imgsArray.push(arr[i].src);
                    }
                }
                uni.previewImage({
                    current: index,
                    urls: imgsArray,
                    indicator: 'number',
                    loop: true
                });
            },
        }
    }
</script>

<style>

</style>
