<template>
  <div>
    <div class="error">
      <div class="imgDiv">
        <img src="@assets/images/err.png" alt="" />
        <div class="infoText">{{ errorMsg }}</div>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
import { Component, Vue, Watch } from "vue-property-decorator";
@Component
export default class extends Vue {
  count: number = 0;
  timer: any = null;
  currentTime: any = "0";
  lastTime: any = "0";
  private errorMsg = '无权限';
  activated() {
    if(sessionStorage.getItem("errorMsgTit")){
      this.errorMsg = sessionStorage.getItem("errorMsgTit");
    }else{
      this.errorMsg = '无权限';
    }
  }
  toLogin(event) {
    event.preventDefault();
    this.currentTime = new Date().getTime();
    this.count = this.currentTime - this.lastTime < 1000 ? this.count + 1 : 1;
    this.lastTime = new Date().getTime();
    if (this.count > 4) {
      this.count = 0;
      this.$router.push(`/login`);
    }
  }
}
</script>
<style lang="scss" scoped>
.error {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #fff;
  .imgDiv {
    text-align: center;
    padding: 36px;
    img {
      width: 100px;
      margin-bottom: 36px;
    }
    .infoText {
      margin-bottom: 5px;
      font-weight: 400;
      font-size: 20px;
    }
  }
}
</style>
