diff --git a/package.json b/package.json index 57d2735..d548701 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "cross-env": "^5.0.5", "d3-shape": "^1.2.0", "draftjs-to-markdown": "^0.5.0", - "dva": "^2.0.1", + "dva": "2.1.0", "dva-loading": "^1.0.4", "echarts": "^3.7.2", "echarts-for-react": "^2.0.0", diff --git a/src/components/Layout/Layout.less b/src/components/Layout/Layout.less index d750bbd..f310219 100644 --- a/src/components/Layout/Layout.less +++ b/src/components/Layout/Layout.less @@ -1,7 +1,6 @@ @import "~themes/vars"; :global { - .ant-layout-header { padding: 0; } @@ -40,27 +39,20 @@ .ant-layout-footer { text-align: center; - padding: 24px; - } - - .content-inner { - background: #fff; - padding: 24px; - box-shadow: @shadow-1; - min-height: e("calc(100vh - 184px)"); + padding: 0 24px; + height: 40px; + font-size: 12px; + line-height: 40px; } .ant-back-top { right: 50px; } - .ant-switch { + .ant-switch.ant-switch-large { + line-height: 24px; + height: 26px; - } - -.ant-switch.ant-switch-large{ - line-height: 24px; - height: 26px; &:after, &:before { width: 22px; @@ -72,11 +64,15 @@ margin-left: -23px; } } -.flex-vertical-center{ - display: flex; - align-items: center -} + .flex-vertical-center { + display: flex; + align-items: center; + } + + .ant-form-item { + margin-bottom: 12px; + } } .logo { diff --git a/src/components/Page/Page.less b/src/components/Page/Page.less index dd2e3a6..0a8156f 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/mock/menu.js b/src/mock/menu.js index a8cd471..7a51311 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', }, @@ -74,14 +74,14 @@ let database = [ icon: 'search', route: '/UIElement/search', }, - { - id: '45', - bpid: '4', - mpid: '4', - name: 'Editor', - icon: 'edit', - route: '/UIElement/editor', - }, + // { + // id: '45', + // bpid: '4', + // mpid: '4', + // name: '56pxor', + // icon: 'edit', + // route: '/UIElement/editor', + // }, // { // id: '46', // bpid: '4', diff --git a/src/models/post.js b/src/models/post.js index 1e3c7a1..797dcf5 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 8c58fe8..6af67a2 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/routes/app.js b/src/routes/app.js index ba1cf49..91bd1a8 100644 --- a/src/routes/app.js +++ b/src/routes/app.js @@ -121,7 +121,6 @@ const App = ({ - ) } diff --git a/src/routes/error/index.js b/src/routes/error/index.js index 637a48f..75fd68b 100644 --- a/src/routes/error/index.js +++ b/src/routes/error/index.js @@ -1,12 +1,13 @@ import React from 'react' import { Icon } from 'antd' import styles from './index.less' +import { Page } from 'components' -const Error = () => (
+const Error = () => (

404 Not Found

-
) +) export default Error diff --git a/src/routes/post/index.js b/src/routes/post/index.js index 40be20d..caa2f2e 100644 --- a/src/routes/post/index.js +++ b/src/routes/post/index.js @@ -3,9 +3,10 @@ import PropTypes from 'prop-types' import { connect } from 'dva' import { Tabs } from 'antd' import { routerRedux } from 'dva/router' +import queryString from 'query-string' import List from './List' -const TabPane = Tabs.TabPane +const { TabPane } = Tabs const EnumPostStatus = { UNPUBLISH: 1, @@ -13,9 +14,13 @@ const EnumPostStatus = { } -const Index = ({ post, dispatch, loading, location }) => { +const Index = ({ + post, dispatch, loading, location, +}) => { const { list, pagination } = post - const { query = {}, pathname } = location + location.query = queryString.parse(location.search) + const { query, pathname } = location + console.log(location, query, pathname) const listProps = { pagination, @@ -24,11 +29,11 @@ const Index = ({ post, dispatch, loading, location }) => { onChange (page) { dispatch(routerRedux.push({ pathname, - query: { + search: queryString.stringify({ ...query, page: page.current, pageSize: page.pageSize, - }, + }), })) }, } @@ -36,9 +41,9 @@ const Index = ({ post, dispatch, loading, location }) => { const handleTabClick = (key) => { dispatch(routerRedux.push({ pathname, - query: { + search: queryString.stringify({ status: key, - }, + }), })) } diff --git a/src/routes/user/index.js b/src/routes/user/index.js index fb74321..359db75 100644 --- a/src/routes/user/index.js +++ b/src/routes/user/index.js @@ -14,6 +14,7 @@ const User = ({ location, dispatch, user, loading, }) => { location.query = queryString.parse(location.search) + const { query, pathname } = location const { list, pagination, currentItem, modalVisible, modalType, isMotion, selectedRowKeys, } = user @@ -46,14 +47,13 @@ const User = ({ location, isMotion, onChange (page) { - const { query, pathname } = location dispatch(routerRedux.push({ pathname, - query: { + search: queryString.stringify({ ...query, page: page.current, pageSize: page.pageSize, - }, + }), })) }, onDeleteItem (id) { @@ -87,16 +87,16 @@ const User = ({ const filterProps = { isMotion, filter: { - ...location.query, + ...query, }, onFilterChange (value) { dispatch(routerRedux.push({ pathname: location.pathname, - query: { + search: queryString.stringify({ ...value, page: 1, pageSize, - }, + }), })) }, onSearch (fieldsValue) {