<script setup lang="ts" name="SeriesConnection">
import {
  ref,
  computed,
  onBeforeMount,
} from "vue";
import noData from "@/components/NoData.vue";


interface ProposalListProps {
  yiqiu_id: string
  zq_coin: number
  expertsList: any[]
}

// $emits
// $emits

// $props
const props = withDefaults(defineProps<ProposalListProps>(), {
  expertsList: () => []
});
// $props

// $data
const loading = ref<boolean>(false);
// $data

// $computed
const experts_list = computed(() => props?.expertsList);
// $computed

// $watch

// $watch

// $methods

const goDetail = ({type1,exporter_safe_code ,type3}:any) => {
  if(type1 == '胜平负'){
    location.href=`/jczq/scheme-${exporter_safe_code}-${type3}?zq&from_vue`;
  }else if(type1 == '2串1计划'){
    location.href=`/model/crosstalk_list/${exporter_safe_code}?zq&from_vue`;
  }else if(type1 == '方案'){
    location.href=`/jczq/scheme2-${exporter_safe_code}-${type3}?zq&from_vue`;
  }
}
// $methods

// $lifecycle
onBeforeMount(() => {
})
// $lifecycle
</script>

<template>
  <div class="series-connection-component">
    <div v-if="yiqiu_id">
    <div class="expert_main" style="padding: 10px">
      <div class="hero-content-list" v-if="experts_list.length">
        <div class="hero-match" v-for="item in experts_list" :key="item.exporter_safe_code">
          <div class="match-list" @click="goDetail({type1: item.type1,exporter_safe_code:item.exporter_safe_code ,type3:item.type3})">
            <div class="list-top">
              <div class="icon">
                  <img v-lazy="item.exporter_face_image ? item.exporter_face_image : 'https://img2.ydniu.com/app/images/default_user.png'"
                    onerror="this.src='https:\/\/img2.ydniu.com/app/images/default_user.png';this.onerror=null" />
                  <div class="tj_num" v-if="item.tj_num">
                    {{ item.tj_num ? item.tj_num : 1 }}
                  </div>
              </div>
              <div class="list-top-center">
                  <div class="name">
                    {{ item.exporter_nick_name ? item.exporter_nick_name : '' }}
                  </div>
                  <div class="record">
                    <span>
                      近{{ item.current_hit && item.current_hit[0] ? item.current_hit[0] : '' }}红{{ item.current_hit && item.current_hit[1] ? item.current_hit[1] : '' }}
                    </span>
                    <span v-if="item.current_win_count > 2">{{ item.current_win_count ? item.current_win_count : '' }}连红</span>
                  </div>
                </div>
            </div>
            <div class="list-center" v-if="item.top_10_result">
              <div class="list-center-title">
                <span>近期:</span>
              </div>
              <div class="list-type-list" v-for="(result, index) in JSON.parse(item.top_10_result)" :key="index">
                <span class="list-red" v-if="result == 1">W</span>
                <span class="list-black" v-else>L</span>
              </div>
            </div>
            <div class="list-bottom">
              <div class="list-match">
                <span>{{item.type1}}</span>
                <span>今日基本面解读推荐！</span>
              </div>
              <div class="cost"><img v-lazy="{src:'https://img2.ydniu.com/app/images/sports_ydniu/model/ic_lock.png'}"/><span>{{ zq_coin }}牛宝解锁</span></div>
            </div>
          </div>
        </div>
      </div>
      <div v-show="loading">
        <div v-for="i in [1,2,3]" :key="i" class="skeletion-div">
          <van-skeleton title avatar :row="3" />
        </div>
     </div>
    </div>
    </div>
    <noData v-if="!experts_list.length" nodata_message="暂无数据！"></noData>
  </div>
</template>

<style lang="scss">
@use '@/common/style/common' as *;

.series-connection-component {
  background-color: #fff;
}

.skeletion-div{
  width: 100%;
  padding: 10px;
  background: #fff;
  border-radius: 10px;
  margin-bottom: 10px;
}

