diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..710f153 --- /dev/null +++ b/.babelrc @@ -0,0 +1,22 @@ +{ + "presets": [ + "umi/babel" + ], + "plugins": [ + [ + "babel-plugin-module-resolver", + { + "alias": { + "components": "./src/components", + "utils": "./src/utils", + "config": "./src/utils/config", + "enums": "./src/utils/enums", + "services": "./src/services", + "models": "./src/models", + "routes": "./src/routes", + "themes": "./src/themes" + } + } + ] + ] +} diff --git a/.eslintrc b/.eslintrc index 343890d..efb2508 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,5 @@ { - "extends": "airbnb", + "extends": "umi", "rules": { "arrow-body-style": [0, "never"], "comma-dangle": [2, "always-multiline"], @@ -44,17 +44,5 @@ "react/no-danger": 0, "react/jsx-first-prop-new-line": 0, "react/jsx-filename-extension": 0 - }, - "parser": "babel-eslint", - "parserOptions": { - "sourceType": "module", - "ecmaVersion": 8, - "ecmaFeatures": { - "jsx": true, - "experimentalObjectRestSpread": true - } - }, - "settings": { - "import/resolver": "node" - } + } } diff --git a/.gitignore b/.gitignore index 4666114..d1c78d1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ dist node_modules yarn.lock npm-debug.log + # ide .idea @@ -9,3 +10,7 @@ npm-debug.log .DS_Store .AppleDouble .LSOverride + +# umi +.umi +.umi-production diff --git a/.roadhogrc.js b/.roadhogrc.js deleted file mode 100644 index 9b76d6f..0000000 --- a/.roadhogrc.js +++ /dev/null @@ -1,57 +0,0 @@ -const path = require('path') -const { version } = require('./package.json') - -const svgSpriteDirs = [ - path.resolve(__dirname, 'src/svg/'), - require.resolve('antd').replace(/index\.js$/, '') -] - -export default { - entry: 'src/index.js', - svgSpriteLoaderDirs: svgSpriteDirs, - theme: "./theme.config.js", - publicPath: `/${version}/`, - outputPath: `./dist/${version}`, - // 接口代理示例 - proxy: { - "/api/v1/weather": { - "target": "https://api.seniverse.com/", - "changeOrigin": true, - "pathRewrite": { "^/api/v1/weather": "/v3/weather" } - }, - // "/api/v2": { - // "target": "http://192.168.0.110", - // "changeOrigin": true, - // "pathRewrite": { "^/api/v2" : "/api/v2" } - // } - }, - env: { - development: { - extraBabelPlugins: [ - "dva-hmr", - "transform-runtime", - [ - "import", { - "libraryName": "antd", - "style": true - } - ] - ] - }, - production: { - extraBabelPlugins: [ - "transform-runtime", - [ - "import", { - "libraryName": "antd", - "style": true - } - ] - ] - } - }, - dllPlugin: { - exclude: ["babel-runtime", "roadhog", "cross-env"], - include: ["dva/router", "dva/saga", "dva/fetch"] - } -} diff --git a/.roadhogrc.mock.js b/.roadhogrc.mock.js deleted file mode 100644 index fc068f0..0000000 --- a/.roadhogrc.mock.js +++ /dev/null @@ -1,5 +0,0 @@ -const mock = {} -require('fs').readdirSync(require('path').join(__dirname + '/src/mock')).forEach(function(file) { - Object.assign(mock, require('./src/mock/' + file)) -}) -module.exports = mock diff --git a/.umirc.js b/.umirc.js new file mode 100644 index 0000000..5e176d2 --- /dev/null +++ b/.umirc.js @@ -0,0 +1,26 @@ + +export default { + plugins: [ + 'umi-plugin-dva', + [ + 'umi-plugin-routes', + { + exclude: [ + /model\.(j|t)sx?$/, + /service\.(j|t)sx?$/, + /models\//, + /components\//, + /services\//, + /chart\/Container\.js$/, + ], + }, + ], + [ + 'umi-plugin-dll', + { + exclude: [], + include: ["dva", "dva/router", "dva/saga", "dva/fetch", "antd/es"], + }, + ], + ], +} diff --git a/.umirc.mock.js b/.umirc.mock.js new file mode 100644 index 0000000..fb7e6fb --- /dev/null +++ b/.umirc.mock.js @@ -0,0 +1,8 @@ + +export default { + ...require('./mock/common'), + ...require('./mock/dashboard'), + ...require('./mock/menu'), + ...require('./mock/post'), + ...require('./mock/user'), +} diff --git a/.webpackrc.js b/.webpackrc.js new file mode 100644 index 0000000..8b4f277 --- /dev/null +++ b/.webpackrc.js @@ -0,0 +1,32 @@ +import { resolve } from 'path'; + +export default { + theme: "./theme.config.js", + // 接口代理示例 + proxy: { + "/api/v1/weather": { + "target": "https://api.seniverse.com/", + "changeOrigin": true, + "pathRewrite": { "^/api/v1/weather": "/v3/weather" } + }, + // "/api/v2": { + // "target": "http://192.168.0.110", + // "changeOrigin": true, + // "pathRewrite": { "^/api/v2" : "/api/v2" } + // } + }, + alias: { + themes: resolve(__dirname, './src/themes'), + components: resolve(__dirname,"./src/components"), + utils: resolve(__dirname,"./src/utils"), + config: resolve(__dirname,"./src/utils/config"), + enums: resolve(__dirname,"./src/utils/enums"), + services: resolve(__dirname,"./src/services"), + models: resolve(__dirname,"./src/models"), + routes: resolve(__dirname,"./src/routes"), + }, + urlLoaderExcludes: [ + /\.svg$/, + ], + ignoreMomentLocale: true, +} diff --git a/README.md b/README.md index 93cd021..78fc267 100644 --- a/README.md +++ b/README.md @@ -108,8 +108,13 @@ git clone https://github.com/zuiidea/antd-admin.git 进入目录安装依赖: ```bash +<<<<<<< HEAD #开始前请确保没有安装roadhog、webpack到NPM全局目录, 国内用户推荐yarn或者cnpm npm i 或者 yarn install +======= +#开始前请确保没有安装roadhog、webpack到NPM全局目录 +yarn install或者 npm i +>>>>>>> develop ``` 开发: @@ -117,7 +122,7 @@ npm i 或者 yarn install ```bash npm run build:dll #第一次npm run dev时需运行此命令,使开发时编译更快 npm run dev -打开 http://localhost:8000 +打开 http://localhost:8000 #端口在package.json中cross-env后加上 PORT=8000指定 ``` 构建: diff --git a/src/mock/common.js b/mock/common.js similarity index 96% rename from src/mock/common.js rename to mock/common.js index c8b79e9..1d5436d 100644 --- a/src/mock/common.js +++ b/mock/common.js @@ -1,5 +1,5 @@ const Mock = require('mockjs') -const config = require('../utils/config') +const config = require('../src/utils/config') const queryArray = (array, key, keyAlias = 'key') => { if (!(array instanceof Array)) { diff --git a/src/mock/dashboard.js b/mock/dashboard.js similarity index 96% rename from src/mock/dashboard.js rename to mock/dashboard.js index 788bc56..9f31a4a 100644 --- a/src/mock/dashboard.js +++ b/mock/dashboard.js @@ -1,7 +1,7 @@ -import { color } from '../utils/theme' +import { color } from '../src/utils/theme' const Mock = require('mockjs') -const config = require('../utils/config') +const config = require('../src/utils/config') const { apiPrefix } = config diff --git a/src/mock/menu.js b/mock/menu.js similarity index 100% rename from src/mock/menu.js rename to mock/menu.js diff --git a/src/mock/post.js b/mock/post.js similarity index 100% rename from src/mock/post.js rename to mock/post.js diff --git a/src/mock/user.js b/mock/user.js similarity index 99% rename from src/mock/user.js rename to mock/user.js index 6dd8a8f..c3ee292 100644 --- a/src/mock/user.js +++ b/mock/user.js @@ -1,6 +1,6 @@ const qs = require('qs') const Mock = require('mockjs') -const config = require('../utils/config') +const config = require('../src/utils/config') const { apiPrefix } = config diff --git a/package.json b/package.json index 3ce5820..383fd43 100644 --- a/package.json +++ b/package.json @@ -1,74 +1,65 @@ { "private": true, "name": "antd-admin", - "version": "4.3.9", + "version": "5.0.0-beta", "dependencies": { - "antd": "^3.5.1", + "@babel/polyfill": "^7.0.0-beta.44", + "antd": "^3.5.3", "axios": "^0.18.0", - "babel-polyfill": "^6.26.0", "classnames": "^2.2.5", - "cross-env": "^5.0.5", "d3-shape": "^1.2.0", + "draftjs-to-html": "^0.8.4", "draftjs-to-markdown": "^0.5.1", - "dva": "^2.2.3", - "dva-loading": "^2.0.0", + "dva-model-extend": "^0.1.2", "echarts": "^4.1.0", - "echarts-for-react": "^2.0.8", + "echarts-for-react": "^2.0.11", "echarts-gl": "^1.1.1", "echarts-liquidfill": "^2.0.0", - "ejs-loader": "^0.3.0", - "highcharts-exporting": "^0.1.2", - "highcharts-more": "^0.1.2", - "history": "^4.7.2", - "js-beautify": "^1.6.14", + "highcharts-exporting": "^0.1.7", + "highcharts-more": "^0.1.7", "jsonp": "^0.2.1", - "less-vars-to-js": "^1.1.2", - "lodash": "^4.17.4", - "mockjs": "^1.0.1-beta3", + "lodash.clonedeep": "^4.5.0", + "lodash.isequal": "^4.5.0", "nprogress": "^0.2.0", - "path-to-regexp": "^2.1.0", - "prop-types": "^15.5.10", - "qs": "^6.5.0", + "path-to-regexp": "^2.2.0", + "prop-types": "^15.6.1", + "qs": "^6.5.2", "query-string": "^5.1.1", - "rc-tween-one": "^1.7.3", - "react": "^16.3.2", - "react-countup": "^3.0.2", - "react-dom": "^16.3.2", + "rc-tween-one": "^1.7.8", + "react-adsense": "^0.0.5", + "react-countup": "^3.0.3", "react-draft-wysiwyg": "^1.12.13", "react-helmet": "^5.2.0", "react-highcharts": "^16.0.2", "recharts": "^1.0.0-beta.10" }, "devDependencies": { - "babel-eslint": "^8.1.0", "babel-plugin-dev-expression": "^0.2.1", - "babel-plugin-dva-hmr": "^0.4.0", - "babel-plugin-import": "^1.1.1", - "babel-plugin-transform-runtime": "^6.9.0", - "babel-runtime": "^6.9.2", - "copy-webpack-plugin": "^4.0.1", - "draftjs-to-html": "^0.8.1", - "dva-model-extend": "^0.1.1", - "eslint": "^4.1.1", - "eslint-config-airbnb": "^16.1.0", - "eslint-import-resolver-node": "^0.3.1", - "eslint-loader": "^2.0.0", - "eslint-plugin-import": "^2.6.1", - "eslint-plugin-jsx-a11y": "^6.0.2", - "eslint-plugin-react": "^7.1.0", - "html-webpack-plugin": "^3.2.0", - "redbox-react": "^1.2.10", - "roadhog": "1.3.1" + "babel-plugin-module-resolver": "^3.1.0", + "cross-env": "^5.1.6", + "eslint": "^4.19.1", + "eslint-config-umi": "^0.1.4", + "eslint-plugin-flowtype": "^2.47.1", + "eslint-plugin-import": "^2.12.0", + "eslint-plugin-jsx-a11y": "^6.0.3", + "eslint-plugin-react": "^7.8.2", + "js-beautify": "^1.7.5", + "less-vars-to-js": "^1.1.2", + "mockjs": "^1.0.1-beta3", + "svg-sprite-loader": "^3.7.3", + "umi": "^1.3.4", + "umi-plugin-dll": "^0.2.1", + "umi-plugin-dva": "^0.7.3", + "umi-plugin-routes": "^0.1.4" }, "pre-commit": [ "lint" ], "scripts": { - "dev": "cross-env BROWSER=none HOST=0.0.0.0 roadhog server", - "start": "roadhog buildDll && cross-env BROWSER=none HOST=0.0.0.0 roadhog server", + "analyze": "cross-env ANALYZE=1 BABELRC=1 umi build", + "start": "cross-env BABELRC=1 COMPILE_ON_DEMAND=none BROWSER=none HOST=0.0.0.0 umi dev", "lint": "eslint --fix --ext .js src", - "build": "roadhog build", - "build:dll": "roadhog buildDll", - "build:new": "node version && roadhog build" + "build": "cross-env BABELRC=1 umi build", + "test": "umi test" } } diff --git a/src/public/antd/iconfont.eot b/public/public/antd/iconfont.eot similarity index 100% rename from src/public/antd/iconfont.eot rename to public/public/antd/iconfont.eot diff --git a/src/public/antd/iconfont.svg b/public/public/antd/iconfont.svg similarity index 100% rename from src/public/antd/iconfont.svg rename to public/public/antd/iconfont.svg diff --git a/src/public/antd/iconfont.ttf b/public/public/antd/iconfont.ttf similarity index 100% rename from src/public/antd/iconfont.ttf rename to public/public/antd/iconfont.ttf diff --git a/src/public/antd/iconfont.woff b/public/public/antd/iconfont.woff similarity index 100% rename from src/public/antd/iconfont.woff rename to public/public/antd/iconfont.woff diff --git a/src/public/assets/data-1491837999815-H1_44Qtal.jpg b/public/public/assets/data-1491837999815-H1_44Qtal.jpg similarity index 100% rename from src/public/assets/data-1491837999815-H1_44Qtal.jpg rename to public/public/assets/data-1491837999815-H1_44Qtal.jpg diff --git a/src/public/assets/data-1493804606544-r1PBU7D1W.jpg b/public/public/assets/data-1493804606544-r1PBU7D1W.jpg similarity index 100% rename from src/public/assets/data-1493804606544-r1PBU7D1W.jpg rename to public/public/assets/data-1493804606544-r1PBU7D1W.jpg diff --git a/src/public/assets/data-1493804610896-SJoBIXPkW.jpg b/public/public/assets/data-1493804610896-SJoBIXPkW.jpg similarity index 100% rename from src/public/assets/data-1493804610896-SJoBIXPkW.jpg rename to public/public/assets/data-1493804610896-SJoBIXPkW.jpg diff --git a/src/public/iconfont.css b/public/public/iconfont.css similarity index 100% rename from src/public/iconfont.css rename to public/public/iconfont.css diff --git a/src/public/iconfont.eot b/public/public/iconfont.eot similarity index 100% rename from src/public/iconfont.eot rename to public/public/iconfont.eot diff --git a/src/public/iconfont.js b/public/public/iconfont.js similarity index 100% rename from src/public/iconfont.js rename to public/public/iconfont.js diff --git a/src/public/iconfont.svg b/public/public/iconfont.svg similarity index 100% rename from src/public/iconfont.svg rename to public/public/iconfont.svg diff --git a/src/public/iconfont.ttf b/public/public/iconfont.ttf similarity index 100% rename from src/public/iconfont.ttf rename to public/public/iconfont.ttf diff --git a/src/public/iconfont.woff b/public/public/iconfont.woff similarity index 100% rename from src/public/iconfont.woff rename to public/public/iconfont.woff diff --git a/src/public/logo.svg b/public/public/logo.svg similarity index 100% rename from src/public/logo.svg rename to public/public/logo.svg diff --git a/src/components/DataTable/DataTable.js b/src/components/DataTable/DataTable.js index 4b33461..3478a5f 100644 --- a/src/components/DataTable/DataTable.js +++ b/src/components/DataTable/DataTable.js @@ -2,7 +2,8 @@ import React from 'react' import PropTypes from 'prop-types' import { Table } from 'antd' import { request } from 'utils' -import lodash from 'lodash' +import cloneDeep from 'lodash.clonedeep' +import isEqual from 'lodash.isequal' import './DataTable.less' class DataTable extends React.Component { @@ -31,12 +32,12 @@ class DataTable extends React.Component { } } - componentWillReceiveProps (nextProps) { - const staticNextProps = lodash.cloneDeep(nextProps) + UNSAFE_componentWillReceiveProps (nextProps) { + const staticNextProps = cloneDeep(nextProps) delete staticNextProps.columns const { columns, ...otherProps } = this.props - if (!lodash.isEqual(staticNextProps, otherProps)) { + if (!isEqual(staticNextProps, otherProps)) { this.props = nextProps this.fetch() } diff --git a/src/components/Layout/Header.less b/src/components/Layout/Header.less index 9312ad2..9bfde84 100644 --- a/src/components/Layout/Header.less +++ b/src/components/Layout/Header.less @@ -1,92 +1,92 @@ -@import "~themes/vars"; - -.header { - :global { - .ant-menu-submenu-title { - height: 56px; - } - - .ant-menu-horizontal { - line-height: 56px; - - & > .ant-menu-submenu:hover { - color: #1890ff; - background-color: rgba(24, 144, 255, 0.15); - } - } - - .ant-menu { - border-bottom: none; - height: 56px; - } - - .ant-menu-horizontal > .ant-menu-submenu { - top: 0; - margin-top: 0; - } - - .ant-menu-horizontal > .ant-menu-item, - .ant-menu-horizontal > .ant-menu-submenu { - border-bottom: none; - } - - .ant-menu-horizontal > .ant-menu-item-active, - .ant-menu-horizontal > .ant-menu-item-open, - .ant-menu-horizontal > .ant-menu-item-selected, - .ant-menu-horizontal > .ant-menu-item:hover, - .ant-menu-horizontal > .ant-menu-submenu-active, - .ant-menu-horizontal > .ant-menu-submenu-open, - .ant-menu-horizontal > .ant-menu-submenu-selected, - .ant-menu-horizontal > .ant-menu-submenu:hover { - border-bottom: none; - } - } - box-shadow: @shadow-2; - position: relative; - display: flex; - justify-content: space-between; - height: 56px; - z-index: 9; - display: flex; - align-items: center; - background-color: #fff; - - .rightWarpper { - display: flex; - padding-right: 16px; - } - - .button { - width: 56px; - height: 56px; - line-height: 56px; - text-align: center; - font-size: 18px; - cursor: pointer; - transition: @transition-ease-in; - - &:hover { - color: @primary-color; - background-color: fade(@primary-color, 15%); - } - } -} - -.popovermenu { - width: 280px; - margin-left: 6px; - - :global .ant-popover-inner-content { - padding: 0; - - .ant-menu-inline .ant-menu-item, - .ant-menu-vertical .ant-menu-item { - border-right: 0; - } - - .ant-menu-inline .ant-menu-item-selected, - .ant-menu-inline .ant-menu-selected { - border-right: 0; - } - } -} +@import "~themes/vars.less"; + +.header { + :global { + .ant-menu-submenu-title { + height: 56px; + } + + .ant-menu-horizontal { + line-height: 56px; + + & > .ant-menu-submenu:hover { + color: #1890ff; + background-color: rgba(24, 144, 255, 0.15); + } + } + + .ant-menu { + border-bottom: none; + height: 56px; + } + + .ant-menu-horizontal > .ant-menu-submenu { + top: 0; + margin-top: 0; + } + + .ant-menu-horizontal > .ant-menu-item, + .ant-menu-horizontal > .ant-menu-submenu { + border-bottom: none; + } + + .ant-menu-horizontal > .ant-menu-item-active, + .ant-menu-horizontal > .ant-menu-item-open, + .ant-menu-horizontal > .ant-menu-item-selected, + .ant-menu-horizontal > .ant-menu-item:hover, + .ant-menu-horizontal > .ant-menu-submenu-active, + .ant-menu-horizontal > .ant-menu-submenu-open, + .ant-menu-horizontal > .ant-menu-submenu-selected, + .ant-menu-horizontal > .ant-menu-submenu:hover { + border-bottom: none; + } + } + box-shadow: @shadow-2; + position: relative; + display: flex; + justify-content: space-between; + height: 56px; + z-index: 9; + display: flex; + align-items: center; + background-color: #fff; + + .rightWarpper { + display: flex; + padding-right: 16px; + } + + .button { + width: 56px; + height: 56px; + line-height: 56px; + text-align: center; + font-size: 18px; + cursor: pointer; + transition: @transition-ease-in; + + &:hover { + color: @primary-color; + background-color: fade(@primary-color, 15%); + } + } +} + +.popovermenu { + width: 280px; + margin-left: 6px; + + :global .ant-popover-inner-content { + padding: 0; + + .ant-menu-inline .ant-menu-item, + .ant-menu-vertical .ant-menu-item { + border-right: 0; + } + + .ant-menu-inline .ant-menu-item-selected, + .ant-menu-inline .ant-menu-selected { + border-right: 0; + } + } +} diff --git a/src/components/Layout/Layout.less b/src/components/Layout/Layout.less index 0ca5382..7fb56e0 100644 --- a/src/components/Layout/Layout.less +++ b/src/components/Layout/Layout.less @@ -1,188 +1,188 @@ -@import "~themes/vars"; - -:global { - .ant-layout-header { - padding: 0; - } - - .ant-layout-sider { - transition: all 0.3s; - - .ant-menu-root { - height: ~"calc(100vh - 144px)"; - overflow-x: hidden; - border-right: none; - - &::-webkit-scrollbar-thumb { - background-color: transparent; - } - - &:hover { - &::-webkit-scrollbar-thumb { - background-color: rgba(0, 0, 0, 0.2); - } - } - } - - .ant-menu { - .ant-menu-item, - .ant-menu-submenu-title { - overflow: hidden; - white-space: normal; - } - } - } - - .ant-layout-content { - padding: 24px; - } - - .ant-layout-footer { - text-align: center; - padding: 0 24px; - height: 40px; - font-size: 12px; - line-height: 40px; - } - - .ant-back-top { - right: 50px; - } - - .ant-switch.ant-switch-large { - line-height: 24px; - height: 26px; - - &:after, - &:before { - width: 22px; - height: 22px; - } - - &.ant-switch-checked:after, - &.ant-switch-checked:before { - margin-left: -23px; - } - } - - .flex-vertical-center { - display: flex; - align-items: center; - } - - .ant-form-item { - margin-bottom: 12px; - } -} - - - -.logo { - height: 96px; - display: flex; - align-items: center; - justify-content: center; - - img { - width: 40px; - margin-right: 8px; - } - - span { - vertical-align: text-bottom; - font-size: 16px; - text-transform: uppercase; - display: inline-block; - font-weight: 700; - color: @primary-color; - white-space: nowrap; - :local { - animation: fadeLeftIn 500ms linear; - animation-fill-mode: both; - } - } -} - -.switchtheme { - width: 100%; - position: absolute; - bottom: 0; - height: 48px; - background-color: #fff; - border-top: solid 1px #f8f8f8; - display: flex; - justify-content: space-between; - align-items: center; - padding: 0 16px; - overflow: hidden; - z-index: 9; - transition: all 0.3s; - - span { - white-space: nowrap; - overflow: hidden; - font-size: 12px; - } - - :global { - .anticon { - min-width: 14px; - margin-right: 4px; - font-size: 14px; - } - } -} - -.bread { - margin-bottom: 24px; - - :global { - .ant-breadcrumb { - display: flex; - align-items: center; - } - } -} - -.dark { - .switchtheme { - background-color: #000d18; - border-color: #001629; - } -} - -.light { - :global { - .ant-layout-sider { - background: #fff; - } - } -} -@media (max-width: 767px) { - .bread { - margin-bottom: 12px; - } - - :global { - .ant-layout-content { - padding: 12px; - } - - .ant-back-top { - right: 20px; - bottom: 20px; - } - } -} - -@keyframes fadeLeftIn { - 0% { - transform: translateX(5px); - opacity: 0; - } - - 100% { - transform: translateX(0); - opacity: 1; - } -} +@import "~themes/vars.less"; + +:global { + .ant-layout-header { + padding: 0; + } + + .ant-layout-sider { + transition: all 0.3s; + + .ant-menu-root { + height: ~"calc(100vh - 144px)"; + overflow-x: hidden; + border-right: none; + + &::-webkit-scrollbar-thumb { + background-color: transparent; + } + + &:hover { + &::-webkit-scrollbar-thumb { + background-color: rgba(0, 0, 0, 0.2); + } + } + } + + .ant-menu { + .ant-menu-item, + .ant-menu-submenu-title { + overflow: hidden; + white-space: normal; + } + } + } + + .ant-layout-content { + padding: 24px; + } + + .ant-layout-footer { + text-align: center; + padding: 0 24px; + height: 40px; + font-size: 12px; + line-height: 40px; + } + + .ant-back-top { + right: 50px; + } + + .ant-switch.ant-switch-large { + line-height: 24px; + height: 26px; + + &:after, + &:before { + width: 22px; + height: 22px; + } + + &.ant-switch-checked:after, + &.ant-switch-checked:before { + margin-left: -23px; + } + } + + .flex-vertical-center { + display: flex; + align-items: center; + } + + .ant-form-item { + margin-bottom: 12px; + } +} + + + +.logo { + height: 96px; + display: flex; + align-items: center; + justify-content: center; + + img { + width: 40px; + margin-right: 8px; + } + + span { + vertical-align: text-bottom; + font-size: 16px; + text-transform: uppercase; + display: inline-block; + font-weight: 700; + color: @primary-color; + white-space: nowrap; + :local { + animation: fadeLeftIn 500ms linear; + animation-fill-mode: both; + } + } +} + +.switchtheme { + width: 100%; + position: absolute; + bottom: 0; + height: 48px; + background-color: #fff; + border-top: solid 1px #f8f8f8; + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 16px; + overflow: hidden; + z-index: 9; + transition: all 0.3s; + + span { + white-space: nowrap; + overflow: hidden; + font-size: 12px; + } + + :global { + .anticon { + min-width: 14px; + margin-right: 4px; + font-size: 14px; + } + } +} + +.bread { + margin-bottom: 24px; + + :global { + .ant-breadcrumb { + display: flex; + align-items: center; + } + } +} + +.dark { + .switchtheme { + background-color: #000d18; + border-color: #001629; + } +} + +.light { + :global { + .ant-layout-sider { + background: #fff; + } + } +} +@media (max-width: 767px) { + .bread { + margin-bottom: 12px; + } + + :global { + .ant-layout-content { + padding: 12px; + } + + .ant-back-top { + right: 20px; + bottom: 20px; + } + } +} + +@keyframes fadeLeftIn { + 0% { + transform: translateX(5px); + opacity: 0; + } + + 100% { + transform: translateX(0); + opacity: 1; + } +} diff --git a/src/components/Layout/Menu.js b/src/components/Layout/Menu.js index 4d9ad6a..015c27f 100644 --- a/src/components/Layout/Menu.js +++ b/src/components/Layout/Menu.js @@ -5,6 +5,9 @@ import { Link } from 'react-router-dom' import { arrayToTree, queryArray } from 'utils' import pathToRegexp from 'path-to-regexp' +const { SubMenu } = Menu +let openKeysFlag = false + const Menus = ({ siderFold, darkTheme, navOpenKeys, changeOpenKeys, menu, location, }) => { @@ -20,7 +23,7 @@ const Menus = ({ levelMap[item.id] = item.mpid } return ( -