<template>
  <div class="dashboard-editor-container">
    <!--每一列间隔32项目-->
    <el-row :gutter="32">
      <!--屏幕尺寸不够的时候自己沾满一行-->
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="topWindowBox">
          <div class="twbTitle">
            <div class="twbIconbgRed"></div>网站数量
          </div>
          <div class="twbNumber">1,000</div>
          <div class="twbStatus"><img src="@/assets/index/arrow-up.png"/> +12% <span>较上周</span></div>
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="topWindowBox">
          <div class="twbTitle">
            <div class="twbIconbgBlue"></div>内容发布数量
          </div>
          <div class="twbNumber">68,888</div>
          <div class="twbStatus"><img src="@/assets/index/arrow-up.png"/> +18% <span>较昨天</span></div>
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="topWindowBox">
          <div class="twbTitle">
            <div class="twbIconbgPurple"></div>公共栏目数量
          </div>
          <div class="twbNumber">24</div>
          <div class="twbStatusDown"><img src="@/assets/index/arrow-down.png"/> -2% <span>较上个月</span></div>
        </div>
      </el-col>
    </el-row>

    <el-row :gutter="32">
      <el-col :xs="24" :sm="24" :lg="16">
        <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
          <line-chart :chart-data="lineChartData" />
        </el-row>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <pie-chart />
        </div>
      </el-col>
    </el-row>

  </div>
</template>

<script>
import GithubCorner from '@/components/GithubCorner'
import PanelGroup from './components/PanelGroup'
import LineChart from './components/LineChart'
import RaddarChart from './components/RaddarChart'
import PieChart from './components/PieChart'
import BarChart from './components/BarChart'
import TransactionTable from './components/TransactionTable'
import TodoList from './components/TodoList'
import BoxCard from './components/BoxCard'

const lineChartData = {
  newVisitis: {
    expectedData: [100, 120, 161, 134, 105, 160, 165],
    actualData: [120, 82, 91, 154, 162, 140, 145]
  },
  messages: {
    expectedData: [200, 192, 120, 144, 160, 130, 140],
    actualData: [180, 160, 151, 106, 145, 150, 130]
  },
  purchases: {
    expectedData: [80, 100, 121, 104, 105, 90, 100],
    actualData: [120, 90, 100, 138, 142, 130, 130]
  },
  shoppings: {
    expectedData: [130, 140, 141, 142, 145, 150, 160],
    actualData: [120, 82, 91, 154, 162, 140, 130]
  }
}

export default {
  name: 'DashboardAdmin',
  components: {
    GithubCorner,
    PanelGroup,
    LineChart,
    RaddarChart,
    PieChart,
    BarChart,
    TransactionTable,
    TodoList,
    BoxCard
  },
  data() {
    return {
      lineChartData: lineChartData.newVisitis
    }
  },
  methods: {
    handleSetLineChartData(type) {
      this.lineChartData = lineChartData[type]
    }
  }
}
</script>

<style lang="less" scoped>
  .topWindowBox{
    background:#FFFFFF;
    border-Radius:20px;
    height:200px;
    width:100%;
    margin-bottom:30px;
    padding:25px;
    box-sizing: border-box;
    .twbTitle {
      display:flex;
      align-items: center;
      font-size:16px;
      color:#212227;
      .twbIconbgRed,.twbIconbgBlue,.twbIconbgPurple{
        width: 40px;
        height: 40px;
        border-radius: 50%;
        margin-right: 15px;
      }
      .twbIconbgRed {
        background: #EA79BA;
      }
      .twbIconbgBlue {
        background: #6DACE7;
      }
      .twbIconbgPurple{
        background: #AA7AEB;
      }
    }
    .twbNumber {
      font-size: 30px;
      margin-top:32px;
      font-weight: 1000;
    }
    .twbStatus,.twbStatusDown {
      font-size:14px;
      margin-top: 35px;
      display:flex;
      img {
        display: block;
        margin-right: 4px;
      }
      span {
        color:#707B81;
        margin-left: 8px;
      }
    }
    .twbStatus {
      color:#23C581;
    }
    .twbStatusDown {
      color:#E74545
    }
  }

  .dashboard-editor-container {
    padding: 32px;
    background-color: rgb(240, 242, 245);
    position: relative;

    .github-corner {
      position: absolute;
      top: 0px;
      border: 0;
      right: 0;
    }

    .chart-wrapper {
      background: #fff;
      padding: 16px 16px 0;
      margin-bottom: 32px;
    }
  }

  @media (max-width:1024px) {
    .chart-wrapper {
      padding: 8px;
    }
  }
</style>
