Skip to content

Commit

Permalink
improve by github.com/sorrycc/blog/issues/66
Browse files Browse the repository at this point in the history
  • Loading branch information
superlbr committed Mar 31, 2018
1 parent 668c9c7 commit df5ce29
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/models/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default {
type: 'updateState',
payload: {
locationPathname: location.pathname,
locationQuery: queryString.parse(location.search),
locationQuery: location.query,
},
})
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { parse } from 'qs'
import modelExtend from 'dva-model-extend'
import { query } from '../services/dashboard'
import { query } from './services/dashboard'
import { model } from 'utils/model'
import * as weatherService from '../services/weather'
import * as weatherService from './services/weather'

export default modelExtend(model, {
namespace: 'dashboard',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { routerRedux } from 'dva/router'
import { login } from '../services/login'
import { login } from './service'

export default {
namespace: 'login',
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion src/pages/post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const Index = ({
post, dispatch, loading, location,
}) => {
const { list, pagination } = post
location.query = queryString.parse(location.search)
const { query, pathname } = location

const listProps = {
Expand Down
5 changes: 2 additions & 3 deletions src/pages/post/models/post.js → src/pages/post/model.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import modelExtend from 'dva-model-extend'
import { query } from '../services/posts'
import { query } from './service'
import { pageModel } from 'utils/model'
import queryString from 'query-string'

export default modelExtend(pageModel, {

Expand All @@ -15,7 +14,7 @@ export default modelExtend(pageModel, {
type: 'query',
payload: {
status: 2,
...queryString.parse(location.search),
...location.query,
},
})
}
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions src/pages/user/components/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Table, Modal } from 'antd'
import classnames from 'classnames'
import { DropOption } from 'components'
import { Link } from 'react-router-dom'
import queryString from 'query-string'
import AnimTableBody from 'components/DataTable/AnimTableBody'
import styles from './List.less'

Expand All @@ -13,7 +12,6 @@ const { confirm } = Modal
const List = ({
onDeleteItem, onEditItem, isMotion, location, ...tableProps
}) => {
location.query = queryString.parse(location.search)

const handleMenuClick = (record, e) => {
if (e.key === '1') {
Expand Down
1 change: 0 additions & 1 deletion src/pages/user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Modal from './components/Modal'
const User = ({
location, dispatch, user, loading,
}) => {
location.query = queryString.parse(location.search)
const { query, pathname } = location
const {
list, pagination, currentItem, modalVisible, modalType, isMotion, selectedRowKeys,
Expand Down
7 changes: 3 additions & 4 deletions src/pages/user/models/user.js → src/pages/user/model.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* 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'
import { create, remove, update } from './services/user'
import * as usersService from './services/users'
import { pageModel } from 'utils/model'

const { query } = usersService
Expand All @@ -24,7 +23,7 @@ export default modelExtend(pageModel, {
setup ({ dispatch, history }) {
history.listen((location) => {
if (location.pathname === '/user') {
const payload = queryString.parse(location.search) || { page: 1, pageSize: 10 }
const payload = location.query || { page: 1, pageSize: 10 }
dispatch({
type: 'query',
payload,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const APIV2 = '/api/v2'
module.exports = {
name: 'AntD Admin',
prefix: 'antdAdmin',
footerText: 'Ant Design Admin © 2017 zuiidea',
footerText: 'Ant Design Admin © 2018 zuiidea',
logo: '/logo.svg',
iconFontCSS: '/iconfont.css',
iconFontJS: '/iconfont.js',
Expand Down

0 comments on commit df5ce29

Please sign in to comment.