Commit c589b9f6 authored by nano's avatar nano

init

parent 91e80f3a
This diff is collapsed.
......@@ -35,9 +35,6 @@ export default {
subscriptions: {
setup({dispatch, history}) {
if (location.pathname != '/loginCallback') {
dispatch({type: 'init'})
}
return history.listen(({pathname, query}) => {
if (pathname === '/login') {
let params = new URLSearchParams()
......
import React from 'react';
import { connect } from 'dva';
import styles from './Apps.less';
import { Link } from 'dva/router';
import { Button, Affix, Icon, Table, Tag } from 'antd'
import Create from '../components/App/Create'
import React from "react";
import {connect} from "dva";
import styles from "./Apps.less";
import {Link} from "dva/router";
import {Affix, Button, Icon, Table} from "antd";
import Create from "../components/App/Create";
const columns = [
......@@ -18,20 +18,20 @@ const columns = [
dataIndex: 'name',
render: name => name && name["zh-CN"],
width: '10%',
},{
}, {
title: "author",
dataIndex: 'author',
width: '10%',
},{
}, {
title: "category",
dataIndex: 'category',
width: '10%',
},{
}, {
title: "homepage",
dataIndex: 'homepage',
render: homepage => <a href={homepage} target="_blank">{homepage}</a>,
width: '10%',
},{
}, {
title: "released_at",
dataIndex: 'released_at',
sorter: true,
......@@ -44,50 +44,59 @@ const columns = [
},
]
function Apps({children, dispatch, isCreate, isSubmit, apps}) {
class Apps extends React.Component {
const CreateProps = {
visible: isCreate,
isLoading: isSubmit,
onCancel: () => dispatch({ type: 'App/onCancel'}),
onCreate: () => dispatch({ type: 'App/onCreate'}),
onSubmit: (payload) => dispatch({ type: 'App/create', payload}),
componentWillMount() {
const {dispatch} = this.props
console.log(this.props)
}
const CreateButtonProps = {
onClick: () => dispatch({ type: 'App/onCreate'}),
className: styles.CreateBtn,
shape: "circle",
type: "primary",
size: "large",
}
render() {
const {children, dispatch, isCreate, isSubmit, apps} = this.props
const TableProps = {
rowKey: row => row.id,
columns,
dataSource: Object.values(apps)
}
const CreateProps = {
visible: isCreate,
isLoading: isSubmit,
onCancel: () => dispatch({type: 'App/onCancel'}),
onCreate: () => dispatch({type: 'App/onCreate'}),
onSubmit: (payload) => dispatch({type: 'App/create', payload}),
}
const CreateButtonProps = {
onClick: () => dispatch({type: 'App/onCreate'}),
className: styles.CreateBtn,
shape: "circle",
type: "primary",
size: "large",
}
return (
<div className={styles.normal}>
const TableProps = {
rowKey: row => row.id,
columns,
dataSource: Object.values(apps)
}
<Table {...TableProps}/>
return (
<div className={styles.normal}>
<Affix style={{ position: 'absolute', bottom: 50, right: 50}}>
<Button {...CreateButtonProps} >
<Icon type="plus" />
</Button>
</Affix>
<Table {...TableProps}/>
<Create {...CreateProps}/>
</div>
);
<Affix style={{position: 'absolute', bottom: 50, right: 50}}>
<Button {...CreateButtonProps} >
<Icon type="plus"/>
</Button>
</Affix>
<Create {...CreateProps}/>
</div>
);
}
}
function mapStateToProps(state) {
const {
Apps: { apps },
App: { isCreate, isSubmit },
Apps: {apps},
App: {isCreate, isSubmit},
} = state
return {
apps,
......
import React from 'react';
import { connect } from 'dva';
import Nav from '../components/Common/Nav'
import React from "react";
import {connect} from "dva";
import Nav from "../components/Common/Nav";
import {Layout} from 'antd'
import {Layout} from "antd";
function Entry({ children}) {
return (
<Layout style={{ flexDirection: 'row', minHeight: '100%'}}>
<Nav />
<Layout style={{ minHeight: '400px'}}>
{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 (
<Layout style={{flexDirection: 'row', minHeight: '100%'}}>
<Nav />
<Layout style={{minHeight: '400px'}}>
{children}
</Layout>
</Layout>
</Layout>
);
);
}
}
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