<template>
  <div class="container">
    {{ sectionChinese }}、{{ examQuestion.groupName }}（{{
      examQuestion.groupOrder
    }}
    / {{ examQuestion.groupTotal }}）
  </div>
</template>

<script>
export default {
  name: "QuestionIndex",
  props: {
    examQuestion: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  computed: {
    sectionChinese() {
      const n = this.examQuestion.mainNumber;
      let ret;
      if (n < 10) {
        ret = n.toLocaleString("zh-u-nu-hanidec");
      } else if (n === 10) {
        ret = "十";
      } else if (n > 10 && n < 20) {
        ret = "十" + (n % 10).toLocaleString("zh-u-nu-hanidec");
      } else if (n >= 20 && n < 100) {
        let s = n
          .toLocaleString("zh-u-nu-hanidec", { useGrouping: false })
          .split("");
        s.splice(1, 0, "十");
        ret = s.join("").replace("〇", "");
      } else {
        ret = n.toLocaleString("zh-u-nu-hanidec"); // 假设没有超过100的大题
      }

      return ret;
    },
  },
};
</script>

<style scoped>
.container {
  font-size: 28px;
  padding-left: 10px;
}
</style>
