// router/index.js
import { createRouter, createWebHistory } from 'vue-router';
const routes = [
    {
        path: '/',
        redirect: 'home/navigation'
    },
    {
        path: '/home',
        name: 'home',
        component: () => import('@/views/homepage.vue'),
        redirect: '/home/navigation',
        children: [
            {
                path: 'navigation',
                name: 'navigation',
                meta: { title: '首页' },
                component: () => import('@/views/navigation/index.vue'),
            },
        ]
    },
    {
        path: '/common',
        name: 'common',
        component: () => import('@/views/commonpage.vue'),
        children: [
            {
                path: 'interpretive',
                name: 'interpretive',
                meta: { title: '讲解服务' },
                component: () => import('@/views/about/interpretive.vue'),
            },
            {
                path: 'audiencesurveys',
                name: 'audiencesurveys',
                meta: { title: '观众调查' },
                component: () => import('@/views/about/audiencesurveys.vue'),
            },
            {
                path: 'staytuned',
                name: 'staytuned',
                meta: { title: '敬请期待' },
                component: () => import('@/views/staytuned.vue'),
            }
        ]
    },
    {
        path: '/about',
        name: 'about',
        component: () => import('@/views/aboutpage.vue'),
        children: [
            {
                path: 'statutes',
                name: 'statutes',
                meta: { title: '博物馆章程资料' },
                component: () => import('@/views/about/statutes.vue')
            },
            {
                path: 'council',
                name: 'council',
                meta: { title: '理事会材料' },
                component: () => import('@/views/about/council.vue')
            },
            {
                path: 'seniormanagement',
                name: 'seniormanagement',
                meta: { title: '高级管理人员材料' },
                component: () => import('@/views/about/seniormanagement.vue')
            },
            {
                path: 'academiccommittee',
                name: 'academiccommittee',
                meta: { title: '学术委员会组织制度等材料' },
                component: () => import('@/views/about/academiccommittee.vue')
            },
            {
                path: 'supervisoryauthority',
                name: 'supervisoryauthority',
                meta: { title: '监督机构材料' },
                component: () => import('@/views/about/supervisoryauthority.vue')
            },
            {
                path: 'developmentplanning',
                name: 'developmentplanning',
                meta: { title: '发展规划材料' },
                component: () => import('@/views/about/developmentplanning.vue')
            },
            {
                path: 'annualworkplan',
                name: 'annualworkplan',
                meta: { title: '年度工作计划材料' },
                component: () => import('@/views/about/annualworkplan.vue')
            },
            {
                path: 'threeyeannrep',
                name: 'threeyeannrep',
                meta: { title: '前三年年度报告材料' },
                component: () => import('@/views/about/threeyeannrep.vue')
            },
            {
                path: 'socialdonation',
                name: 'socialdonation',
                meta: { title: '社会捐赠管理制度材料' },
                component: () => import('@/views/about/socialdonation.vue')
            },
            {
                path: 'friendsofthemuseum',
                name: 'friendsofthemuseum',
                meta: { title: '“博物馆之友”组织章程' },
                component: () => import('@/views/about/friendsofthemuseum.vue')
            },
        ]
    },
    // 添加其他路由配置...
];

const router = createRouter({
    history: createWebHistory(),
    routes
});
router.beforeEach((to, from) => {
    if (to.meta.title) {
        document.title = to.meta.title
    }
})
export default router;
