<template>
  <el-dialog title="" :visible.sync="toperInfo.dialogVisible" :close-on-click-modal="false">
    <div class="eggContainer">
      <div class="eggBg">
        <div class="toper">
          <img :src="toperInfo.toper.Head" alt="" v-if="toperInfo.toper.Head"
               :class="[{'boy':toperInfo.toper.Sex == 1},{'girl':toperInfo.toper.Sex == 2}]">
          <!-- <img src="../static/img/people/flyhead.png" alt="" v-if="!toperInfo.toper.Head"
               :class="[{'boy':toperInfo.toper.Sex == 1},{'girl':toperInfo.toper.Sex == 2}]"> -->
          <default-head v-if="!toperInfo.toper.Head" :class="[{'boy':toperInfo.toper.Sex == 1},{'girl':toperInfo.toper.Sex == 2}]"></default-head>
          <span class="names">{{ toperInfo.toper.UserName }}</span>
        </div>
        <div class="info">
          <div class="type">
            CK
          </div>
          <div class="detail">
            <em>{{ toperInfo.toper.Ck|fmtFloat }}</em>
          </div>
        </div>
      </div>      
    </div>
    <div v-show="toperInfo.totalTime > 0" class="countdown">{{toperInfo.totalTime}}</div>
  </el-dialog>
</template>

<script>
import defaultHead from '@/components/defaultHead'

export default {
  data() {
    return {
      // dialogTableVisible: false,
      // dialogFormVisible: false,
    };
  },
  props: ['toperInfo'],
  filters: {
    fmtNum(val) {
      if (val == 0) {
        return '--'
      } else {
        if (parseInt(val) < 0) return 0;
        if (parseInt(val) > 0) return val
      }
    },
    fmtFloat(val) {
      if (val == 0) {
        return '0'
      } else {
        return parseFloat(val).toFixed(1);
      }
    },
    fmtInt(val) {
      if (val == 0) {
        return '0'
      } else {
        return parseInt(val);
      }
    },
  },
  components: {
    defaultHead
  }
}
</script>

<style lang="scss" scoped>
@mixin cube {
  width: 100%;
  // height: 100%;
  overflow: display;
  display: block;
  margin: 0 auto;
}

/*成就彩蛋*/
/deep/ .el-dialog {
  @include cube;
  position: absolute;
  padding: 0rem 0rem;
  top: 0;
  left: 0;
  right: 0;
  // bottom: 0.5rem;
  width: 6.2rem;
  height: 8rem;
  //background: url("../assets/imgs/newRecord/bg.svg");
  background: url("../assets/imgs/newRecord/newRecordBg.svg");
  background-position: top center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  box-shadow: none;
  background-color: transparent;
  margin-top: 0.56rem !important;
  // border: 2px solid #26ea47;
}

/deep/ .el-dialog__header {
  display: none;
  padding: 0rem 0rem;
}
/deep/ .el-dialog__body {
  padding: 0rem 0rem;
}

.eggContainer {
  @include cube;
  // border: 2px solid #2643ea;

  .eggBg {
    @include cube;
    padding-left: 3%;
    // margin: 0 auto;
    //background: url("../assets/imgs/newRecord/bg.svg");
    // background-position: top center;
    // background-repeat: no-repeat;
    // background-size: 100%;
    // margin-top: 0rem;
    // overflow: visible;

    .toper {
      @include cube;
      position: relative;
      // height: 2.5rem;
      top: 0.8rem;
      // bottom: 0.2rem;

      img {
        @include cube;
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 250rem;

        &.girl {
          border: 2px solid #EA26EA;
        }

        &.boy {
          border: 2px solid #39B6FF;
        }
      }

      .names {
        @include cube;
        width: 2rem;
        height: 0.4rem;
        background: rgba(0, 0, 0, 0.7);
        font-size: 0.3rem;
        text-align: center;
        border-radius: 250rem;
        position: relative;
        bottom: 0.4rem;
        color: #fff;
        line-height: 0.4rem;
      }
    }
  }

  .info {
    @include cube;

    .type {
      height: 1.6rem;
      color: white;
      font-weight: bold;
      font-size: 0.6rem;
      line-height: 2rem;
      margin-top: 1.36rem;
    }

    em {
      position: relative;
      bottom: 0.1rem;
      @include cube;
      font-weight: bold;
      font-size: 1.2rem;
      text-align: center;
      font-family: "Arial";
      color: #b5000f;
      text-shadow: 0px 4px 8px #fff;
      font-style: normal !important;
      text-decoration: none;
      margin-top: 0;
    }
  }
}

.countdown {
  width: 1.5rem;
  position: relative;
  font-size: 0.6rem;
  color: #797979;
  margin: 0 auto;
  margin-top: 0.39rem;
}

/*响应式调整*/
@media (max-aspect-ratio: 1920/1080) {  //max-aspect-ratio: 小于等于   min-aspect-ratio: 大于等于
  /deep/ .el-dialog {
    margin-top: 1.6rem !important;
  }

  .countdown {
    margin-top: 0.8rem;
  }
}

</style>
