<template>
  <el-row :gutter="40" class="panel-group">
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel">
        <router-link to="/news">
          <div class="card-panel-icon-wrapper icon-people"><svg-icon icon-class="international" class-name="card-panel-icon" /></div>
          <div class="card-panel-description">
            <div class="card-panel-text">栏目内容</div>
            <div class="count">
              {{ cdata.news }}
              <span class="num">条</span>
            </div>
          </div>
        </router-link>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel">
        <router-link to="/project">
          <div class="card-panel-icon-wrapper icon-money"><svg-icon icon-class="clipboard" class-name="card-panel-icon" /></div>
          <div class="card-panel-description">
            <div class="card-panel-text">捐赠项目</div>
            <div class="count">
              {{ cdata.projects }}
              <span class="num">个</span>
            </div>
          </div>
        </router-link>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel">
        <router-link to="/donate">
          <div class="card-panel-icon-wrapper logininfor"><svg-icon icon-class="guide" class-name="card-panel-icon" /></div>
          <div class="card-panel-description">
            <div class="card-panel-text">累计捐赠次数</div>
            <div class="count">
              {{ cdata.donates }}
              <span class="num">次</span>
            </div>
          </div>
        </router-link>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel">
        <router-link to="/donate">
          <div class="card-panel-icon-wrapper icon-message"><svg-icon icon-class="money" class-name="card-panel-icon" /></div>
          <div class="card-panel-description">
            <div class="card-panel-text">累计捐赠总额</div>
            <div class="count">
              {{ cdata.total.toFixed(2) }}
              <span class="num">元</span>
            </div>
          </div>
        </router-link>
      </div>
    </el-col>
  </el-row>
</template>

<script>
export default {
  props: {
    cdata: {
      type: Object
    }
  },
  methods: {
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type);
    }
  }
};
</script>

<style lang="scss" scoped>
.panel-group {
  .card-panel {
    border-radius: 5px;
    height: 100px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.05);
    .count {
      font-weight: bold;
      font-size: 20px;
      .num {
        font-size: 14px;
        font-weight: normal;
        padding-left: 3px;
      }
    }
    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-message {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .logininfor {
        background: #34bfa3;
      }
    }

    .icon-people {
      color: white;
      background: #40c9c6;
    }

    .icon-message {
      color: white;
      background: #36a3f7;
    }

    .icon-money {
      color: white;
      background: #f4516c;
    }

    .logininfor {
      color: white;
      background: #34bfa3;
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 10px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;
      text-align: center;

      .card-panel-text {
        line-height: 18px;
        text-align: left;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}
.simes {
  font-size: 14px !important;
  margin-top: -7px !important;
}
@media (max-width: 550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
