<template>
    <view class="pt-20 pb-30 px-50 flex justify-between items-center">
        <volunteer-menu-item v-for="m in menus" :key="m.title" :title="m.title" :icon="m.icon" @click="goPage(m)"/>
    </view>
</template>

<script setup lang="ts">
import VolunteerMenuItem from "@/pagesMain/pages/volunteer/components/volunteer-menu-item.vue";
import {routes} from "@/common/routes";
import {useTransferPage} from "@/hooks/useTransferPage";

const {transferTo} = useTransferPage()

type Menu = {
    title: string
    icon: string
    pagePath: string
}
const menus: Menu[] = [{
    title: '找院校',
    icon: '/volunteer/index/menu_college.png',
    pagePath: routes.universityIndex
}, {
    title: '查专业',
    icon: '/volunteer/index/menu_major.png',
    pagePath: routes.majorIndex
}, {
    title: '看职业',
    icon: '/volunteer/index/menu_vocation.png',
    pagePath: routes.careerIndex
}, {
    title: '志愿分析',
    icon: '/volunteer/index/menu_analysis.png',
    pagePath: ''
}]

const goPage = function (menu: Menu) {
    if (menu.pagePath) transferTo(menu.pagePath)
    else uni.$ie.showModal({title: '提示', content: '开发中，敬请期待', showCancel: false})
}
</script>

<style scoped>

</style>