<template>
    <ie-page>
        <college-list @click="handleItemClick">
            <template #top>
                <ie-navbar title="选择院校"/>
            </template>
        </college-list>
    </ie-page>
</template>

<script setup lang="ts">
import {Transfer} from "@/types";
import {useTransferPage} from "@/hooks/useTransferPage";
import CollegeList from "@/pagesOther/pages/university/index/components/college-list.vue";
import {University} from "@/types/university";
import {routes} from "@/common/routes";

const {prevData, transferTo, transferBack} = useTransferPage<Transfer.UniversityPickerPageOptions, {}>()

const handleItemClick = (u: University) => {
    if (prevData.value.useRedirect) {
        transferTo(routes.targetPicker, {
            type: 'redirectTo',
            bigData: {
                ...prevData.value,
                picked: u
            }
        })
    } else {
        transferBack(u)
    }
}
</script>

<style lang="scss">

</style>
