fix users pagination

This commit is contained in:
zuiidea
2017-12-25 20:39:48 +08:00
parent 09b9a100de
commit 11c4ac803e
10 changed files with 56 additions and 50 deletions
+1 -1
View File
@@ -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",
+15 -19
View File
@@ -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 {
+4 -2
View File
@@ -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)";
}
}
+9 -9
View File
@@ -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',
+4 -2
View File
@@ -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),
} })
},
})
}
})
},
+2 -1
View File
@@ -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,
-1
View File
@@ -121,7 +121,6 @@ const App = ({
</Footer>
</Layout>
</Layout>
</div>
)
}
+3 -2
View File
@@ -1,12 +1,13 @@
import React from 'react'
import { Icon } from 'antd'
import styles from './index.less'
import { Page } from 'components'
const Error = () => (<div className="content-inner">
const Error = () => (<Page inner>
<div className={styles.error}>
<Icon type="frown-o" />
<h1>404 Not Found</h1>
</div>
</div>)
</Page>)
export default Error
+12 -7
View File
@@ -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,
},
}),
}))
}
+6 -6
View File
@@ -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) {