diff --git a/config/config.ts b/config/config.ts index c5e94746acbf97284433a186965f47704c64d12f..fe69449135a90af52e61a8f5c4599acb43ea27d7 100644 --- a/config/config.ts +++ b/config/config.ts @@ -1,11 +1,13 @@ import { IConfig, IPlugin } from 'umi-types'; -import defaultSettings from './defaultSettings'; // https://umijs.org/config/ + +import defaultSettings from './defaultSettings'; +// https://umijs.org/config/ import slash from 'slash2'; import webpackPlugin from './plugin.config'; -import theme from './theme.config'; -const path = require('path'); -const { pwa } = defaultSettings; // preview.pro.ant.design only do not use in your production ; +const { pwa, primaryColor } = defaultSettings; + +// preview.pro.ant.design only do not use in your production ; // preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env; @@ -40,6 +42,8 @@ const plugins: IPlugin[] = [ }, } : false, + // default close dll, because issue https://github.com/ant-design/ant-design-pro/issues/4665 + // dll features https://webpack.js.org/plugins/dll-plugin/ // dll: { // include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'], // exclude: ['@babel/runtime', 'netlify-lambda'], @@ -87,232 +91,15 @@ export default { routes: [ { path: '/', - component: '../layouts/BlankLayout', + component: '../layouts/BasicLayout', + Routes: ['src/pages/Authorized'], + authority: ['admin', 'user'], routes: [ - { - path: '/404', - component: './404', - }, - { - path: '/user', - component: '../layouts/UserLayout', - routes: [ - { - path: '/user', - redirect: '/user/login', - }, - { - name: 'login', - path: '/user/login', - component: './user/login', - }, - ], - }, { path: '/', - component: '../layouts/BasicLayout', - Routes: ['src/pages/Authorized'], - authority: ['user'], - routes: [ - { - path: '/', - redirect: '/dashboard/analysis', - }, - { - path: '/dashboard', - name: 'dashboard', - icon: 'dashboard', - routes: [ - { - name: 'analysis', - path: '/dashboard/analysis', - component: './dashboard/analysis', - }, - { - name: 'monitor', - path: '/dashboard/monitor', - component: './dashboard/monitor', - }, - { - name: 'workplace', - path: '/dashboard/workplace', - component: './dashboard/workplace', - }, - ], - }, - { - path: '/form', - icon: 'form', - name: 'form', - routes: [ - { - name: 'basic-form', - path: '/form/basic-form', - component: './form/basic-form', - }, - { - name: 'step-form', - path: '/form/step-form', - component: './form/step-form', - }, - { - name: 'advanced-form', - path: '/form/advanced-form', - component: './form/advanced-form', - }, - ], - }, - { - path: '/list', - icon: 'table', - name: 'list', - routes: [ - { - path: '/list/search', - name: 'search-list', - component: './list/search', - routes: [ - { - path: '/list/search', - redirect: '/list/search/articles', - }, - { - name: 'articles', - path: '/list/search/articles', - component: './list/search/articles', - }, - { - name: 'projects', - path: '/list/search/projects', - component: './list/search/projects', - }, - { - name: 'applications', - path: '/list/search/applications', - component: './list/search/applications', - }, - ], - }, - { - name: 'table-list', - path: '/list/table-list', - component: './list/table-list', - }, - { - name: 'basic-list', - path: '/list/basic-list', - component: './list/basic-list', - }, - { - name: 'card-list', - path: '/list/card-list', - component: './list/card-list', - }, - ], - }, - { - path: '/profile', - name: 'profile', - icon: 'profile', - routes: [ - { - name: 'basic', - path: '/profile/basic', - component: './profile/basic', - }, - { - name: 'advanced', - path: '/profile/advanced', - component: './profile/advanced', - }, - ], - }, - { - name: 'result', - icon: 'check-circle-o', - path: '/result', - routes: [ - { - name: 'success', - path: '/result/success', - component: './result/success', - }, - { - name: 'fail', - path: '/result/fail', - component: './result/fail', - }, - ], - }, - { - name: 'exception', - icon: 'warning', - path: '/exception', - routes: [ - { - name: '403', - path: '/exception/403', - component: './exception/403', - }, - { - name: '404', - path: '/exception/404', - component: './exception/404', - }, - { - name: '500', - path: '/exception/500', - component: './exception/500', - }, - ], - }, - { - name: 'account', - icon: 'user', - path: '/account', - routes: [ - { - name: 'center', - path: '/account/center', - component: './account/center', - }, - { - name: 'settings', - path: '/account/settings', - component: './account/settings', - }, - ], - }, - { - name: 'editor', - icon: 'highlight', - path: '/editor', - routes: [ - { - name: 'flow', - path: '/editor/flow', - component: './editor/flow', - }, - { - name: 'mind', - path: '/editor/mind', - component: './editor/mind', - }, - { - name: 'koni', - path: '/editor/koni', - component: './editor/koni', - }, - ], - }, - { - name: 'parameter', - icon: 'highlight', - path: '/parameter', - component: './system/parameter', - authority: ['user'], - }, - ], + name: 'welcome', + icon: 'smile', + component: './Welcome', }, { component: './404', @@ -323,9 +110,10 @@ export default { component: './404', }, ], - // Theme for antd - // https://ant.design/docs/react/customize-theme-cn - theme, + // Theme for antd: https://ant.design/docs/react/customize-theme-cn + theme: { + 'primary-color': primaryColor, + }, define: { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '', // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 @@ -370,16 +158,6 @@ export default { basePath: '/', }, chainWebpack: webpackPlugin, - // 配置 webpack 的 resolve.alias 属性 默认src=>@ - alias: { - src: path.join(__dirname, '../src'), - components: path.join(__dirname, '../src', 'components'), - utils: path.join(__dirname, '../src', 'utils'), - assets: path.join(__dirname, '../src', 'assets'), - themes: path.join(__dirname, '../src', 'themes'), - config: path.join(__dirname, '../src', '../config'), - public: path.join(__dirname, '../public'), - }, /* proxy: { '/server/api/': { diff --git a/docker/nginx.conf b/docker/nginx.conf index 5f86992c8fbb8accbb878e6c9c93366d1ab8eb26..9d0418c4e76419dd686cea46bfb4158ad123230a 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -14,9 +14,8 @@ server { try_files $uri $uri/ /index.html; } location /api { - proxy_pass https://preview.pro.ant.design; + proxy_pass https://ant-design-pro.netlify.com; proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; } } diff --git a/package.json b/package.json index d63cda7150c675d8febc51b34d17dcd4de046321..493169e97f74b4f3597b6a40364e04bfa1a0ac7f 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ }, "husky": { "hooks": { + "pre-commit": "npm run lint-staged" } }, "lint-staged": { @@ -53,7 +54,7 @@ "not ie <= 10" ], "dependencies": { - "@ant-design/pro-layout": "^4.5.5", + "@ant-design/pro-layout": "^4.5.7", "@antv/data-set": "^0.10.2", "@types/lodash.debounce": "^4.0.6", "@types/react-router": "^5.0.2", @@ -86,11 +87,12 @@ "react-media-hook2": "^1.0.5", "react-router": "^4.3.1", "redux": "^4.0.1", - "umi": "^2.7.2", + "umi": "^2.8.7", "umi-plugin-block-dev": "^1.0.0", "umi-plugin-ga": "^1.1.3", "umi-plugin-pro-block": "^1.3.2", - "umi-plugin-react": "^1.8.2", + "umi-plugin-react": "^1.9.5", + "umi-request": "^1.0.8", "axios":"^0.19.0", "query-string":"^6.8.1", "store":"^2.0.12" @@ -129,6 +131,7 @@ "netlify-lambda": "^1.4.13", "node-fetch": "^2.6.0", "prettier": "^1.17.1", + "pro-download": "1.0.1", "serverless-http": "^2.0.2", "slash2": "^2.0.0", "stylelint": "^10.1.0", diff --git a/src/components/GlobalHeader/AvatarDropdown.tsx b/src/components/GlobalHeader/AvatarDropdown.tsx index d23380434a8d2f300a38d6ebf8974ec2df063626..ccdb7494f4497fe5020a2c0eb7fb34aec76ddc9a 100644 --- a/src/components/GlobalHeader/AvatarDropdown.tsx +++ b/src/components/GlobalHeader/AvatarDropdown.tsx @@ -1,12 +1,12 @@ import { Avatar, Icon, Menu, Spin } from 'antd'; -import { ConnectProps, ConnectState } from '@/models/connect'; - import { ClickParam } from 'antd/es/menu'; -import { CurrentUser } from '@/models/user'; import { FormattedMessage } from 'umi-plugin-react/locale'; import React from 'react'; import { connect } from 'dva'; import router from 'umi/router'; + +import { ConnectProps, ConnectState } from '@/models/connect'; +import { CurrentUser } from '@/models/user'; import HeaderDropdown from '../HeaderDropdown'; import styles from './index.less'; diff --git a/src/components/GlobalHeader/NoticeIconView.tsx b/src/components/GlobalHeader/NoticeIconView.tsx index 52a26e8a0a97e006522304cba34d1812aaab3caa..0f019060fbe43f40267caf18426013a88c408446 100644 --- a/src/components/GlobalHeader/NoticeIconView.tsx +++ b/src/components/GlobalHeader/NoticeIconView.tsx @@ -1,14 +1,14 @@ -import { ConnectProps, ConnectState } from '@/models/connect'; import React, { Component } from 'react'; import { Tag, message } from 'antd'; - -import { CurrentUser } from '@/models/user'; -import NoticeIcon from '../NoticeIcon'; -import { NoticeItem } from '@/models/global'; import { connect } from 'dva'; import { formatMessage } from 'umi-plugin-react/locale'; import groupBy from 'lodash/groupBy'; import moment from 'moment'; + +import { NoticeItem } from '@/models/global'; +import NoticeIcon from '../NoticeIcon'; +import { CurrentUser } from '@/models/user'; +import { ConnectProps, ConnectState } from '@/models/connect'; import styles from './index.less'; export interface GlobalHeaderRightProps extends ConnectProps { diff --git a/src/models/global.ts b/src/models/global.ts index f1970a62ec9a0728a544cb2a71f896a4afe9c9c3..eec3a8045f58d59d2842bcb2bc527e78bdc50169 100644 --- a/src/models/global.ts +++ b/src/models/global.ts @@ -1,7 +1,8 @@ -import { Effect } from './connect.d'; -import { NoticeIconData } from '@/components/NoticeIcon'; import { Reducer } from 'redux'; import { Subscription } from 'dva'; + +import { Effect } from './connect.d'; +import { NoticeIconData } from '@/components/NoticeIcon'; import { queryNotices } from '@/services/user'; export interface NoticeItem extends NoticeIconData { diff --git a/src/models/setting.ts b/src/models/setting.ts index 2e52eb54f11cbee5efde3a6ecafae3532b78c570..860b9dd625d162953e508870c6affe2771a2e789 100644 --- a/src/models/setting.ts +++ b/src/models/setting.ts @@ -1,6 +1,4 @@ import { Reducer } from 'redux'; -// eslint-disable-next-line eslint-comments/disable-enable-pair -/* eslint-disable promise/catch-or-return */ import { message } from 'antd'; import defaultSettings, { DefaultSettings } from '../../config/defaultSettings'; import themeColorClient from '../components/SettingDrawer/themeColorClient'; diff --git a/src/pages/Authorized.tsx b/src/pages/Authorized.tsx index 12555c2c5c211022f34c90b1d339f5dbdbbbf5ec..2ed9838078e1363385e7c02ce9cb7c8d216149e1 100644 --- a/src/pages/Authorized.tsx +++ b/src/pages/Authorized.tsx @@ -1,10 +1,9 @@ -import { ConnectProps, ConnectState, Route, UserModelState } from '@/models/connect'; - -import Authorized from '@/utils/Authorized'; import React from 'react'; import Redirect from 'umi/redirect'; import { connect } from 'dva'; import pathToRegexp from 'path-to-regexp'; +import Authorized from '@/utils/Authorized'; +import { ConnectProps, ConnectState, Route, UserModelState } from '@/models/connect'; interface AuthComponentProps extends ConnectProps { user: UserModelState; diff --git a/src/typings.d.ts b/src/typings.d.ts index c06709b6769b85ea747581ad7aa11cb49623f2c7..379c06998b470be521f38eb6acc4598a0134f43c 100644 --- a/src/typings.d.ts +++ b/src/typings.d.ts @@ -12,7 +12,6 @@ declare module '*.jpeg'; declare module '*.gif'; declare module '*.bmp'; declare module '*.tiff'; -declare module 'rc-animate'; declare module 'omit.js'; declare module 'react-copy-to-clipboard'; declare module 'react-fittext';