You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

260 lines
5.6 KiB

// https://umijs.org/config/
import { defineConfig } from 'umi';
import { join } from 'path';
import defaultSettings from './defaultSettings';
import proxy from './proxy';
const { REACT_APP_ENV } = process.env;
export default defineConfig({
hash: true,
antd: {},
dva: {
hmr: true,
},
layout: {
// https://umijs.org/zh-CN/plugins/plugin-layout
locale: true,
siderWidth: 208,
...defaultSettings,
},
// https://umijs.org/zh-CN/plugins/plugin-locale
locale: {
// default zh-CN
default: 'zh-CN',
antd: true,
// default true, when it is true, will use `navigator.language` overwrite default
baseNavigator: true,
},
dynamicImport: {
loading: '@ant-design/pro-layout/es/PageLoading',
},
targets: {
ie: 11,
},
// umi routes: https://umijs.org/docs/routing
routes: [
{
path: '/user',
layout: false,
routes: [
{
path: '/user/login',
layout: false,
name: 'login',
component: './user/Login',
},
{
path: '/user',
redirect: '/user/login',
},
{
name: 'register-result',
icon: 'smile',
path: '/user/register-result',
component: './user/register-result',
},
{
name: 'register',
icon: 'smile',
path: '/user/register',
component: './user/register',
},
{
component: '404',
},
],
},
{
name: '首页',
icon: 'dashboard',
path: '/dashboard/workplace',
component: './dashboard/workplace',
},
{
name: '考试报名',
icon: 'dashboard',
path: '/registration',
routes: [
{
name: '报名',
icon: 'smile',
path: '/registration',
component: './registration',
},
{
name: '成功',
icon: 'smile',
path: '/registration/success',
component: './registration/success',
hideInMenu: true,
},
]
},
{
name: '课程学习',
icon: 'table',
path: '/course',
routes: [
{
name: '主题',
icon: 'smile',
path: '/course/subject',
component: './course/subject',
},
{
name: '课程列表',
icon: 'smile',
path: '/course/list',
component: './course/list',
},
{
name: '课程列表',
icon: 'smile',
path: '/course/detail',
component: './course/detail',
},
],
},
{
name: '模拟考试',
icon: 'dashboard',
path: '/test',
component: './test',
},
{
path: '/examination',
icon: 'table',
name: '资质考试',
routes: [
{
name: '考试概况(暂时废弃)',
icon: 'smile',
path: '/examination/intro',
component: './examination/intro',
hideInMenu: true,
},
{
name: '考试试卷',
icon: 'smile',
path: '/examination/paper',
component: './examination/paper',
},
],
},
{
name: 'analysis',
icon: 'dashboard',
path: '/dashboard/analysis',
component: './dashboard/analysis',
hideInMenu: true,
},
{
path: '/profile',
name: 'profile',
icon: 'profile',
hideInMenu: true,
routes: [
{
path: '/profile',
redirect: '/profile/basic',
},
{
name: 'basic',
icon: 'smile',
path: '/profile/basic',
component: './profile/basic',
},
{
name: 'advanced',
icon: 'smile',
path: '/profile/advanced',
component: './profile/advanced',
},
],
},
{
name: 'exception',
icon: 'warning',
path: '/exception',
hideInMenu: true,
routes: [
{
path: '/exception',
redirect: '/exception/403',
},
{
name: '403',
icon: 'smile',
path: '/exception/403',
component: './exception/403',
},
{
name: '404',
icon: 'smile',
path: '/exception/404',
component: './exception/404',
},
{
name: '500',
icon: 'smile',
path: '/exception/500',
component: './exception/500',
},
],
},
{
name: 'account',
icon: 'user',
path: '/account',
hideInMenu: true,
routes: [
{
path: '/account',
redirect: '/account/center',
},
{
name: 'center',
icon: 'smile',
path: '/account/center',
component: './account/center',
},
{
name: 'settings',
icon: 'smile',
path: '/account/settings',
component: './account/settings',
},
],
},
{
path: '/',
redirect: '/dashboard/workplace',
},
{
component: '404',
},
],
// Theme for antd: https://ant.design/docs/react/customize-theme-cn
theme: {
'primary-color': defaultSettings.primaryColor,
},
// esbuild is father build tools
// https://umijs.org/plugins/plugin-esbuild
esbuild: {},
title: false,
ignoreMomentLocale: true,
proxy: proxy[REACT_APP_ENV || 'dev'],
base: '/',
publicPath: './', // 发布路径采用相对地址
manifest: {
basePath: './',
},
// Fast Refresh 热更新
fastRefresh: {},
nodeModulesTransform: {
type: 'none',
},
mfsu: {},
webpack5: {},
exportStatic: {},
});