Newer
Older
securityFront / src / views / dashboard / portal.vue
TAN YUE on 21 Dec 2020 4 KB 20201221 首页跳转功能
<template>
  <div>
    <el-row>
      <el-col class="sub-system control-system">
        <div class="icon-subsystem">
          <img src="/static/images/dashboard/icon-control.png">
          <div><a>综合控制室</a></div>
        </div>
      </el-col>
      <el-col class="sub-system door-system">
        <div class="icon-subsystem">
          <img src="/static/images/dashboard/icon-door.png">
          <div><a @click="doorSubSystem">营门管理</a></div>
        </div>
      </el-col>
      <el-col class="sub-system defence-system">
        <div class="icon-subsystem">
          <img src="/static/images/dashboard/icon-defence.png">
          <div>周界防卫</div>
        </div>
      </el-col>
      <el-col class="sub-system region-system">
        <div class="icon-subsystem">
          <img src="/static/images/dashboard/icon-region.png">
          <div>全域监控</div>
        </div>
      </el-col>
      <el-col class="sub-system key-system">
        <div class="icon-subsystem">
          <img src="/static/images/dashboard/icon-key.png">
          <div>重点区域管控</div>
        </div>
      </el-col>
    </el-row>

    <div class="logo-title">
      <img src="/static/images/dashboard/icon-title.png" height="150">
      <div>
        <div class="title">
          天津滨海园区
        </div>
        <div class="sub-title">
          综合安防集成管理平台
        </div>
      </div>
    </div>

    <div class="welcome">
      <img src="/static/images/dashboard/exit-logo.png" height="25px" @click="logout">
    </div>
  </div>
</template>

<script>
export default {
  name: 'Portal',
  data() {
    return {
      name: this.$store.getters.name
    }
  },
  computed: {
    systems() {
      return this.$store.getters.systems
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    logout() {
      this.$store.dispatch('LogOut').then(() => {
        location.reload() // 为了重新实例化vue-router对象 避免bug
      })
    },
    fetchData() {
      this.loading = true
      this.$store.dispatch('GetSystems').then(() => {
        this.loading = false
        console.log('获取子系统成功')
      })
    },
    doorSubSystem: function() {
      this.$store.commit('SET_CHANGEFLAG', '1')
      this.$store.commit('SET_SYSTEM', this.systems[1])
      this.$store.dispatch('tagsView/delAllViews', true).then(({ visitedViews }) => {
        this.$router.replace(this.systems[1].url)
      })
    }
  }
}
</script>

<style scoped>
  .sub-system {
    width: 20%;
    height: 100vh;
    border: 2px solid #3a8ee6;
    font-size: 24px;
    color: #F5F7FA;
    text-align: center;
    text-shadow: 1px 1px 2px black;
  }

  .control-system {
    background: url("/static/images/dashboard/bg-control.jpg") -225px;
    background-size: cover;
  }

  .door-system {
    background: url("/static/images/dashboard/bg-door.jpg") center;
    background-size: cover;
  }

  .defence-system {
    background: url("/static/images/dashboard/bg-defence.jpg") -225px;
    background-size: cover;
  }

  .region-system {
    background: url("/static/images/dashboard/bg-region.jpg") -225px;
    background-size: cover;
  }

  .key-system {
    background: url("/static/images/dashboard/bg-key.jpg") -225px;
    background-size: cover;
  }

  .icon-subsystem img {
    padding: 10px;
    margin-top: 35vh;
    margin-bottom: 20px;
    border-radius: 50%;
    background-color: #014886;
    border: 2px solid #00ffff;
    cursor: pointer;
  }

  .logo-title {
    position: absolute;
    width: 420px;
    left: calc(50vw - 210px);
    top: 10vh;
  }

  .welcome {
    position: absolute;
    right: 5vw;
    bottom: 30px;
    padding-left: 10px;
    cursor: pointer;
  }

  .title {
    position: absolute;
    top: 30px;
    left: 180px;
    font-size: 40px;
    color: #F5F7FA;
    text-shadow: 2px 2px 2px black;
    display: inline-block;
  }

  .sub-title {
    position: absolute;
    top: 100px;
    left: 180px;
    font-size: 24px;
    color: #F5F7FA;
    text-shadow: 2px 2px 2px black;
    display: inline-block;
  }
</style>