Commit 40acf81d authored by superman's avatar superman

update

parent 24349b46
This diff is collapsed.
......@@ -2,6 +2,6 @@
// - https://github.com/dora-js/dora-plugin-proxy#规则定义
module.exports = {
'/api/*': 'http://react.yanky.cn/',
// '/api/*': 'http://192.168.1.126:8080/'
// '/api/*': 'http://react.yanky.cn/',
'/api/*': 'http://192.168.1.126:8080/'
};
......@@ -27,6 +27,7 @@ import {formItemLayout, footerFormSubmitLayout} from '../../utils';
@connect(state=>({
loading: state.announcement.loading,
item: state.announcement.item
}))
@Form.create()
export default class AddItem extends Component {
......@@ -34,6 +35,25 @@ export default class AddItem extends Component {
super(props, content);
}
componentDidMount(){
const {item} = this.props;
if (item && item.id) {
this.props.dispatch({
type: 'INIT_ANNOUNCEMENT'
});
}
}
componentWillReceiveProps(nextProps) {
const {item} = nextProps;
if (item && item.id) {
this.props.history.push('/announcement/' + item.id);
this.props.dispatch({
type: 'INIT_ANNOUNCEMENT'
});
}
}
handleSubmit(e) {
e.preventDefault();
const data = this.props.form.getFieldsValue();
......
......@@ -43,8 +43,8 @@ export default class EditItem extends Component {
this.fetchItem(this.props.params.id);
};
componentWillReceiveProps(nextProps){
componentWillReceiveProps(nextProps) {
}
fetchItem(id) {
......@@ -121,14 +121,17 @@ export default class EditItem extends Component {
{...getFieldProps('announcement', {
initialValue: item.announcement
})} />
: item.announcement
:
<p style={{maxWidth:500}}>
{item.announcement}
</p>
}
</Form.Item>
<Form.Item {...footerFormSubmitLayout} style={{marginTop:30}}>
{
isEdit ?
<Button type="primary" htmlType="submit" loading={loading}>
<Icon type="save"/>修改
<Icon type="save"/>保存
</Button>
:
<Button type="primary"
......
......@@ -50,7 +50,7 @@ export default class BaseUpload extends Component {
return (
<Layout header={header}>
<Row>
<Row style={{padding:'20px 20px 20px'}}>
<Col span="24">
<Upload.Dragger action="/api/fileUpload/upload"
multiple={true}
......
......@@ -126,7 +126,7 @@ export default class Item extends Component {
</div>
<p>
{
(item.status == 11 || item.status == 21) &&
(item.status == 11 || item.status == 21) && (! item.commissionId) &&
<Link to={'/trades/commission/'+ item.id}><Button>发放佣金</Button></Link>
}
<Link to={'/trades/contract/'+ item.id}><Button>邮寄合同</Button></Link>
......
......@@ -65,7 +65,7 @@ const columns = [
<span>
<Link to={'/trades/contract/'+ record.id} onClick={e=>e.stopPropagation()}>合同</Link>
{
(record.status == 11 || record.status == 21) &&
(record.status == 11 || record.status == 21) && (! record.commissionId) &&
<span>
<span className="ant-divider"></span>
<Link to={'/trades/commission/'+ record.id} onClick={e=>e.stopPropagation()}>佣金</Link>
......
import {handleActions} from 'redux-actions';
import {combineReducer} from 'redux';
const initState = {
items: [],
loading: false,
};
const announcement = handleActions({
['INIT_ANNOUNCEMENT'](){
return initState;
},
['FETCH_ANNOUNCEMENT_LIST'](state) {
return {...state, loading: true,};
},
......@@ -38,9 +46,6 @@ const announcement = handleActions({
['UPDATE_ANNOUNCEMENT_ITEM_FAILED'](state, action){
return {...state, err: action.err, loading: false}
},
}, {
items: [],
loading: false,
});
}, initState);
export default announcement;
......@@ -81,6 +81,7 @@ function* watchAdd() {
function* editItem(data) {
try{
yield call(updateItem, data);
message.success('修改成功!');
yield put({
type: 'UPDATE_ANNOUNCEMENT_ITEM_SUCCESS',
item: data
......
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