<template>
  <view>
    <view v-for="(item,index) in list" @click="click(item,index)"
          :key="index"
          :class="activeIndex === index ? 'item--active' : ''"
          class="item u-border u-p-60 u-m-b-40 border-radius-14">
      <image
          class="icon"
          :src="activeIndex === index ? item.activeImgSrc : item.imgSrc" mode="fill"></image>
      <view>
        <view class="item-title">{{item.title}}</view>
        <view class="item-desc">{{item.desc}}</view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: "UserSelect",
  props:{
    list:{
      type: Array,
      default: () => []
    }
  },
  data(){
    return {
      activeIndex: null,
    }
  },
  methods:{
    click(row,index){
      this.activeIndex = index;
      this.$emit("change", index+1);
    }
  }
}
</script>

<style scoped lang="scss">
$active:#0663FF;
$mainColor: #333333;
$subColor: #666666;
.u-border:after{

  border-radius: 28rpx;
}
.border-radius-14{
  border-radius: 28rpx;
}
.item{
  height: 200rpx;
  display: flex;
  justify-content: center;
  align-items: center;
  &-title{
    font-size: 32rpx;
    margin-bottom: 4rpx;
    color: $mainColor;
  }
  &-desc{
    font-size: 24rpx;
    color: $subColor;
  }
  &--active{
    border: 1px solid $active;
    .item-title{
      color: $active;
    }
  }
}
.icon{
  width: 80rpx;
  height: 80rpx;
  margin-right: 96rpx;
}
.shadow{
  box-shadow: 4rpx 28rpx 0px rgba(0, 0, 0, 0.10);
  &.active{
    box-shadow: none;
    border: 1px solid $active;
  }
}
.active{
  color: $active;
}
</style>