mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-29 04:14:12 +00:00
add:userMotion
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
"eslint-plugin-react": "^5.1.1",
|
||||
"glob": "^7.0.5",
|
||||
"mockjs": "^1.0.1-beta3",
|
||||
"rc-tween-one": "^1.0.0",
|
||||
"redbox-react": "^1.2.10",
|
||||
"robe-ajax": "^1.0.0",
|
||||
"watchjs": "^0.0.0"
|
||||
|
||||
@@ -29,6 +29,14 @@ export default function ({history, app}) {
|
||||
cb(null, require('./routes/users'))
|
||||
})
|
||||
}
|
||||
}, {
|
||||
path: 'usersMotion',
|
||||
name: 'usersMotion',
|
||||
getComponent (nextState, cb) {
|
||||
require.ensure([], require => {
|
||||
cb(null, require('./routes/usersMotion'))
|
||||
})
|
||||
}
|
||||
}, {
|
||||
path: 'ui/ico',
|
||||
name: 'ui/ico',
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
import React, { PropTypes } from 'react'
|
||||
import { routerRedux } from 'dva/router'
|
||||
import { connect } from 'dva'
|
||||
import UserList from '../components/users/list'
|
||||
import UserSearch from '../components/users/search'
|
||||
import UserModal from '../components/users/modal'
|
||||
|
||||
function Users ({ location, dispatch, users }) {
|
||||
const { loading, list, pagination, currentItem, modalVisible, modalType } = users
|
||||
const { field, keyword } = location.query
|
||||
|
||||
const userModalProps = {
|
||||
item: modalType === 'create' ? {} : currentItem,
|
||||
type: modalType,
|
||||
visible: modalVisible,
|
||||
onOk (data) {
|
||||
dispatch({
|
||||
type: `users/${modalType}`,
|
||||
payload: data
|
||||
})
|
||||
},
|
||||
onCancel () {
|
||||
dispatch({
|
||||
type: 'users/hideModal'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const userListProps = {
|
||||
dataSource: list,
|
||||
loading,
|
||||
pagination: pagination,
|
||||
onPageChange (page) {
|
||||
const query = location.query
|
||||
dispatch(routerRedux.push({
|
||||
pathname: '/users',
|
||||
query: {
|
||||
...query,
|
||||
page: page.current,
|
||||
pageSize: page.pageSize
|
||||
}
|
||||
}))
|
||||
},
|
||||
onDeleteItem (id) {
|
||||
dispatch({
|
||||
type: 'users/delete',
|
||||
payload: id
|
||||
})
|
||||
},
|
||||
onEditItem (item) {
|
||||
dispatch({
|
||||
type: 'users/showModal',
|
||||
payload: {
|
||||
modalType: 'update',
|
||||
currentItem: item
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const userSearchProps = {
|
||||
field,
|
||||
keyword,
|
||||
onSearch (fieldsValue) {
|
||||
!!fieldsValue.keyword.length ?
|
||||
dispatch(routerRedux.push({
|
||||
pathname: '/users',
|
||||
query: {
|
||||
field: fieldsValue.field,
|
||||
keyword: fieldsValue.keyword
|
||||
}
|
||||
})) :
|
||||
dispatch(routerRedux.push({
|
||||
pathname: '/users'
|
||||
}))
|
||||
},
|
||||
onAdd () {
|
||||
dispatch({
|
||||
type: 'users/showModal',
|
||||
payload: {
|
||||
modalType: 'create'
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const UserModalGen = () =>
|
||||
<UserModal {...userModalProps} />
|
||||
|
||||
return (
|
||||
<div className='content-inner'>
|
||||
<UserSearch {...userSearchProps} />
|
||||
<UserList {...userListProps} />
|
||||
<UserModalGen />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Users.propTypes = {
|
||||
users: PropTypes.object,
|
||||
location: PropTypes.object,
|
||||
dispatch: PropTypes.func
|
||||
}
|
||||
|
||||
function mapStateToProps ({ users }) {
|
||||
return { users }
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(Users)
|
||||
@@ -9,6 +9,11 @@ module.exports = [
|
||||
name: '用户管理',
|
||||
icon: 'user'
|
||||
},
|
||||
{
|
||||
key: 'usersMotion',
|
||||
name: '用户管理-动效',
|
||||
icon: 'user'
|
||||
},
|
||||
{
|
||||
key: 'ui',
|
||||
name: 'UI组件',
|
||||
|
||||
Reference in New Issue
Block a user