/* 战绩英雄 */
.match-tab {
  width: 100%;
  padding: 10px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  align-items: center;
  justify-content: space-between;

  .tab-name {
    font-size: 16px;
    font-weight: 500;
  }

  .tab-sel {
    color: var(--color-999999);
    text-align: center;
    justify-content: center;

    .around {
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      padding: 1px;
      box-sizing: border-box;
      background: #E7EEF7;
      @include border-radius(15px);
      overflow: hidden;
    }

    .around-p {
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      color: #777777;
      line-height: 30px;
      width: 60px;
      margin: 2px 3px;
    }

    .active-p {
      background: #fff;
      color: #227AFF;
      box-shadow: 0px 1 4px 0px rgba(34, 122, 255, 0.3);
      @include border-radius(15px);
      overflow: hidden;
    }
  }
}

.match-list {
  display: block;
  padding: 10px;
  background: #fff;
  border-radius: 10px;
}

.hero-match {
  width: 100%;
  padding: 0 10px 10px 10px;
}

.list-top-center {
  display: flex;
  align-items: center;

  .name {
    font-size: 15px;
    font-weight: bold;
    color: #333;
    padding: 0 5px;
  }

  .record span {
    font-size: 12px;
    color: #FF2121;
    margin-right: 5px;
    padding: 1px 3px;
    border-radius: 4px;
    background-color: #FFE4E4;
  }
}

.icon img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: solid 1px #ededed;
  padding: 2px;
  -webkit-filter: grayscale(50%);
  -moz-filter: grayscale(50%);
  -ms-filter: grayscale(50%);
  -o-filter: grayscale(50%);
  filter: grayscale(50%);
  filter: gray;
}

.list-center {
  padding: 4px 8px;
  background: #F2F3F5;
  border-radius: 4px;
  display: flex;
  align-items: center;
  margin-top: 5px;
  width: fit-content;
  font-size: 14px;
  .list-center-title {
    color: #777777;
  }

  .list-type-list {
    margin-left: 4px;
  }

  .list-red {
    border-radius: 4px;
    border: 1px solid #FF2121;
    color: #FF2121;
    display: inline-block;
    margin-left: 2px;
    text-align: center;
    width: 20px;
    height: 20px;
    line-height: 20px;
  }

  .list-black {
    color: #777777;
    border-radius: 4px;
    border: 1px solid #777777;
    display: inline-block;
    margin-left: 2px;
    text-align: center;
    width: 20px;
    height: 20px; 
    line-height: 20px;
  }
}

.list-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top:10px;
  .list-match {
    font-size: 14px;
    span {
      color: #333333;
    }
    span:first-child {
      padding: 0px 3px;
      background: #F1F9FF;
      border: solid 1px #3AA4F2;
      border-radius: 3px;
      font-size: 12px;
      color: #3AA4F2;
      margin-right:6px;
    }
  }

  .cost {
    padding:0 10px;
    font-size: 16px;
    font-weight: 500;
    line-height: 30px;
    background: linear-gradient(90deg, #F9D9AD 0%, #E4C585 100%);
    border-radius: 15px;
    text-align: center;
    color: #644821;
    display: flex;
    align-items: center;
    justify-content: center;
    img{
      width:18px;
      height: 18px;
      margin-right: 2px;
    }
  }
}

.list-top {
  display: flex;
  align-items: center;
  position: relative;
}

.expert_main {
  padding: 0 !important;
  text-align: left;
}

.icon {
  position: relative;
}

.tj_num {
  z-index: 1;
  position: absolute;
  top: 0;
  right: 0;
  padding: 2px 5px;
  color: #fff;
  font-size: 12px;
  line-height: 12px;
  text-align: center;
  transform: scale(0.8);
  background: #d23338;
  border-radius: 50%;
  border: solid 1px #fff;
  border-bottom-left-radius: 0px;
}
</style>
