<template>
  <Row :gutter="30">
    <i-col :xs="24" :sm="24" :md="24" :lg="getCurrentLang()=='tw'?12:24" class="title-part">
      <h2 class="event-title">
        <span class="title-mark" v-show="this.$store.getters.getItemTitle.eventType == 'exam'" >{{$t("studentWeb.home.exam")}}</span>
        <span class="title-mark" v-show="this.$store.getters.getItemTitle.eventType == 'vote'" >{{$t("studentWeb.home.vote")}}</span>
        <span class="title-mark" v-show="this.$store.getters.getItemTitle.eventType == 'survey'" >{{$t("studentWeb.home.survey")}}</span>
        {{ this.$store.getters.getItemTitle.name }}
      </h2>
    </i-col>
    <i-col :xs="24" :sm="24" :md="24" :lg="getCurrentLang()=='tw'?12:24" class="info-part">
      <ul class="base-info" :class="{'base-infoEn':getCurrentLang()=='en'}">
        <li
          v-if="this.$store.getters.getItemTitle.eventType == 'exam' && paper.length !== 0 "
        >
          <svg-icon icon-class="subject" class="base-info-icon" />{{ $t('studentWeb.baseInfo.subject')}}
        <span class="base-info-text">{{paper.length > 1? $t('studentWeb.event.allSubject'):paper[0].subject.name }}</span>
          <!--<span class="base-info-text" v-if="getCurrentLang()=='en'">{{ transSubjecttoEn(this.$store.getters.getItemTitle.eventSubject) }}</span>-->
        </li>
        <!--<li>
          <svg-icon icon-class="teacher" class="base-info-icon" />投票类型：
          <span class="base-info-text">{{ this.$store.getters.getItemTitle.times }}</span>
        </li>-->
        <li>
          <svg-icon icon-class="time" class="base-info-icon" />
          <span>{{ !eventType ?  $t('studentWeb.baseInfo.period') :  $t('studentWeb.baseInfo.postTime') }}</span>
          <span class="base-info-text" v-if="from != '通知'&&from != 'hiteach'">
              <span>
                  {{ !eventType ? dateFormat(this.$store.getters.getItemTitle.startTime) + "～" : ""}}
              </span>
              {{ dateFormat(this.$store.getters.getItemTitle.endTime) }}
          </span>
          <!--<span
            class="base-info-text"
            v-if="from == '通知'||from == 'hiteach'"
          >{{ this.$store.getters.getItemTitle.endTime + " 14:20" }}54345</span>-->
        </li>
        <!--<li v-if=" from == 'hiteach'">
           <svg-icon icon-class="time" class="base-info-icon" />{{$t('studentWeb.baseInfo.classTime')}}:
          <span class="base-info-text">{{ this.$store.getters.getItemTitle.endTime }}</span>
        </li>-->
        <!--<li v-if="finishedCondition && !eventType && from != '通知'&&from!='hiteach'">
           <svg-icon icon-class="done" class="base-info-icon" />
          <span class="base-info-text">{{ $t('studentWeb.baseInfo.Fineshed')}}</span>
        </li>
        <li v-if="unfinishedCondition && !eventType && from != '通知'&&from!='hiteach'">
           <svg-icon icon-class="undone" class="base-info-icon" />
          <span class="base-info-text">{{ $t('studentWeb.baseInfo.unFinished')}}</span>
        </li>-->
      </ul>
    </i-col>
  </Row>
</template>

<script>
export default {
  name: "EventBasicInfo",
        props: [
            "eventType", "from",
            "paper"
        ],

  computed: {
    finishedCondition: function () {
      return (
        this.$store.getters.getItemTitle.isDone ||
        this.$store.getters.getFinishedItem.includes(
          this.$store.getters.getItemTitle.eventID
        ) == true
      );
    },
    unfinishedCondition: function () {
      return (
        !this.$store.getters.getItemTitle.isDone &&
        this.$store.getters.getFinishedItem.includes(
          this.$store.getters.getItemTitle.eventID
        ) == false
      );
    },
        },
        mounted() {
        },
        methods: {
            dateFormat(timestamp) {
                var date = new Date(timestamp)
                var Y = date.getFullYear() + '-'
                var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
                var D = date.getDate() + ' '
                return Y + M + D;
            },
    getCurrentLang() {
      return localStorage.getItem('lang');
    },
  },
};
</script>

<style></style>
