<template>
  <div class="create-course">
    <div class="create-course-title">
      {{ $t('Key285') }}
    </div>
    <div class="create-course-container">
      <div class="create template">
        <div class="click" @click="selectTemplate">
          <i class="el-icon-plus" />
        </div>
        <div class="name">
          {{ $t('Key286') }}
        </div>
      </div>
      <div class="create build">
        <div class="click" @click="$router.push('/create_course_step_table')">
          <i class="el-icon-plus" />
        </div>
        <div class="name">
          {{ $t('Key287') }}
        </div>
      </div>
    </div>

    <!-- 选择模板 -->
    <select-template :dialog-visible="dialogVisible" @dialogClose="dialogClose" @confirmTemplate="confirmTemplate" />
  </div>
</template>

<script>
import SelectTemplate from '@/components/select/SelectTemplate.vue';

export default {
  components: { SelectTemplate },
  data() {
    return {
      dialogVisible: false
    };
  },
  created() {
    this.updateWordPack({
      word_key_list: ['Key285', 'Key286', 'Key287', 'Key279']
    });
  },
  methods: {
    selectTemplate() {
      this.dialogVisible = true;
    },
    dialogClose() {
      this.dialogVisible = false;
    },
    confirmTemplate(id) {
      this.dialogVisible = false;
      this.$router.push(`/create_course_step_table/course_info?is_use_template=true&template_id=${id}`);
    }
  }
};
</script>

<style lang="scss" scoped>
@import '~@/styles/mixin';

.create-course {
  @include container;

  padding-top: 88px;

  &-title {
    width: 100%;
    text-align: center;
    font: {
      size: 24px;
      weight: 700;
    }
  }

  &-container {
    display: flex;
    justify-content: space-evenly;
    margin-top: 56px;

    .template > .click {
      background-color: #68cefa;
    }

    .build > .click {
      background-color: #5af0e7;
    }

    .create {
      width: 400px;
      height: 300px;
      border: 1px solid #ccc;
      border-radius: 8px;

      .click {
        position: relative;
        height: 236px;
        cursor: pointer;
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;

        .el-icon-plus {
          position: absolute;
          top: 108px;
          left: 181px;
          color: #fff;
          font: {
            size: 36px;
          }
        }
      }

      .name {
        height: 64px;
        line-height: 64px;
        text-align: center;
        font: {
          size: 20px;
          weight: 700;
        }
      }
    }
  }
}
</style>
