diff --git a/.eslintrc b/.eslintrc index 01f5ef78..343890d1 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,45 +1,49 @@ { "extends": "airbnb", "rules": { - "semi": [2, "never"], - "no-console": 0, + "arrow-body-style": [0, "never"], "comma-dangle": [2, "always-multiline"], + "global-require": 0, + "func-names": 0, + "prefer-const": 0, + "import/no-unresolved": 0, + "import/extensions": 0, "max-len": 0, - "react/jsx-first-prop-new-line": 0, - "react/jsx-filename-extension": 0, - "space-before-function-paren": [2, "always"], "no-unused-expressions": [0, { "allowShortCircuit": true, "allowTernary": true }], - "arrow-body-style": [0, "never"], - "func-names": 0, - "prefer-const": 0, + "no-console": 0, "no-extend-native": 0, "no-param-reassign": 0, "no-restricted-syntax": 0, "no-eval": 0, "no-continue": 0, - "react/jsx-no-bind": 0, + "no-mixed-operators": 0, + "no-plusplus": 0, "no-unused-vars": [2, { "ignoreRestSiblings": true }], "no-underscore-dangle": 0, - "global-require": 0, - "import/no-unresolved": 0, - "import/extensions": 0, + "space-before-function-paren": [2, "always"], + "semi": [2, "never"], + "import/no-extraneous-dependencies": 0, + "import/prefer-default-export": 0, + "jsx-a11y/no-static-element-interactions": 0, + "jsx-a11y/click-events-have-key-events": 0, "jsx-a11y/href-no-hash": 0, + "jsx-a11y/anchor-is-valid": 0, + "jsx-a11y/label-has-for": 0, "react/no-array-index-key": 0, "react/require-default-props": 0, "react/forbid-prop-types": 0, "react/no-string-refs": 0, "react/no-find-dom-node": 0, "react/prefer-stateless-function": 0, - "import/no-extraneous-dependencies": 0, - "import/prefer-default-export": 0, + "react/jsx-closing-tag-location": 0, + "react/sort-comp": 0, + "react/jsx-no-bind": 0, "react/no-danger": 0, - "jsx-a11y/no-static-element-interactions": 0, - "no-mixed-operators": 0, - "jsx-a11y/label-has-for": 0, - "no-plusplus": 0 + "react/jsx-first-prop-new-line": 0, + "react/jsx-filename-extension": 0 }, "parser": "babel-eslint", "parserOptions": { diff --git a/README.md b/README.md index 14c48e6b..4b741ca4 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Antd Admin -[![React](https://img.shields.io/badge/react-^15.6.1-brightgreen.svg?style=flat-square)](https://github.com/facebook/react) -[![Ant Design](https://img.shields.io/badge/ant--design-^2.11.2-yellowgreen.svg?style=flat-square)](https://github.com/ant-design/ant-design) -[![dva](https://img.shields.io/badge/dva-^2.0.1-orange.svg?style=flat-square)](https://github.com/dvajs/dva) +[![React](https://img.shields.io/badge/react-^16.2.0-brightgreen.svg?style=flat-square)](https://github.com/facebook/react) +[![Ant Design](https://img.shields.io/badge/ant--design-^3.0.3-yellowgreen.svg?style=flat-square)](https://github.com/ant-design/ant-design) +[![dva](https://img.shields.io/badge/dva-^2.1.0-orange.svg?style=flat-square)](https://github.com/dvajs/dva) [![GitHub issues](https://img.shields.io/github/issues/zuiidea/antd-admin.svg?style=flat-square)](https://github.com/zuiidea/antd-admin) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/zuiidea/antd-admin/pulls) @@ -21,6 +21,13 @@ ## 更新日志 +### 4.3.9 + +`2017-12-27` + +-   更新`antd`至`3.0.3`,以及其它主要库,并解决升级带来的兼容问题。 +- 尽可能的保持`antd`的设计语言。 + ### 4.3.7 `2017-10-30` diff --git a/package.json b/package.json index 8b4113b5..6f56ac2a 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,17 @@ { "private": true, "name": "antd-admin", - "version": "4.3.7", + "version": "4.3.9", "dependencies": { - "antd": "^2.13.8", - "axios": "^0.16.2", + "antd": "3.0.3", + "axios": "^0.17.1", "babel-polyfill": "^6.23.0", "classnames": "^2.2.5", "cross-env": "^5.0.5", "d3-shape": "^1.2.0", - "draftjs-to-markdown": "^0.4.0", - "dva": "^2.0.1", - "dva-loading": "^0.2.0", + "draftjs-to-markdown": "^0.5.0", + "dva": "2.1.0", + "dva-loading": "^1.0.4", "echarts": "^3.7.2", "echarts-for-react": "^2.0.0", "echarts-gl": "^1.0.0-beta.5", @@ -26,31 +26,31 @@ "lodash": "^4.17.4", "mockjs": "^1.0.1-beta3", "nprogress": "^0.2.0", - "path-to-regexp": "^1.7.0", + "path-to-regexp": "^2.1.0", "prop-types": "^15.5.10", "qs": "^6.5.0", "query-string": "^5.0.0", "rc-tween-one": "^1.3.1", - "react": "^15.6.1", - "react-countup": "^2.1.1", - "react-dom": "^15.6.1", + "react": "^16.2.0", + "react-countup": "^3.0.2", + "react-dom": "^16.2.0", "react-draft-wysiwyg": "^1.10.0", "react-helmet": "^5.1.3", - "react-highcharts": "^13.0.0", + "react-highcharts": "^15.0.0", "recharts": "^1.0.0-beta.0" }, "devDependencies": { - "babel-eslint": "^7.2.3", + "babel-eslint": "^8.1.0", "babel-plugin-dev-expression": "^0.2.1", - "babel-plugin-dva-hmr": "^0.3.2", + "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.7.0", + "draftjs-to-html": "^0.8.1", "dva-model-extend": "^0.1.1", "eslint": "^4.1.1", - "eslint-config-airbnb": "^15.0.2", + "eslint-config-airbnb": "^16.1.0", "eslint-import-resolver-node": "^0.3.1", "eslint-loader": "^1.9.0", "eslint-plugin-import": "^2.6.1", @@ -58,7 +58,7 @@ "eslint-plugin-react": "^7.1.0", "html-webpack-plugin": "^2.29.0", "redbox-react": "^1.2.10", - "roadhog": "^1.2.2" + "roadhog": "1.3.1" }, "pre-commit": ["lint"], "scripts": { @@ -69,4 +69,4 @@ "build:dll": "roadhog buildDll", "build:new": "node version && roadhog build" } -} +} \ No newline at end of file diff --git a/src/components/DataTable/DataTable.js b/src/components/DataTable/DataTable.js index 597c424b..4b33461e 100644 --- a/src/components/DataTable/DataTable.js +++ b/src/components/DataTable/DataTable.js @@ -8,12 +8,14 @@ import './DataTable.less' class DataTable extends React.Component { constructor (props) { super(props) - const { dataSource, pagination = { - showSizeChanger: true, - showQuickJumper: true, - showTotal: total => `共 ${total} 条`, - current: 1, - total: 100 }, + const { + dataSource, pagination = { + showSizeChanger: true, + showQuickJumper: true, + showTotal: total => `共 ${total} 条`, + current: 1, + total: 100, + }, } = props this.state = { loading: false, @@ -97,13 +99,12 @@ class DataTable extends React.Component { } } - DataTable.propTypes = { fetch: PropTypes.object, rowKey: PropTypes.string, - pagination: React.PropTypes.oneOfType([ - React.PropTypes.bool, - React.PropTypes.object, + pagination: PropTypes.oneOfType([ + PropTypes.bool, + PropTypes.object, ]), columns: PropTypes.array, dataSource: PropTypes.array, diff --git a/src/components/Layout/Bread.js b/src/components/Layout/Bread.js index 5ce0a9f9..e20f1592 100644 --- a/src/components/Layout/Bread.js +++ b/src/components/Layout/Bread.js @@ -4,7 +4,7 @@ import { Breadcrumb, Icon } from 'antd' import { Link } from 'react-router-dom' import pathToRegexp from 'path-to-regexp' import { queryArray } from 'utils' -import styles from './Bread.less' +import styles from './Layout.less' const Bread = ({ menu, location }) => { // 匹配当前路由 diff --git a/src/components/Layout/Bread.less b/src/components/Layout/Bread.less deleted file mode 100644 index 01568a4d..00000000 --- a/src/components/Layout/Bread.less +++ /dev/null @@ -1,8 +0,0 @@ -@import "~themes/vars"; - -.bread { - height: 64px; - line-height: 64px; - padding: 0 24px; - margin-bottom: -24px; -} diff --git a/src/components/Layout/Footer.js b/src/components/Layout/Footer.js deleted file mode 100644 index 50866a50..00000000 --- a/src/components/Layout/Footer.js +++ /dev/null @@ -1,9 +0,0 @@ -import React from 'react' -import { config } from 'utils' -import styles from './Footer.less' - -const Footer = () => (
- {config.footerText} -
) - -export default Footer diff --git a/src/components/Layout/Footer.less b/src/components/Layout/Footer.less deleted file mode 100644 index 728a8224..00000000 --- a/src/components/Layout/Footer.less +++ /dev/null @@ -1,12 +0,0 @@ -@import "~themes/vars"; - -.footer { - height: 48px; - line-height: 48px; - text-align: center; - font-size: 12px; - color: #999; - background: #fff; - box-shadow: @shadow-2; - width: 100%; -} diff --git a/src/components/Layout/Header.js b/src/components/Layout/Header.js index 8b13ac74..42fba181 100644 --- a/src/components/Layout/Header.js +++ b/src/components/Layout/Header.js @@ -1,13 +1,15 @@ import React from 'react' import PropTypes from 'prop-types' -import { Menu, Icon, Popover } from 'antd' +import { Menu, Icon, Popover, Layout } from 'antd' import classnames from 'classnames' import styles from './Header.less' import Menus from './Menu' -const SubMenu = Menu.SubMenu +const { SubMenu } = Menu -const Header = ({ user, logout, switchSider, siderFold, isNavbar, menuPopoverVisible, location, switchMenuPopover, navOpenKeys, changeOpenKeys, menu }) => { +const Header = ({ + user, logout, switchSider, siderFold, isNavbar, menuPopoverVisible, location, switchMenuPopover, navOpenKeys, changeOpenKeys, menu, +}) => { let handleClickMenu = e => e.key === 'logout' && logout() const menusProps = { menu, @@ -20,7 +22,7 @@ const Header = ({ user, logout, switchSider, siderFold, isNavbar, menuPopoverVis changeOpenKeys, } return ( -
+ {isNavbar ? }>
@@ -53,7 +55,7 @@ const Header = ({ user, logout, switchSider, siderFold, isNavbar, menuPopoverVis
-
+ ) } diff --git a/src/components/Layout/Header.less b/src/components/Layout/Header.less index 115f7622..9312ad2c 100644 --- a/src/components/Layout/Header.less +++ b/src/components/Layout/Header.less @@ -1,20 +1,55 @@ @import "~themes/vars"; .header { - :global .ant-menu-horizontal { - & > .ant-menu-submenu { - float: right; + :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; } - border: none; - display: inline-block; } box-shadow: @shadow-2; position: relative; display: flex; justify-content: space-between; - height: 47px; + height: 56px; + z-index: 9; + display: flex; + align-items: center; background-color: #fff; - z-index: 999; .rightWarpper { display: flex; @@ -22,9 +57,9 @@ } .button { - width: 47px; - height: 47px; - line-height: 47px; + width: 56px; + height: 56px; + line-height: 56px; text-align: center; font-size: 18px; cursor: pointer; @@ -47,8 +82,6 @@ .ant-menu-inline .ant-menu-item, .ant-menu-vertical .ant-menu-item { border-right: 0; - height: 48px; - line-height: 48px; } .ant-menu-inline .ant-menu-item-selected, diff --git a/src/components/Layout/Layout.less b/src/components/Layout/Layout.less index 98b24b00..42c4fb68 100644 --- a/src/components/Layout/Layout.less +++ b/src/components/Layout/Layout.less @@ -1,295 +1,169 @@ @import "~themes/vars"; -.layout { - position: relative; - height: 100vh; - - &.withnavbar { - .main { - margin-left: 0; - } +:global { + .ant-layout-header { + padding: 0; } - &.fold { - .sider { - width: 42px; - - .logo { - img { - width: 28px; - margin: 6px 7px; - } - } - - :global { - .ant-menu-root { - width: 100%; - overflow: visible; - - & > .ant-menu-item { - padding: 0; - text-align: center; - - .anticon { - font-size: 14px; - margin-right: 0; - } - } - - & > .ant-menu-submenu { - & > .ant-menu-submenu-title { - padding: 0; - text-align: center; - - .anticon { - font-size: 14px; - margin-right: 0; - } - - &::after { - display: none; - } - } - } - } - } - } - - .main { - margin-left: 42px; - } - } - - .sider { - width: 224px; - background: #3e3e3e; - position: absolute; - overflow: visible; - padding-bottom: 24px; - height: 100vh; - transition: @transition-ease-out; - box-shadow: @shadow-1; - color: #999; - - &.light { - background: #fff; - - .switchtheme { - background: #fff; - border-top: solid 1px #f8f8f8; - } - } - - .logo { - text-align: center; - height: 40px; - line-height: 40px; - cursor: pointer; - margin: 28px 0; - transition: @transition-ease-out; - overflow: hidden; + .ant-layout-sider { + transition: all 0.3s; - img { - width: 40px; - margin-right: 8px; - transition: @transition-ease-out; - } + .ant-menu-root { + height: ~"calc(100vh - 144px)"; + overflow-x: hidden; + border-right: none; - span { - vertical-align: text-bottom; - font-size: 16px; - text-transform: uppercase; - display: inline-block; + &::-webkit-scrollbar-thumb { + background-color: transparent; } - .anticon { - transition: @transition-ease-out; + &:hover { + &::-webkit-scrollbar-thumb { + background-color: rgba(0, 0, 0, 0.2); + } } } - .switchtheme { - width: 100%; - position: absolute; - bottom: 0; - height: 48px; - background-color: @dark-half; - display: flex; - justify-content: space-between; - align-items: center; - padding: 0 16px 0 24px; - overflow: hidden; - z-index: 1000; - - span { - white-space: nowrap; + .ant-menu { + .ant-menu-item, + .ant-menu-submenu-title { overflow: hidden; - } - - :global { - .anticon { - min-width: 14px; - margin-right: 8px; - font-size: 14px; - } + white-space: normal; } } + } - :global { - .ant-menu-dark, - .ant-menu-dark .ant-menu-sub { - color: #999; - } - - .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-vertical { - .ant-menu-sub { - height: 0; - opacity: 0; - transition: none; - } - - .ant-menu-submenu-active { - .ant-menu-sub { - height: auto; - opacity: 1; - } - } - } - } - - .ant-menu { - transition: @transition-ease-out; + .ant-layout-content { + padding: 24px; + } - .ant-menu-item, - .ant-menu-submenu-title { - overflow: hidden; - white-space: normal; - } - } - } + .ant-layout-footer { + text-align: center; + padding: 0 24px; + height: 40px; + font-size: 12px; + line-height: 40px; } - .main { - margin-left: 224px; - overflow: auto; - height: 100vh; - transition: @transition-ease-out; + .ant-back-top { + right: 50px; + } - :global { - .content-inner { - background: #fff; - padding: 24px; - box-shadow: @shadow-1; - min-height: e("calc(100vh - 184px)"); - } - } + .ant-switch.ant-switch-large { + line-height: 24px; + height: 26px; - .container { - margin: 24px; + &:after, + &:before { + width: 22px; + height: 22px; } - .content { - min-height: e("calc(100vh - 184px)"); - position: relative; + &.ant-switch-checked:after, + &.ant-switch-checked:before { + margin-left: -23px; } } -} - -:global .ant-menu-dark { - color: #999; - background-color: #3e3e3e; - .ant-menu-submenu-title:hover, - .ant-menu-submenu:hover { - color: @primary-color; + .flex-vertical-center { + display: flex; + align-items: center; } - .ant-menu-sub { - color: #999; + .ant-form-item { + margin-bottom: 12px; } +} - .ant-menu-submenu-selected { - color: @primary-color; +.logo { + height: 96px; + display: flex; + align-items: center; + justify-content: center; - &:not(.ant-menu-submenu-open) { - background-color: @dark-half; - } + img { + width: 40px; + margin-right: 8px; } - .ant-menu-item, - .ant-menu-submenu-title { - & > a { - color: #999; - } + span { + vertical-align: text-bottom; + font-size: 16px; + text-transform: uppercase; + display: inline-block; + font-weight: 700; + color: @primary-color; + } +} - &:hover > a { - color: @primary-color; - } +.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; } - &.ant-menu-inline { - .ant-menu-item-selected { - background-color: @dark-half; + :global { + .anticon { + min-width: 14px; + margin-right: 4px; + font-size: 14px; } } +} - .ant-menu-item-selected { - color: @primary-color; - - &.ant-menu-item { - background: @dark-half; - } +.bread { + margin-bottom: 24px; - & > a { - color: @primary-color; + :global { + .ant-breadcrumb { + display: flex; + align-items: center; } + } +} - &:hover { - background-color: @dark-half; - } +.dark { + .switchtheme { + background-color: #000d18; + border-color: #001629; } } -.spin { - :global .ant-spin-container { - height: 100vh; +.light { + :global { + .ant-layout-sider { + background: #fff; + } } } @media (max-width: 767px) { - .layout { - .main { - .container { - margin: 12px; - } - - .bread { - padding: 0 12px; - } + .bread { + margin-bottom: 12px; + } - .content { - min-height: e("calc(100vh - 160px)"); - } + :global { + .ant-layout-content { + padding: 12px; + } - :global { - .content-inner { - padding: 12px; - min-height: e("calc(100vh - 160px)"); - } - } + .ant-back-top { + right: 20px; + bottom: 20px; } } } diff --git a/src/components/Layout/Sider.js b/src/components/Layout/Sider.js index e47a7e86..90f2952f 100644 --- a/src/components/Layout/Sider.js +++ b/src/components/Layout/Sider.js @@ -5,7 +5,9 @@ import { config } from 'utils' import styles from './Layout.less' import Menus from './Menu' -const Sider = ({ siderFold, darkTheme, location, changeTheme, navOpenKeys, changeOpenKeys, menu }) => { +const Sider = ({ + siderFold, darkTheme, location, changeTheme, navOpenKeys, changeOpenKeys, menu, +}) => { const menusProps = { menu, siderFold, @@ -17,7 +19,7 @@ const Sider = ({ siderFold, darkTheme, location, changeTheme, navOpenKeys, chang return (
- {'logo'} + logo {siderFold ? '' : {config.name}}
diff --git a/src/components/Layout/Sider.less b/src/components/Layout/Sider.less deleted file mode 100644 index 3ace2a60..00000000 --- a/src/components/Layout/Sider.less +++ /dev/null @@ -1 +0,0 @@ -@import "~themes/vars"; diff --git a/src/components/Layout/index.js b/src/components/Layout/index.js index e927075a..c170d876 100644 --- a/src/components/Layout/index.js +++ b/src/components/Layout/index.js @@ -2,7 +2,6 @@ import Header from './Header' import Menu from './Menu' import Bread from './Bread' import Sider from './Sider' -import Footer from './Footer' import styles from './Layout.less' -export { Header, Menu, Bread, Sider, Footer, styles } +export { Header, Menu, Bread, Sider, styles } diff --git a/src/components/Loader/Loader.less b/src/components/Loader/Loader.less index fed0403f..4ecbe52d 100644 --- a/src/components/Loader/Loader.less +++ b/src/components/Loader/Loader.less @@ -26,8 +26,8 @@ } .inner { - width: 48px; - height: 48px; + width: 40px; + height: 40px; margin: 0 auto; text-indent: -12345px; border-top: 1px solid rgba(0, 0, 0, 0.08); diff --git a/src/components/Page/Page.less b/src/components/Page/Page.less index 5a1e1b5e..0a8156f2 100644 --- a/src/components/Page/Page.less +++ b/src/components/Page/Page.less @@ -4,11 +4,13 @@ background: #fff; padding: 24px; box-shadow: @shadow-1; - min-height: e("calc(100vh - 184px)"); + min-height: ~"calc(100vh - 198px)"; + position: relative; } + @media (max-width: 767px) { .contentInner { padding: 12px; - min-height: e("calc(100vh - 160px)"); + min-height: ~"calc(100vh - 160px)"; } } diff --git a/src/components/Search/Search.less b/src/components/Search/Search.less index 4c232f70..60d1f476 100644 --- a/src/components/Search/Search.less +++ b/src/components/Search/Search.less @@ -1,55 +1,54 @@ -.no-highlight() { - border-color: #e5e5e5; - box-shadow: none; -} - -.search { - display: flex; - width: 100%; - position: relative; - - :global { - .anticon-cross { - position: absolute; - width: 18px; - height: 18px; - right: 84px; - cursor: pointer; - color: #fff; - line-height: 18px; - border-radius: 50%!important; - background-color: rgba(0, 0, 0, .16); - top: 7px; - // opacity: - } - - .ant-select { - width: 80px; - flex-shrink: 0; - flex-grow: 0; - - &.ant-select-focused .ant-select-selection, - &.ant-select-open .ant-select-selection, - .ant-select-selection:active, - .ant-select-selection:focus, - .ant-select-selection:hover { - .no-highlight(); - } - } - - .ant-input { - &:focus, - &:hover { - .no-highlight(); - } - flex-shrink: 1; - flex-grow: 1; - } - - .ant-btn { - width: 80px; - flex-shrink: 0; - flex-grow: 0; - } - } -} +.no-highlight() { + border-color: #e5e5e5; + box-shadow: none; +} + +.search { + display: flex !important; + width: 100%; + position: relative; + + :global { + .anticon-cross { + position: absolute; + width: 18px; + height: 18px; + right: 84px; + cursor: pointer; + color: #fff; + line-height: 18px; + border-radius: 50%!important; + background-color: rgba(0, 0, 0, .16); + top: 7px; + } + + .ant-select { + width: 80px; + flex-shrink: 0; + flex-grow: 0; + + &.ant-select-focused .ant-select-selection, + &.ant-select-open .ant-select-selection, + .ant-select-selection:active, + .ant-select-selection:focus, + .ant-select-selection:hover { + .no-highlight(); + } + } + + .ant-input { + &:focus, + &:hover { + .no-highlight(); + } + flex-shrink: 1; + flex-grow: 1; + } + + .ant-btn { + width: 80px; + flex-shrink: 0; + flex-grow: 0; + } + } +} diff --git a/src/components/index.js b/src/components/index.js index 492e40cb..bd8d8a0b 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -5,13 +5,13 @@ import Search from './Search' import Editor from './Editor' import FilterItem from './FilterItem' import Loader from './Loader' -import * as Layout from './Layout/index.js' +import * as MyLayout from './Layout/index.js' import Page from './Page' import layer from './layer' export { - Layout, + MyLayout, DataTable, DropOption, Iconfont, diff --git a/src/mock/menu.js b/src/mock/menu.js index ad308253..7a513117 100644 --- a/src/mock/menu.js +++ b/src/mock/menu.js @@ -4,7 +4,7 @@ const { apiPrefix } = config let database = [ { id: '1', - icon: 'laptop', + icon: 'dashboard', name: 'Dashboard', route: '/dashboard', }, @@ -50,14 +50,14 @@ let database = [ icon: 'heart-o', route: '/UIElement/iconfont', }, - { - id: '42', - bpid: '4', - mpid: '4', - name: 'DataTable', - icon: 'database', - route: '/UIElement/dataTable', - }, + // { + // id: '42', + // bpid: '4', + // mpid: '4', + // name: 'DataTable', + // icon: 'database', + // route: '/UIElement/dataTable', + // }, { id: '43', bpid: '4', @@ -74,22 +74,22 @@ let database = [ icon: 'search', route: '/UIElement/search', }, - { - id: '45', - bpid: '4', - mpid: '4', - name: 'Editor', - icon: 'edit', - route: '/UIElement/editor', - }, - { - id: '46', - bpid: '4', - mpid: '4', - name: 'layer (Function)', - icon: 'credit-card', - route: '/UIElement/layer', - }, + // { + // id: '45', + // bpid: '4', + // mpid: '4', + // name: '56pxor', + // icon: 'edit', + // route: '/UIElement/editor', + // }, + // { + // id: '46', + // bpid: '4', + // mpid: '4', + // name: 'layer (Function)', + // icon: 'credit-card', + // route: '/UIElement/layer', + // }, { id: '5', bpid: '1', diff --git a/src/models/post.js b/src/models/post.js index 1e3c7a13..797dcf53 100644 --- a/src/models/post.js +++ b/src/models/post.js @@ -11,11 +11,13 @@ export default modelExtend(pageModel, { setup ({ dispatch, history }) { history.listen((location) => { if (location.pathname === '/post') { - dispatch({ type: 'query', + dispatch({ + type: 'query', payload: { status: 2, ...queryString.parse(location.search), - } }) + }, + }) } }) }, diff --git a/src/models/user.js b/src/models/user.js index 8c58fe87..6af67a25 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -1,5 +1,6 @@ /* global window */ import modelExtend from 'dva-model-extend' +import queryString from 'query-string' import { config } from 'utils' import { create, remove, update } from 'services/user' import * as usersService from 'services/users' @@ -23,7 +24,7 @@ export default modelExtend(pageModel, { setup ({ dispatch, history }) { history.listen((location) => { if (location.pathname === '/user') { - const payload = location.query || { page: 1, pageSize: 10 } + const payload = queryString.parse(location.search) || { page: 1, pageSize: 10 } dispatch({ type: 'query', payload, diff --git a/src/public/logo.png b/src/public/logo.png deleted file mode 100644 index b98342a7..00000000 Binary files a/src/public/logo.png and /dev/null differ diff --git a/src/public/logo.svg b/src/public/logo.svg new file mode 100644 index 00000000..e9f8c2a9 --- /dev/null +++ b/src/public/logo.svg @@ -0,0 +1,43 @@ + + + + Group 28 Copy 5 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/routes/UIElement/dropOption/index.js b/src/routes/UIElement/dropOption/index.js index 33420a7a..5adf28e2 100644 --- a/src/routes/UIElement/dropOption/index.js +++ b/src/routes/UIElement/dropOption/index.js @@ -1,8 +1,8 @@ import React from 'react' -import { DropOption } from 'components' +import { DropOption, Page } from 'components' import { Table, Row, Col, Card, message } from 'antd' -const DropOptionPage = () => (
+const DropOptionPage = () => ( @@ -90,6 +90,6 @@ const DropOptionPage = () => (
/> -
) +
) export default DropOptionPage diff --git a/src/routes/UIElement/iconfont/index.js b/src/routes/UIElement/iconfont/index.js index 93fc43f5..3ed7f6c0 100644 --- a/src/routes/UIElement/iconfont/index.js +++ b/src/routes/UIElement/iconfont/index.js @@ -1,5 +1,5 @@ import React from 'react' -import { Iconfont } from 'components' +import { Iconfont, Page } from 'components' import { Table, Row, Col, Icon } from 'antd' import styles from './index.less' import './emoji' @@ -24,7 +24,7 @@ const localRequireSVGIcons = [ require('../../../svg/cute/think.svg'), ] -const IcoPage = () => (
+const IcoPage = () => (

Colorful Icon

) +) export default IcoPage diff --git a/src/routes/UIElement/search/index.js b/src/routes/UIElement/search/index.js index 2ae57f71..3546b637 100644 --- a/src/routes/UIElement/search/index.js +++ b/src/routes/UIElement/search/index.js @@ -1,8 +1,8 @@ import React from 'react' -import { Search } from 'components' +import { Search, Page } from 'components' import { Table, Row, Col, Card } from 'antd' -const SearchPage = () => (
+const SearchPage = () => ( @@ -27,7 +27,7 @@ const SearchPage = () => (
- + @@ -93,6 +93,6 @@ const SearchPage = () => (
/> -
) +) export default SearchPage diff --git a/src/routes/app.js b/src/routes/app.js index fcd52ac8..91bd1a8b 100644 --- a/src/routes/app.js +++ b/src/routes/app.js @@ -5,28 +5,33 @@ import NProgress from 'nprogress' import PropTypes from 'prop-types' import pathToRegexp from 'path-to-regexp' import { connect } from 'dva' -import { Layout, Loader } from 'components' -import { BackTop } from 'antd' +import { Loader, MyLayout } from 'components' +import { BackTop, Layout } from 'antd' import { classnames, config } from 'utils' import { Helmet } from 'react-helmet' import { withRouter } from 'dva/router' +import Error from './error' import '../themes/index.less' import './app.less' -import Error from './error' +const { Content, Footer, Sider } = Layout +const { Header, Bread, styles } = MyLayout const { prefix, openPages } = config -const { Header, Bread, Footer, Sider, styles } = Layout let lastHref -const App = ({ children, dispatch, app, loading, location }) => { - const { user, siderFold, darkTheme, isNavbar, menuPopoverVisible, navOpenKeys, menu, permissions } = app +const App = ({ + children, dispatch, app, loading, location, +}) => { + const { + user, siderFold, darkTheme, isNavbar, menuPopoverVisible, navOpenKeys, menu, permissions, + } = app let { pathname } = location pathname = pathname.startsWith('/') ? pathname : `/${pathname}` const { iconFontJS, iconFontCSS, logo } = config const current = menu.filter(item => pathToRegexp(item.route || '').exec(pathname)) const hasPermission = current.length ? permissions.visit.includes(current[0].id) : false - const href = window.location.href + const { href } = window.location if (lastHref !== href) { NProgress.start() @@ -77,12 +82,14 @@ const App = ({ children, dispatch, app, loading, location }) => { menu, location, } + if (openPages && openPages.includes(pathname)) { return (
{children}
) } + return (
@@ -93,22 +100,27 @@ const App = ({ children, dispatch, app, loading, location }) => { {iconFontJS &&