<template>
  <div class="dashboard-container">
    <div class="bg-image" :style="{'background-image':'url(' + require('@/assets/images/slogan.jpg') + ')'}">
      <img style="width: 100%;" src="">
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'Home4Mine',
  components: { },
  data() {
    return {
      selectedMine: {}
    }
  },
  computed: {
    ...mapGetters([
      'user'
    ])
  },
  created() {
    if (window.localStorage.getItem('kd.mine.home.need.reload')) {
      window.localStorage.removeItem('kd.mine.home.need.reload')
      window.location.reload()
    }
  },
  mounted() {
    if (this.user.enterpriseId === 0) { // 身份错误
      this.$router.replace('/dashboard')
      return
    }
    const selectedMineJson = window.localStorage.getItem('kd.selected.mine')
    let noMine = false
    if (!selectedMineJson) {
      noMine = true
    } else {
      const selectedMine = JSON.parse(selectedMineJson)
      if (!selectedMine || selectedMine.enterpriseId !== this.user.enterpriseId) {
        noMine = true
      } else {
        this.selectedMine = selectedMine
      }
    }
       // if (noMine) {
    //   this.$message.error('当前未选择矿山')
    //   this.$router.replace('/dashboard')
    // }
  },
  methods: {}
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .dashboard-container {
    padding: 32px;
    background-color: rgb(240, 242, 245);
    position: relative;
    height: calc(100vh - 83px);
    .bg-image{
      background-repeat: no-repeat;
      background-size: cover;
      background-position-y: center;
      height: 200px;
    }
  }
</style>
