Commit c589b9f6 authored by nano's avatar nano

init

parent 91e80f3a
This diff is collapsed.
...@@ -35,9 +35,6 @@ export default { ...@@ -35,9 +35,6 @@ export default {
subscriptions: { subscriptions: {
setup({dispatch, history}) { setup({dispatch, history}) {
if (location.pathname != '/loginCallback') {
dispatch({type: 'init'})
}
return history.listen(({pathname, query}) => { return history.listen(({pathname, query}) => {
if (pathname === '/login') { if (pathname === '/login') {
let params = new URLSearchParams() let params = new URLSearchParams()
......
import React from 'react'; import React from "react";
import { connect } from 'dva'; import {connect} from "dva";
import styles from './Apps.less'; import styles from "./Apps.less";
import { Link } from 'dva/router'; import {Link} from "dva/router";
import { Button, Affix, Icon, Table, Tag } from 'antd' import {Affix, Button, Icon, Table} from "antd";
import Create from '../components/App/Create' import Create from "../components/App/Create";
const columns = [ const columns = [
...@@ -18,20 +18,20 @@ const columns = [ ...@@ -18,20 +18,20 @@ const columns = [
dataIndex: 'name', dataIndex: 'name',
render: name => name && name["zh-CN"], render: name => name && name["zh-CN"],
width: '10%', width: '10%',
},{ }, {
title: "author", title: "author",
dataIndex: 'author', dataIndex: 'author',
width: '10%', width: '10%',
},{ }, {
title: "category", title: "category",
dataIndex: 'category', dataIndex: 'category',
width: '10%', width: '10%',
},{ }, {
title: "homepage", title: "homepage",
dataIndex: 'homepage', dataIndex: 'homepage',
render: homepage => <a href={homepage} target="_blank">{homepage}</a>, render: homepage => <a href={homepage} target="_blank">{homepage}</a>,
width: '10%', width: '10%',
},{ }, {
title: "released_at", title: "released_at",
dataIndex: 'released_at', dataIndex: 'released_at',
sorter: true, sorter: true,
...@@ -44,18 +44,26 @@ const columns = [ ...@@ -44,18 +44,26 @@ const columns = [
}, },
] ]
function Apps({children, dispatch, isCreate, isSubmit, apps}) { class Apps extends React.Component {
componentWillMount() {
const {dispatch} = this.props
console.log(this.props)
}
render() {
const {children, dispatch, isCreate, isSubmit, apps} = this.props
const CreateProps = { const CreateProps = {
visible: isCreate, visible: isCreate,
isLoading: isSubmit, isLoading: isSubmit,
onCancel: () => dispatch({ type: 'App/onCancel'}), onCancel: () => dispatch({type: 'App/onCancel'}),
onCreate: () => dispatch({ type: 'App/onCreate'}), onCreate: () => dispatch({type: 'App/onCreate'}),
onSubmit: (payload) => dispatch({ type: 'App/create', payload}), onSubmit: (payload) => dispatch({type: 'App/create', payload}),
} }
const CreateButtonProps = { const CreateButtonProps = {
onClick: () => dispatch({ type: 'App/onCreate'}), onClick: () => dispatch({type: 'App/onCreate'}),
className: styles.CreateBtn, className: styles.CreateBtn,
shape: "circle", shape: "circle",
type: "primary", type: "primary",
...@@ -73,21 +81,22 @@ function Apps({children, dispatch, isCreate, isSubmit, apps}) { ...@@ -73,21 +81,22 @@ function Apps({children, dispatch, isCreate, isSubmit, apps}) {
<Table {...TableProps}/> <Table {...TableProps}/>
<Affix style={{ position: 'absolute', bottom: 50, right: 50}}> <Affix style={{position: 'absolute', bottom: 50, right: 50}}>
<Button {...CreateButtonProps} > <Button {...CreateButtonProps} >
<Icon type="plus" /> <Icon type="plus"/>
</Button> </Button>
</Affix> </Affix>
<Create {...CreateProps}/> <Create {...CreateProps}/>
</div> </div>
); );
}
} }
function mapStateToProps(state) { function mapStateToProps(state) {
const { const {
Apps: { apps }, Apps: {apps},
App: { isCreate, isSubmit }, App: {isCreate, isSubmit},
} = state } = state
return { return {
apps, apps,
......
import React from 'react'; import React from "react";
import { connect } from 'dva'; import {connect} from "dva";
import Nav from '../components/Common/Nav' import Nav from "../components/Common/Nav";
import {Layout} from 'antd' import {Layout} from "antd";
function Entry({ children}) { class Entry extends React.Component {
componentWillMount() {
const {dispatch, location:{pathname}} = this.props
if(pathname !== 'loginCallback') {
dispatch({type: 'Common/init'})
}
}
render() {
const {children} = this.props
return ( return (
<Layout style={{ flexDirection: 'row', minHeight: '100%'}}> <Layout style={{flexDirection: 'row', minHeight: '100%'}}>
<Nav /> <Nav />
<Layout style={{ minHeight: '400px'}}> <Layout style={{minHeight: '400px'}}>
{children} {children}
</Layout> </Layout>
</Layout> </Layout>
); );
}
} }
function mapStateToProps(state) { function mapStateToProps(state) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment