import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/HomeView.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "home",
      redirect: "/home",
      children: [
        {
          path: "/",
          component: HomeView,
          redirect: "/home",
          children: [
            {
              path: "/home",
              component: () => import("@/views/home/index.vue"),
            },
            {
              path: "/gallery",
              component: () => import("@/views/gallery/index.vue"),
            },
            {
              path: "/article",
              component: () => import("@/views/article/index.vue"),
            },
            {
              path: "/tour",
              component: () => import("@/views/tour/index.vue"),
            },
            {
              path: "/widget",
              component: () => import("@/views/widget/index.vue"),
            },
            {
              path: "/plink",
              component: () => import("@/views/plink/index.vue"),
            },
          ],
        },
        {
          path: "/login",
          component: () => import("@/views/login.vue"),
        },
        {
          path: "/swag",
          component: () => import("@/views/swag/index.vue"),
        },
        {
          path: "/mini/:id",
          component: () => import("@/views/article/mini/index.vue"),
        },
        {
          path: "/console",
          component: () => import("@/views/console/index.vue"),
          redirect: "/console/profile",
          children: [
            {
              path: "/console/home",
              component: () => import("@/views/console/home/index.vue"),
              meta: {
                title: "控制台",
                name: "首页",
                auth: true,
              },
            },
            {
              path: "/console/profile",
              component: () => import("@/views/console/profile/index.vue"),
              meta: {
                title: "控制台",
                name: "个人信息",
                auth: true,
              },
            },
            {
              path: "/console/gallery",
              component: () => import("@/views/console/gallery/index.vue"),
              meta: {
                title: "控制台",
                name: "画廊管理",
                auth: true,
              },
            },
            {
              path: "/console/article",
              component: () => import("@/views/console/article/index.vue"),
              meta: {
                title: "控制台",
                name: "文章管理",
                auth: true,
              },
            },
            {
              path: "/console/menu",
              component: () => import("@/views/console/menu/index.vue"),
              meta: {
                title: "控制台",
                name: "导航管理",
                auth: true,
              },
            },
          ],
        },
        {
          path: "/m",
          component: () => import("@/views/mobile/index.vue"),
          redirect: "/m/home",
          children: [
            {
              path: "/m/home",
              component: () => import("@/views/mobile/home/index.vue"),
              meta: {
                title: "我的",
                name: "控制台",
                auth: true,
              },
            },
            {
              path: "/m/profile",
              component: () => import("@/views/mobile/info/index.vue"),
              meta: {
                title: "个人信息",
                name: "控制台",
                auth: true,
              },
            },
            {
              path: "/m/gallery",
              component: () => import("@/views/mobile/gallery/index.vue"),
              meta: {
                title: "画廊管理",
                name: "控制台",
                auth: true,
              }
            },
            {
              path: "/m/article",
              component: () => import("@/views/mobile/arti/index.vue"),
              meta: {
                title: "文章管理",
                name: "控制台",
                auth: true,
              }
            },
          ]

        }
      ],
    },
  ],
});

export default router;
