<template>
  <div class="dashboard-container">
    <el-card style="width: 90%;margin-left: 5%;text-align: center;">
      <h1>欢迎使用MARK标注平台</h1>
    </el-card>
  </div>
</template>

<script>
import CountTo from 'vue-count-to'
import {mapGetters} from 'vuex'
import {getCookie} from "@/utils/cookie";

export default {
  name: 'Dashboard',
  components: {CountTo},
  data() {
    return {
      dashboard: {
        orderNum: 0,
        totalIntegral: 0,
        upGoodsNum: 0,
        commentNum: 0
      }
    }
  },
  computed: {
    ...mapGetters([
      'roles'
    ])
  },
  beforeRouteEnter(to, from, next) {
    if (to.params.flush || to.query.flush) {
      next(vm => {
        if (!vm.initial) {
        }
        vm.initial = false
      })
    } else {
      next(vm => {
        vm.initial = false
      })
    }
  },
  mounted() {
    if (!this.initial) {
      this.initial = true
      this.loginBack()
    }
  },
  methods: {
    loginBack() {
      console.log('loginBack dashboard')
      let key = process.env.VUE_APP_TOKEN_KEY
      //内部登录成功,回跳的当前页面,从cookie中获取token,校验是否登录成功
      let token = getCookie(key)
      console.log('token: ',token)
      if (token != null && token !== '') {
        let loginForm = {
          token: token,
          userSource: 16
        }
        this.$store.dispatch('user/innerLogin', loginForm).then(() => {
          // this.$router.push({path: this.redirect || '/', query: this.otherQuery})
          // this.loading = false
        }).catch((res) => {
          // this.loginForm.codeKey = this.randomString(32)
          // if (res.errCode === 999) {
          // this.showCaptcha = true
          // }
          // this.loading = false
        })
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.panel-group {
  margin-top: 18px;

  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    height: 108px;
    //cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 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: right;

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

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@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;
    }
  }
}

.kjrk-item {
  width: 150px;
  float: left;
  cursor: pointer;
  margin-bottom: 50px;
}

.kjrk-svg {
  font-size: 52px;
  position: relative;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, 0%);
  -ms-transform: translate(-50%, 0%);
  transform: translate(-50%, 0%);
}

.kjrk-font {
  font-size: 14px;
  color: #666666;
  letter-spacing: 0;
  text-align: center;
  margin-top: 10px;
}

.left20 {
  margin-left: 20px;
}
</style>

