<template>
  <div class="login-box">
    <div class="content">
      <div class="mian-cont900">
        <div class="title">{{ data.name }}</div>
        <div class="exam-time">
          <div class="tit">考试时间</div>
          <div class="line"></div>
          <div class="time">
            {{ data.start_time }} - {{ data.end_time }}
          </div>
        </div>
        <div class="mian-form">
          <!-- <div class="form prohibit"> -->
          <div class="form">
            <div class="tips" v-show="false">您登录的次数已超过最大限制</div>
            <input type="text" @click="fullScreen" v-model="examineeNumber" placeholder="请输入准考证号">
            <!-- <input type="text" placeholder="请输入准考证号" readonly="readonly" class="prohibit"> -->
            <div class="btn" @click="login">登录</div>
            <!-- <div class="btn prohibit">登录</div> -->
            <div class="time-tips" v-show="false">距离开考还有：3:23:04</div>
          </div>
        </div>
      </div>
    </div>
    <!-- <my-dia :title="title" :prompt="prompt" :isPopup="isPopup" v-if="isPopup">
        <template v-slot:button>
          <button>我知道了</button>
          <button>好的</button>
        </template>
    </my-dia> -->
  </div>
</template>
<script>
import action from '@action'
// import DialogComponent from '../../components/exam/dialogComponent.vue'
export default {
  components: {
    // 'my-dia': DialogComponent
  },
  data() {
    return {
      title: '提示',
      prompt: '从哪女快递费也琴女是儿是而发大V是阿女大是安抚大V vavgrrad',
      data: '',
      examineeNumber: '',
      isPopup: true
    }
  },
  mounted() {
    action.Login.getExamInfo(this.$route.params.examId).then(res => {
      // this.$store.commit('setExamInfo', res)
      window.sessionStorage.setItem('examInfo', JSON.stringify(res))
      this.data = res
      console.log(this.$store.state)
    }).finally(res => {
    })
  },
  methods: {
    fullScreen() {
      const el = document.documentElement
      const rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen
      if (typeof rfs !== 'undefined' && rfs) {
        rfs.call(el)
      }
      return false
    },
    login() {
      action.Login.userLogin({ examinee_number: this.examineeNumber }).then(res => {
        // this.$store.commit('setStudentInfo', res)
        window.sessionStorage.setItem('studentInfo', JSON.stringify(res))
        this.$router.push({
          name: 'confirmInfo'
        })
      }).catch(err => {
        this.$alert(err.message, {
          callback: action => {}
        })
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.mian-cont900{
  margin: 0 auto;
  width: 900px;
}
.login-box{
  width: 100%;
  height: 100%;
  background: #fff;
  .content{
    width: 100%;
    height: 387px;
    background: url(../../assets/images/login-bg.png);
    background-size: 100% 100%;
    .title{
      padding-top: 110px;
      font-size: 36px;
      font-weight: 600;
      color: #FFFFFF;
      line-height: 50px;
      letter-spacing: 7px;
      text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5);
    }
    .exam-time{
      padding-top: 20px;
      .tit{
        font-size: 18px;
        font-weight: bold;
        color: #FFFFFF;
        line-height: 25px;
        text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5);
      }
      .line{
        width: 24px;
        height: 2px;
        background: #FFFFFF;
        box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.5);
        margin: 10px 0;
      }
      .time{
        height: 25px;
        font-size: 18px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #FFFFFF;
        line-height: 25px;
        text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5);
      }
    }
    .mian-form{
      width: 100%;
      height: 230px;
      background: #FFFFFF;
      box-shadow: 0px 2px 12px 0px rgba(177, 186, 195, 0.3);
      border-radius: 5px;
      margin-top: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      .form{
        position: relative;
        display: flex;
        &.prohibit{
          input{
            background: #EEEEEE;
            border: 1px solid #CCCCCC;
          }
          .btn{
            color: #ccc;
            background: #eee;
          }
        }
      }
      input{
        padding-left: 15px;
        width: 585px;
        height: 40px;
        border-radius: 4px;
        border: 1px solid #CCCCCC;
        font-size: 14px;
        outline: none;
        &::-webkit-input-placeholder{
          color: #999999;
        }
        &.prohibit{
          background: #EEEEEE;
          border: 1px solid #CCCCCC;
        }
      }
      .btn{
        width: 180px;
        height: 42px;
        background: #C01540;
        border-radius: 4px;
        margin-left: 20px;
        font-size: 14px;
        font-weight: bold;
        color: #FFFFFF;
        line-height: 40px;
        text-align: center;
        font-style: normal;
        &.prohibit{
          color: #ccc;
          background: #eee;
        }
      }
      .tips{
        position: absolute;
        top: -80%;
        left: 0;
        font-size: 18px;
        font-weight: 400;
        color: #C01540;
        line-height: 25px;
      }
      .time-tips{
        position: absolute;
        bottom: -80%;
        left: 0;
        font-size: 18px;
        color: #222222;
        line-height: 25px;
      }
    }
  }
}
</style>
