<template>
  <view class="view">
    <div class="content">
      <div class="title">{{ title }}</div>
      <div class="subtitle">{{ subtitle }}</div>
      <div class="info">
        <div class="duration-wrapper">
          <u-icon name="/static/images/time.png"></u-icon>
          <div class="duration">{{ duration }}分钟</div>
          <div class="explain">考试时长</div>
        </div>
        <div class="count-wrapper">
          <u-icon name="/static/images/infinite.png"></u-icon>
          <div class="count">{{ count }}</div>
          <div class="explain">考试次数</div>
        </div>
        <div class="switch-count-wrapper">
          <u-icon name="/static/images/qiehuan.png"></u-icon>
          <div class="switch-count">{{ switchCount }}</div>
          <div class="explain">切屏次数</div>
        </div>
      </div>

      <div class="explain">*进入考试后，计时结束将自动交卷，退出后将会继续计时</div>

      <!-- 底部固定按钮 -->
      <div class="bottom-btn">
        <div class="btn">
          <u-button type="primary" size="small" shape="circle" text="进入考试" @click="openModal" />
        </div>
      </div>

      <!-- 确认进入考试弹框 -->
      <u-modal :show="showModal" title="提示" :content="content" showCancelButton @cancel="showModal = false" @confirm="handleEnterExam"></u-modal>
    </div>
  </view>
</template>

<script>
export default {
  data() {
    return {
      showModal: false,
      // 标题
      title: '2023年送配电线路架设工模拟考试',
      // 副标题
      subtitle: '不限期',
      // 考试时长
      duration: '120',
      // 考试次数
      count: '不限次',
      // 切屏次数
      switchCount: '不限次',
			content: '是否确认进入考试？'
    }
  },
  methods: {
		openModal() {
			this.showModal = true
		},
    // 进入考试
    handleEnterExam() {
      uni.navigateTo({
      	url: '/pages/YNEduApp/exam/examination'
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.view {
  padding: 10px;
}
.content {
  padding: 10px;
  border-radius: 5px;
  background-color: #fff;
  height: 90vh;
  box-sizing: border-box;

  .title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    padding-top: 20px;
  }

  .subtitle {
    font-size: 14px;
    color: #666;
    margin-top: 10px;
  }

  .info {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;

    .duration-wrapper,
    .count-wrapper,
    .switch-count-wrapper {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      width: 100px;
      height: 100px;
      background: #f4f9fe;
      border-radius: 4px;
      margin-bottom: 20px;

      .icon {
        width: 20px;
        height: 20px;
      }

      .duration,
      .count,
      .switch-count {
        font-size: 16px;
        color: #333;
        margin-left: 5px;
      }

      .explain {
        font-size: 12px;
        color: #999;
        margin-left: 5px;
      }
    }
  }

  .explain {
    font-size: 12px;
    color: #999;
  }

  .bottom-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #fff;
    padding: 10px 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;

    .btn {
      width: 33%;
      margin-right: 10px;
    }
  }
}

::v-deep .u-modal__content {
  flex-direction: column;
  align-items: center;
}
</style>
