<template>
  <div class="c-error-page">
    <div class="c-error-page__img" />
    <div class="c-error-page__main">
      <div class="c-error-page__header">
        <div class="c-error-page__logo" />
        <div class="c-error-page__name">浪潮屏媒安播云平台</div>
      </div>
      <div class="c-error-page__title">鉴权失败，请稍后重试</div>
      <div
        class="c-error-page__retry u-pointer"
        @click="retry"
      >
        重 试
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'ErrorPage',
  computed: {
    ...mapGetters(['token', 'tenant']),
    message () {
      if (!this.token) {
        return '鉴权失败，请稍后重试'
      }
      if (!this.tenant) {
        return '未知用户，请联系管理员'
      }
      return '未登录'
    }
  },
  methods: {
    retry () {
      window.location.reload()
    }
  }
}
</script>

<style lang="scss" scoped>
.c-error-page {
  display: flex;
  min-height: 100%;
  width: 100%;

  &__img {
    flex: 1 1 400px;
    display: inline-block;
    background: url("~@/assets/illustration.png") 50% 50% / 757px 613px
      no-repeat;
  }

  @media screen and (max-width: 900px) {
    .c-error-page__img {
      display: none;
    }
  }

  &__main {
    flex: 1 0 auto;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 0 180px;
    background-color: #fff;
    overflow: auto;
  }

  &__header {
    display: inline-flex;
    align-items: center;
    margin-bottom: 60px;
  }

  &__logo {
    display: inline-block;
    width: 142px;
    height: 36px;
    background: url("~@/assets/logo.png") 0 0 / 100% 100% no-repeat;
  }

  &__name {
    padding-left: 10px;
    color: $blue;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
  }

  &__title {
    color: $error;
    font-size: 18px;
    font-weight: bold;
  }

  &__retry {
    position: relative;
    margin-top: 40px;
    color: $warning;
    font-size: 16px;

    &:hover {
      color: $warning--light;

      &::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        height: 0;
        bottom: 0;
        border-bottom: 1px solid $warning;
      }
    }
  }
}
</style>
