diff --git a/src/routes/Users.less b/src/routes/Users.less
index 8803a93..e69de29 100644
--- a/src/routes/Users.less
+++ b/src/routes/Users.less
@@ -1,4 +0,0 @@
-.normal {
- width: 800px;
- margin: 20px auto;
-}
diff --git a/src/routes/error.jsx b/src/routes/error.jsx
new file mode 100644
index 0000000..4f2a6d5
--- /dev/null
+++ b/src/routes/error.jsx
@@ -0,0 +1,10 @@
+import React from 'react'
+import {Icon} from 'antd'
+import styles from './error.less'
+
+const Error = () =>
+
+
404 Not Found
+
+
+export default Error
diff --git a/src/view/common/error.less b/src/routes/error.less
similarity index 60%
rename from src/view/common/error.less
rename to src/routes/error.less
index cac8bd0..b02f9aa 100644
--- a/src/view/common/error.less
+++ b/src/routes/error.less
@@ -1,4 +1,4 @@
-.not-found {
+.error {
color: black;
text-align: center;
position: absolute;
@@ -7,9 +7,11 @@
left: 50%;
margin-left: -100px;
width: 200px;
- height: 100px;
-
+ :global .anticon{
+ font-size: 48px;
+ margin-bottom: 16px;
+ }
h1 {
- font-family: "PingFang SC",;
+ font-family: cursive;
}
}
diff --git a/src/view/common/error.js b/src/view/common/error.js
deleted file mode 100644
index bab6ea4..0000000
--- a/src/view/common/error.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import React from 'react'
-import { Icon } from 'antd'
-import './error.less'
-
-const Error = React.createClass({
- render() {
- return (
-
-
-
{this.props.errorMsg || '404 Not Found'}
-
- );
- }
-})
-
-module.exports = Error
diff --git a/src/view/data/list.js b/src/view/data/list.js
deleted file mode 100644
index bc890c1..0000000
--- a/src/view/data/list.js
+++ /dev/null
@@ -1,140 +0,0 @@
-import React from 'react'
-import ReactDOM from 'react-dom'
-import { ajax, config, Logger } from '../../utils/lib'
-import { Icon, message, Table, Button, Row, Col, Dropdown, Menu } from 'antd'
-import './list.less'
-
-const logger = Logger.getLogger('List')
-
-let List = React.createClass({
- getInitialState() {
- logger.info()
- const tableName = this.props.routes.pop().tableName
- return {
- tableName,
- pager:{
- showSizeChanger: true,
- showQuickJumper: true,
- showTotal: total => `共 ${total} 条`
- },
- data:[],
- params:{},
- loading: false,
- };
- },
- componentDidMount() {
- this.fetch()
- },
- handleTableChange(pagination, filters, sorter) {
- let pager = this.state.pager
- pager.current = pagination.current
- this.state.pager = pager
- this.state.params = {
- results: pagination.pageSize,
- page: pagination.current,
- sortField: sorter.field,
- sortOrder: sorter.order,
- ...filters
- }
- this.fetch()
- },
- fetch() {
- const _this = this
- this.setState({loading: true})
- ajax({
- url: 'https://randomuser.me/api/',
- data: {
- results:10,
- ..._this.state.params
- },
- success: function (result) {
- const pager = _this.state.pager
- const params = _this.state.params
- pager.total = 200
- _this.setState({
- loading: false,
- data: result.results,
- pager,
- params})
- }
- })
- },
- render() {
- const columns = [
- {
- title: '头像',
- dataIndex: 'picture',
- width:64,
- className:'avatar-col',
- render: text =>

,
- },{
- title: '姓名',
- dataIndex: 'name',
- sorter: true,
- render: text => `${text.first} ${text.last}`,
- }, {
- title: '性别',
- dataIndex: 'gender',
- filters: [
- { text: 'Male', value: 'male' },
- { text: 'Female', value: 'female' },
- ],
- }, {
- title: '座机',
- dataIndex: 'cell',
- }, {
- title: '国家',
- dataIndex: 'nat',
- }, {
- title: '城市',
- dataIndex: 'location',
- render: text => text.city,
- },{
- title: '手机',
- dataIndex: 'phone',
- },{
- title: '邮箱',
- dataIndex: 'email',
- },{
- title: '时间',
- dataIndex: 'dob',
- render: text => new Date(text).format("yyyy-MM-dd hh:mm:ss"),
- },{
- title: '操作',
- dataIndex: 'login',
- render: (text,it) => {
- const menu = (
-
- )
- return
-
- 操作
-
-
- },
- }]
- return (
-
-
record.registered}
- dataSource={this.state.data}
- pagination={this.state.pager}
- loading={this.state.loading}
- onChange={this.handleTableChange}
- className="list-table"
- size="small" />
-
- )
- },
-})
-
-module.exports = List
diff --git a/src/view/data/list.less b/src/view/data/list.less
deleted file mode 100644
index 0839526..0000000
--- a/src/view/data/list.less
+++ /dev/null
@@ -1,9 +0,0 @@
-
-.list-table{
- .avatar-col{
- line-height: 1;
- }
- td{
- height: 39px;
- }
-}
diff --git a/src/view/index.js b/src/view/index.js
deleted file mode 100644
index 87a0863..0000000
--- a/src/view/index.js
+++ /dev/null
@@ -1,92 +0,0 @@
-import React from 'react'
-import ReactDOM from 'react-dom'
-import Header from '../components/Header'
-import Footer from '../components/Footer'
-import Sidebar from '../components/Sidebar'
-import SignIn from './user/SignIn'
-import Breadcrumb from '../components/Breadcrumb'
-import './index.less'
-import { ajax, config, Logger } from '../utils/lib.js'
-import { Spin, message, Icon } from 'antd'
-
-const logger = Logger.getLogger('App')
-
-const App = React.createClass({
- getInitialState() {
- let loading=false,
- login=true
- if (config.needLogin){
- loading=true
- login=false
- }
- return {
- loading,
- login,
- userName: '未登录',
- collapse: false,
- }
- },
- componentDidMount() {
- const _this = this
- if(localStorage.getItem("username")&&localStorage.getItem("username")=="guest"&&
- localStorage.getItem("password")&&localStorage.getItem("password")=='guest'){
- _this.loginSuccess("guest")
- return
- }
- if (!this.state.login) {
- const loading = message.loading('正在获取用户信息...', 0)
- ajax({
- url: config.user.info,
- success: function (result) {
- if (result.isSuccess) {
- loading()
- _this.loginSuccess(result.userName)
- } else {
- loading()
- _this.setState({loading: false})
- }
- }
- })
- }
- },
- loginSuccess(name) {
- logger.debug('callback logingSuccess, name = %s', name)
- this.setState({
- loading: false,
- login: true,
- userName: name,
- })
- },
- render() {
- if (this.state.loading) {
- return (
-
- )
- } else if (!this.state.login) {
- return
- }
- const collapse = this.state.collapse
- return (
-
-
-
-
-
-
-
- {this.props.children}
-
-
-
-
-
- )
- },
-})
-
-module.exports = App
diff --git a/src/view/index.less b/src/view/index.less
deleted file mode 100644
index 03e6aad..0000000
--- a/src/view/index.less
+++ /dev/null
@@ -1,165 +0,0 @@
-body {
- height: 100%;
- overflow-y: hidden;
- background-color: #f8f8f8;
-}
-
-.ant-layout-aside {
- position: relative;
- min-height: 100%;
-
- .ant-layout-header {
- .ant-menu {
- line-height: 47px;
- }
-
- .ant-menu-horizontal {
- border: none;
- }
- box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
- }
-
- .ant-layout-sider {
- width: 224px;
- background: #404040;
- position: absolute;
- overflow: visible;
- padding-bottom: 24px;
- height: 100%;
- transition: all 0.3s ease;
-
- & > .ant-menu {
- margin-bottom: 20px;
-
- & > .anticon {
- transition: font-size 0.3s;
- }
-
- & > .ant-menu-item {
- margin: 16px 0;
-
- &.nav-text {
- vertical-align: baseline;
- display: inline-block;
- }
- }
- }
-
- .ant-layout-logo {
- text-align: center;
- height: 40px;
- line-height: 40px;
- cursor: pointer;
-
- img {
- width: 40px;
- margin-right: 8px;
- }
-
- span {
- vertical-align: text-bottom;
- font-size: 16px;
- text-transform: uppercase;
- display: inline-block;
- }
- }
- }
-
- .ant-layout-breadcrumb {
- height: 48px;
- line-height: 48px;
- padding: 0 16px;
- margin-bottom: -24px;
- }
-
- .ant-layout-main {
- margin-left: 224px;
- transition: all 0.3s ease;
- }
-
- .ant-aside-action {
- height: 42px;
- width: 224px;
- position: fixed;
- bottom: 0;
- background: #474747;
- color: #fff;
- text-align: center;
- line-height: 42px;
- cursor: pointer;
- transition: all 0.3s ease;
- }
-
- .ant-layout-container {
- margin: 24px 16px;
-
- .ant-layout-content {
- background: #fff;
- padding: 24px;
- min-height: e("calc(100vh - 168px)");
- position: relative;
- }
- }
-
- .ant-layout-footer {
- height: 48px;
- line-height: 48px;
- text-align: center;
- font-size: 12px;
- color: #999;
- background: #fff;
- box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
- width: 100%;
- }
-
- &.ant-layout-aside-collapse {
- .ant-aside-action {
- width: 64px;
- transition: all 0.3s ease;
- }
-
- .ant-layout-main {
- margin-left: 64px;
- transition: all 0.3s ease;
- }
-
- .ant-layout-sider {
- width: 64px;
- transition: all 0.3s ease;
-
- & > .ant-menu {
- & > .ant-menu-item {
- transition: all 0s ease;
-
- &:hover {
- background: #2db7f5;
- color: #fff;
- transition: all 0s ease;
-
- .nav-text {
- display: inline-block;
- vertical-align: top;
- background: #2db7f5;
- color: #fff;
- padding-right: 16px;
- border-radius: 0 5px 5px 0;
- }
- }
-
- .nav-text {
- display: none;
- }
-
- & > .anticon {
- font-size: 16px;
- display: inline-block;
- }
- }
- }
- }
- }
-}
-.ant-layout-main{
- height: 100vh;
- overflow-y:auto;
-}
diff --git a/src/view/user/dashboard.js b/src/view/user/dashboard.js
deleted file mode 100644
index c3e350c..0000000
--- a/src/view/user/dashboard.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import React from 'react'
-import { ajax, config, Logger } from '../../utils/lib'
-import { Icon, message, Button, Row, Col, Form, Input, Select } from 'antd'
-import './dashboard.less'
-const logger = Logger.getLogger('Dashboard')
-
-const Dashboard = React.createClass({
- render(){
- return(
- hello
- )
- }
-})
-
-module.exports = Dashboard
diff --git a/src/view/user/dashboard.less b/src/view/user/dashboard.less
deleted file mode 100644
index e69de29..0000000
diff --git a/src/view/user/signIn.js b/src/view/user/signIn.js
deleted file mode 100644
index 4ffe779..0000000
--- a/src/view/user/signIn.js
+++ /dev/null
@@ -1,88 +0,0 @@
-import React from 'react'
-import ReactDOM from 'react-dom'
-import { ajax, config, Logger } from '../../utils/lib'
-import { Icon, message, Button, Row, Col, Form, Input, Select } from 'antd'
-import './signIn.less'
-
-const FormItem = Form.Item
-const logger = Logger.getLogger('SignIn')
-
-let SignIn = React.createClass({
- getInitialState() {
- return {
- loading: false,
- }
- },
- handleSubmit(e) {
- const _this = this
- e.preventDefault()
- this.props.form.validateFieldsAndScroll((errors, values) => {
- if (!!errors) {
- return
- }
- _this.setState({ loading: true })
- ajax({
- url:config.user.signIn,
- data:values,
- success:function(result){
- if(result.isSuccess){
- _this.props.loginSuccess(result.userName, true)
- }else {
- message.error(`登录失败: ${result.message}, 请联系管理员`)
- }
- },
- complete:function(){
- _this.setState({ loading: false })
- }
- })
- })
- },
- render() {
- const { getFieldProps } = this.props.form
- const username = getFieldProps('username', {
- rules: [
- {
- required: true,
- message: '不能为空',
- },
- ],
- })
- const password = getFieldProps('password', {
- rules: [
- {
- required: true,
- message: '不能为空',
- },
- ],
- })
- return (
-
-
-

-
Ant Design
-
-
-
- )
- },
-})
-
-SignIn = Form.create()(SignIn)
-
-module.exports = SignIn
diff --git a/src/view/user/signIn.less b/src/view/user/signIn.less
deleted file mode 100644
index cdf36dc..0000000
--- a/src/view/user/signIn.less
+++ /dev/null
@@ -1,36 +0,0 @@
-.signIn-from {
- position: absolute;
- top: 50%;
- left: 50%;
- margin: -160px 0 0 -160px;
- width: 320px;
- height: 320px;
- padding: 36px;
- box-shadow: 0 0 100px rgba(0,0,0,.08);
-
- button {
- width: 100%;
- }
-}
-
-.logo {
- text-align: center;
- height: 40px;
- line-height: 40px;
- cursor: pointer;
-
- img {
- width: 40px;
- margin-right: 8px;
- }
-
- span {
- vertical-align: text-bottom;
- font-size: 16px;
- text-transform: uppercase;
- display: inline-block;
- }
-}
-.ant-spin-container,.ant-spin-nested-loading{
- height: 100%;
-}