<template>
  <ie-page ref="iePageRef" bg-color="white">
    <ie-navbar>
      <template #headerLeft>
        <view class="flex items-center">
          <uv-icon name="arrow-left" size="20px" color="#333"></uv-icon>
          <ie-image :is-oss="true" src="/study-title.png" custom-class="ml-8 w-148 h-36" mode="heightFix" />
          <view class="w-6 h-6 rounded-2 bg-black mx-12"></view>
          <view>
            <ie-dict :dict-name="EnumDictName.EXAM_TYPE" :dict-value="userStore.getExamType || '--'" />
          </view>
        </view>
      </template>
    </ie-navbar>
    <index-practice-entry />
    <index-menu />
    <index-banner />
    <henan-exam v-if="isVHS" :directed-school="firstDirectedSchool" />
    <hunan-exam v-else :directed-school="firstDirectedSchool" />
  </ie-page>
</template>

<script lang="ts" setup>
import IndexMenu from './compoentns/index-menu.vue';
import IndexBanner from './compoentns/index-banner.vue';
import HunanExam from './compoentns/hunan-exam.vue';
import HenanExam from './compoentns/henan-exam.vue';
import IndexPracticeEntry from './compoentns/index-practice-entry.vue';
import { EnumDictName, EnumExamType, EnumUserRole } from '@/common/enum';
import { useUserStore } from '@/store/userStore';
import { useTransferPage } from '@/hooks/useTransferPage';
import IePage from '@/components/ie-page/ie-page.vue';
import { useAuth } from '@/hooks/useAuth';

const { transferTo } = useTransferPage();
const userStore = useUserStore();
const { hasPermission } = useAuth();
// 通过 ref 获取 ie-page 组件实例
const iePageRef = ref<InstanceType<typeof IePage>>();
const { hasDirectedSchool, directedSchoolList, getExamType, isVHS } = storeToRefs(userStore);
const firstDirectedSchool = computed(() => directedSchoolList.value[0] || {});

const loadData = async () => {
  await userStore.getDirectedSchoolList();
}
onLoad(() => {
  loadData();
});
</script>

<style></style>
