<template>
  <div>
    <div class="tit">
      <span style="font-size:.3rem;color:#fff; font-weight: bold;">{{title}}</span>
    </div>
    <div v-if="noData">
      <NotOpend :title="this.info"/>
    </div>
    <div class="charBox">
      <div v-for="item in list" class="details" :key="item.id" @click="getMatchInfo(item.match_id)">
        <div>
          <span>{{item.name_chinese}}</span>
        </div>
        <div class="matchDtls">
          <div>
            <span>{{item.home_team}}</span>
            <div>
              <span>{{item.match_date}}</span>
            </div>
          </div>
          <div>
            <span>{{item.guest_team}}</span>
            <div>
              <span>{{item.match_time}}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import NotOpend from "@/components/StNotOpend";
export default {
  name: "",
  components: { NotOpend },
  data() {
    return {
      title: "特色赛事",
      list: "",
      noData: false,
      info: "暂无相关特色赛事",
      timers: true,
      getIsShow: true
    };
  },
  mounted() {
    if (this.getIsShow) {
      this.$store.dispatch("GETSHOW", true);
      this.getIsShow = false;
    }
    let _this = this;
    this.$public.ajaxTimerFun(function(timing) {
      if (_this.timers) {
        _this.getAjax();
      } else {
        clearInterval(timing);
      }
    },(1000*180));
    this.getAjax();
  },
  methods: {
    getMatchInfo(matchId) {
      this.$router.push({
        path: "/StRollBallBettingPage",
        query: { gameCode: "zq", name: "足球" }
      });
      this.$store.dispatch("MACTH_ID", matchId);
    },
    getAjax: function() {
      //this.$store.dispatch('GETSHOW',true);
      this.$http.get(this.$ports.home.highMatch).then(res => {
        // console.log('highMatch',res)
        if (res.data.status == 1 && res.data.data.matchData.length > 0) {
          this.list = res.data.data.matchData;
          this.title = res.data.data.title;
          this.noData = false;
        } else {
          this.noData = true;
        }
      });
      let _this = this;
      setTimeout(() => {
        _this.$store.dispatch("GETSHOW", false);
      }, 1000);
    }
  },
  beforeDestroy() {
    this.timers = false;
  }
};
</script>
<style scoped lang="">
.charBox {
  margin-top: 0.24rem;
  text-align: left;
  background: #f8f8f8;
  padding: 0.2rem 0.3rem;
  margin: 0 auto;
}
.tit {
  padding: 0.24rem 0;
  padding: 0 0.3rem;
  background: #a0a0a0;
  font-size: 0.32rem;
  line-height: 0.88rem;
  height: 0.88rem;
  color: #000000;
}
.details {
  padding: 0.25rem 0.31rem;
  background: #dcdcdc;
  border-radius: 0.08rem;
  margin-bottom: 0.2rem;
}
.details:nth-last-child(1) {
  margin-bottom: 0;
}
.details div span {
  font-size: 0.28rem;
  color: #f76649;
}
.matchDtls {
  margin-top: 0.12rem;
}
.matchDtls div {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.matchDtls div span {
  color: #333333;
  font-size: 0.28rem;
}
.matchDtls div div span {
  font-size: 0.24rem;
}
.matchDtls i {
  display: inline-block;
  width: 0.08rem;
  height: 0.08rem;
  position: absolute;
  right: 0;
  top: 0;
  background: #000;
}
</style>