<template>
  <view class="comment_list">
    <view class="comment_item" v-for="(item,index) in dataList" :key="index">
      <view class="comment_user_box">
        <view class="commemt-user">
          <image :src="item.member.icon || 'http://139.9.103.171:1888/img/image/avatar.png'" mode="aspectFill"></image>
          <text class="comment_name">{{item.member.username}}</text>
        </view>
        <text class="comment_time">{{item.createdDate}}</text>
      </view>
      <view class="comment_context">{{item.content}}</view>
      <view class="comment_pics">
        <image v-for="(img,idx) in item.imageUrls" :key="idx" :src="img" mode="aspectFill" @tap="tapImage(img)"></image>
      </view>
      <view class="comment_star">
        <view class="star_list">
          <block v-for="(sitem,sidx) in 5" :key="sidx">
            <image :src="sidx < item.score?'http://139.9.103.171:1888/img/image/star_selected_icon.png':'http://139.9.103.171:1888/img/image/star_no_selected_icon.png'"></image>
          </block>
        </view>
        <view class="score">{{item.score}}</view>
      </view>
      <view class="comment_sku">
        <view class="comment_sku_item" v-for="(skustr,id) in item.specifications" :key="id">
          <view class="sku_text"></view>
          <view class="sku_value">{{skustr}}</view>
        </view>
        <!-- <view class="comment_sku_item">
          <view class="sku_text">颜色：</view>
          <view class="sku_value">白色</view>
        </view> -->
      </view>
    </view>
  </view>
</template>
<script>
export default {
  props: {
    dataList: {
      type: Array,
      default: []
    }
  },
  data() {
    return {
    };
  },
  methods: {
    tapImage(img){
      this.$emit('tapImage',img)
    }
  }
};
</script>
<style lang="scss">
.comment_list {
  .comment_item {
    display: flex;
    flex-direction: column;
    padding: 0 30upx;
    border-bottom: 1upx solid #e5e5e5;
    box-sizing: border-box;
    background: #fff;
    .comment_user_box {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      padding:25upx 0 10upx;
      .commemt-user {
        display: flex;
        flex-direction: row;
        align-items: center;
        image {
          width: 60upx;
          height: 60upx;
          border-radius: 50%;
          margin-right: 20upx;
        }
        .comment_name {
          font-size: 28upx;
        }
      }
      .comment_time {
        margin-left: 20upx;
        font-size: 24upx;
        color: #888;
      }
    }
    .comment_context {
      font-size: 28upx;
      color: #333;
      overflow: hidden;
      line-height: 40upx;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      margin-top: 10upx;
      letter-spacing: 1upx;
      text-align: justify;
    }
    .comment_pics {
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      margin-top: 10upx;
      image {
        width: 188upx;
        height: 188upx;
        margin-right: 20upx;
        margin-bottom: 20upx;
      }
    }
    .comment_star {
      display: flex;
      flex-direction: row;
      align-items: center;
      .star_list {
        display: flex;
        flex-direction: row;
        align-items: center;
        image {
          width: 23upx;
          height: 23upx;
          margin-right: 10upx;
        }
      }
      .score {
        color: #999999;
        font-size: 24upx;
        margin-left: 10upx;
      }
    }

    .comment_sku {
      height: 60upx;
      line-height: 60upx;
      font-size: 24upx;
      color: #999;
      display: flex;
      flex-direction: row;
      margin-bottom: 10upx;
      .comment_sku_item {
        display: flex;
        flex-direction: row;
        align-items: center;
        margin-right: 20upx;
      }
    }
  }
  .comment_item:last-child {
    border: none;
  }
}
</style>
