import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  { path: "/", redirect: "/login" },
  {
    path: "/weather",
    component: () => import("../components/Home.vue"),
    children: [
      //气象检测
      {
        path: "/weather",
        component: () => import("../views/weather/index.vue"),
        name: "weather",
        meta: { title: "气象检测", icon: "", keepAlive: true },
      },
      //覆冰
      {
        path: "/icing",
        component: () => import("../views/icing/index.vue"),
        name: "icing",
        meta: { title: "覆冰", icon: "", keepAlive: true },
      },
      //设备状态
      {
        path: "/equipmentStatus",
        component: () => import("../views/equipmentStatus/index.vue"),
        name: "equipmentStatus",
        meta: { title: "设备状态", icon: "", keepAlive: true },
      },
      //线路信息管理
      {
        path: "/lineInformation",
        component: () => import("../views/lineInformation/index.vue"),
        name: "lineInformation",
        meta: { title: "线路管理", icon: "", keepAlive: true },
      },
      //杆塔信息管理
      {
        path: "/towerInformation",
        component: () => import("../views/towerInformation/index.vue"),
        name: "towerInformation",
        meta: { title: "杆塔管理", icon: "", keepAlive: true },
      },
      //装置管理
      {
        path: "/photographicDevice",
        component: () => import("../views/photographicDevice/index.vue"),
        name: "photographicDevice",
        meta: { title: "装置管理", icon: "", keepAlive: true },
      },
    ],
  },
  {
    path: "/login",
    component: () => import("../views/login/index.vue"),
    meta: { title: "登录" },
  },
];

const router = new VueRouter({
  mode: "hash",
  base: process.env.BASE_URL,
  routes,
});

export default router;
