<template>
  <p style="display: inline-block; color: red">
    <template v-if="info.gradeId">
      【<span>{{
        info.classStatus == 0
          ? "暂未开班"
          : info.classEndTime
          ? `有效期至：${$tools.timestampToTime(
              info.classEndTime
            )}，本班还剩${$tools.GetRTime(
              info.classEndTime
            )}天将结束学习，`
          : ""
      }}</span>
      已报名人数{{ info.studentNumAll }}/{{ info.studentUpper }}人 】
    </template>
  </p>
</template>

<script>
export default {
  props: {
    classInfo: {
      type: Object,
      default: () => {
        return {};
      },
    },
    gradeId: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      info: {},
    };
  },
  created() {
    if (this.gradeId) {
      this.$request.getGradeDetail(this.gradeId).then((res) => {
        this.info = res.data;
      });
    } else {
      this.info = JSON.parse(JSON.stringify(this.classInfo));
    }
  },
};
</script>

<style>
</style>