﻿import route from "mock/route";

/**
 * @name umi 的路由配置
 * @description 只支持 path,component,routes,redirect,wrappers,name,icon 的配置
 * @param path  path 只支持两种占位符配置，第一种是动态参数 :id 的形式，第二种是 * 通配符，通配符只能出现路由字符串的最后。
 * @param component 配置 location 和 path 匹配后用于渲染的 React 组件路径。可以是绝对路径，也可以是相对路径，如果是相对路径，会从 src/pages 开始找起。
 * @param routes 配置子路由，通常在需要为多个路径增加 layout 组件时使用。
 * @param redirect 配置路由跳转
 * @param wrappers 配置路由组件的包装组件，通过包装组件可以为当前的路由组件组合进更多的功能。 比如，可以用于路由级别的权限校验
 * @param name 配置路由的标题，默认读取国际化文件 menu.ts 中 menu.xxxx 的值，如配置 name 为 login，则读取 menu.ts 中 menu.login 的取值作为标题
 * @param icon 配置路由的图标，取值参考 https://ant.design/components/icon-cn， 注意去除风格后缀和大小写，如想要配置图标为 <StepBackwardOutlined /> 则取值应为 stepBackward 或 StepBackward，如想要配置图标为 <UserOutlined /> 则取值应为 user 或者 User
 * @doc https://umijs.org/docs/guides/routes
 */
const newMenu = [
  {
    path: '/book',
    name: '小说中心',
    icon: 'icon-xiaoshuo',
    routes: [
      {
        path: '/book',
        redirect: '/book/bookManage/author',
      },
      {
        path: '/book/bookManage/author',
        name: '作者管理',
        icon: 'icon-gaojian-zuozhe',
        component: './book/bookManage/author',
      },
      {
        path: '/book/bookManage/bookTags',
        name: '标签管理',
        icon: 'icon-biaoqian',
        component: './book/bookManage/bookTags',
      },
      {
        path: '/book/bookManage/classifyList',
        name: '分类管理',
        icon: 'icon-fenlei',
        component: './book/bookManage/classifyList',
      },
      {
        path: '/book/bookManage/longbookList',
        name: '长篇小说',
        icon: 'icon-changpianxiaoshuo',
        component: './book/bookManage/longbookList',
      },
      {
        path: '/book/bookManage/shortbookList',
        name: '短篇小说',
        icon: 'icon-changpianxiaoshuo',
        component: './book/bookManage/shortbookList',
      },
    ],
  },
  {
    path: '/distribution',
    name: '分销中心',
    icon: 'icon-fenxiao',
    routes: [
      {
        path: '/distribution',
        redirect: '/distribution/distributor/info',
      },
      {
        path: '/distribution/distributor/info',
        name: '分销商信息',
        icon: 'icon-fenxiaoshangxiaoxi',
        component: './distribution/distributor/info',
      },
      {
        path: '/distribution/miniprogram',
        name: '小程序',
        icon: 'icon-xiaochengxu',
        routes: [
          {
            path: '/distribution/miniprogram',
            redirect: '/distribution/miniprogram/weChatInfo',
          },
          {
            path: '/distribution/miniprogram/weChatInfo',
            name: '小程序信息',
            component: './distribution/miniprogram/weChatInfo',
          },
          {
            path: '/distribution/miniprogram/mimiModule',
            name: '小程序组件配置',
            component: './distribution/miniprogram/mimiModule',
          },
          {
            path: '/distribution/miniprogram/pagesManage',
            name: '页面模板管理',
            component: './distribution/miniprogram/pagesManage',
          },
        ],
      },
      {
        path: '/distribution/book',
        name: '小说信息',
        icon: 'icon-xiaoshuoxinxi',
        routes: [
          {
            path: '/distribution/book',
            redirect: '/distribution/book//longBook',
          },
          {
            path: '/distribution/book/longBook',
            name: '长篇小说',
            component: './distribution/book/longBook',
          },
          {
            path: '/distribution/book/shortBook',
            name: '短篇小说',
            component: './distribution/book/shortBook',
          },
        ],
      },
      {
        path: '/distribution/readLog',
        name: '阅读记录',
        icon: 'icon-yuedu-2',
        routes: [
          {
            path: '/distribution/readLog',
            redirect: '/distribution/readLog/long',
          },
          {
            path: '/distribution/readLog/long',
            name: '长篇小说',
            component: './distribution/readLog/long',
          },
          {
            path: '/distribution/readLog/short',
            name: '短篇小说',
            component: './distribution/readLog/short',
          },
        ],
      },
      {
        path: '/distribution/orderLog',
        name: '订单记录',
        icon: 'icon-xiaofei',
        routes: [
          {
            path: '/distribution/orderLog',
            redirect: '/distribution/orderLog/long',
          },
          {
            path: '/distribution/orderLog/long',
            name: '长篇小说',
            component: './distribution/orderLog/long',
          },
          {
            path: '/distribution/orderLog/short',
            name: '短篇小说',
            component: './distribution/orderLog/short',
          },
        ],
      },
      {
        path: '/distribution/payLog',
        name: '书币记录',
        icon: 'icon-shubi',
        routes: [
          {
            path: '/distribution/payLog',
            redirect: '/distribution/payLog/long',
          },
          {
            path: '/distribution/payLog/long',
            name: '长篇小说',
            component: './distribution/payLog/long',
          },
          {
            path: '/distribution/payLog/short',
            name: '短篇小说',
            component: './distribution/payLog/short',
          },
        ],
      },
      {
        path: '/distribution/system',
        name: '系统信息',
        icon: 'icon-xitong',
        component: './distribution/system',
      },
    ],
  },
  {
    path: '/ai',
    name: '小说AI',
    icon: 'icon-xitong',
    routes: [
      {
        path: '/ai',
        redirect: '/ai/custom',
      },
      {
        path: '/ai/custom',
        name: '自定义生成器',
        component: './ai',
      },
      {
        path: '/ai/expand',
        name: '小说扩写',
        component: './ai',
      },
      {
        path: '/ai/mainPlot',
        name: '主线剧情设定',
        component: './ai',
      },
      {
        path: "/ai/branchPlot",
        name: '支线剧情分解',
        component: './ai',
      },
      {
        path: "/ai/outline",
        name: '小说大纲生成',
        component: './ai',
      },
      {
        path: "/ai/chapterOutline",
        name: '章节细纲生成',
        component: './ai',
      },
      {
        path: "/ai/reversePlot",
        name: '剧情反转设定',
        component: './ai',
      },
      {
        path: "/ai/plot",
        name: '剧情创作',
        component: './ai',
      },
      {
        path: "/ai/character",
        name: '人物创作',
        component: './ai',
      },
    ],
  }
];
export default [
  {
    path: '/user',
    layout: false,
    routes: [
      {
        name: 'login',
        path: '/user/login',
        component: './User/Login',
      },
    ],
  },
  {
    //默认进入后打开哪个页面
    path: '/',
    redirect: '/book',
  },
  {
    path: '*',
    layout: false,
    component: './404',
  },
  ...newMenu,
];
