Commit 2da6334e authored by superman's avatar superman

update

parent 7f0913d4
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
// - https://github.com/dora-js/dora-plugin-proxy#规则定义 // - https://github.com/dora-js/dora-plugin-proxy#规则定义
module.exports = { module.exports = {
// '/api/*': 'http://react.yanky.cn/', '/api/*': 'http://react.yanky.cn/',
'/api/*': 'http://192.168.1.126:8080/' // '/api/*': 'http://192.168.1.126:8080/'
}; };
...@@ -43,6 +43,21 @@ export default class ContactForm extends Component { ...@@ -43,6 +43,21 @@ export default class ContactForm extends Component {
} }
componentWillReceiveProps(nextProps) {
if (nextProps && nextProps.product.staffs && nextProps.product.staffs) {
if (nextProps.product.staffs.length != this.props.product.staffs.length) {
this.setState({
staffs: nextProps.product.staffs.map(staffs=> {
staffs.key = UUID();
return staffs;
})
});
} else {
}
}
}
static propsType = { static propsType = {
product: PropTypes.object, product: PropTypes.object,
}; };
...@@ -109,13 +124,13 @@ export default class ContactForm extends Component { ...@@ -109,13 +124,13 @@ export default class ContactForm extends Component {
<Input.Group> <Input.Group>
<Col span="6"> <Col span="6">
<Input placeholder="姓名" <Input placeholder="姓名"
{...getFieldProps(index + '.name', { {...getFieldProps(item.key + '.name', {
initialValue: item.name initialValue: item.name
})} /> })} />
</Col> </Col>
<Col span="10"> <Col span="10">
<Input placeholder="电话" <Input placeholder="电话"
{...getFieldProps(index + '.mobile', { {...getFieldProps(item.key + '.mobile', {
initialValue: item.mobile initialValue: item.mobile
})}/> })}/>
</Col> </Col>
......
...@@ -49,6 +49,17 @@ export default class ElementForm extends Component { ...@@ -49,6 +49,17 @@ export default class ElementForm extends Component {
}; };
componentWillReceiveProps(nextProps) {
if (nextProps && nextProps.product && nextProps.product.elements) {
if (Object.keys(nextProps.product.elements).length != Object.keys(this.props.product.elements).length) {
this.setState({
elements: BaseElementTransform(nextProps.product.elements)
});
}
}
}
/** /**
* 删除基本要素 * 删除基本要素
* @param index * @param index
...@@ -117,14 +128,14 @@ export default class ElementForm extends Component { ...@@ -117,14 +128,14 @@ export default class ElementForm extends Component {
<Input.Group> <Input.Group>
<Col span="6"> <Col span="6">
<Input placeholder="标题" <Input placeholder="标题"
{...getFieldProps(index + '.title', { {...getFieldProps(item.key + '.title', {
initialValue: item.title initialValue: item.title
})} })}
/> />
</Col> </Col>
<Col span="10"> <Col span="10">
<Input type="textarea" placeholder="内容" autosize <Input type="textarea" placeholder="内容" autosize
{...getFieldProps(index + '.content', { {...getFieldProps(item.key + '.content', {
initialValue: item.content initialValue: item.content
})} })}
/> />
......
...@@ -53,13 +53,16 @@ export default class ShouyiYongjingForm extends Component { ...@@ -53,13 +53,16 @@ export default class ShouyiYongjingForm extends Component {
dispatch: PropTypes.func dispatch: PropTypes.func
}; };
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps) {
// if(nextProps && nextProps.product && nextProps.product.commissionAlg){ if (nextProps && nextProps.product && nextProps.product.commissionAlg) {
// this.setState({ if (nextProps.product.commissionAlg.length != this.props.product.commissionAlg.length) {
// yongjing: YongjingTransform(nextProps.product.commissionAlg) this.setState({
// }); yongjing: YongjingTransform(nextProps.product.commissionAlg)
// } });
}
} }
}
/** /**
* 添加佣金算法 * 添加佣金算法
...@@ -109,7 +112,7 @@ export default class ShouyiYongjingForm extends Component { ...@@ -109,7 +112,7 @@ export default class ShouyiYongjingForm extends Component {
}); });
data.commissionAlg = JSON.stringify(commissionAlg); data.commissionAlg = JSON.stringify(commissionAlg);
console.log(data); console.log(formData, data);
this.props.dispatch({ this.props.dispatch({
type: 'UPDATE_PRODUCT_ITEM', type: 'UPDATE_PRODUCT_ITEM',
...@@ -166,16 +169,16 @@ export default class ShouyiYongjingForm extends Component { ...@@ -166,16 +169,16 @@ export default class ShouyiYongjingForm extends Component {
<div key={item.key}> <div key={item.key}>
<Input.Group> <Input.Group>
<Col span="5"> <Col span="5">
<Input {...getFieldProps(index + '.min', {initialValue: item.min})} /> <Input {...getFieldProps(item.key + '.min', {initialValue: item.min})} />
</Col> </Col>
<Col span="5"> <Col span="5">
<Input {...getFieldProps(index + '.max', {initialValue: item.max})}/> <Input {...getFieldProps(item.key + '.max', {initialValue: item.max})}/>
</Col> </Col>
<Col span="5"> <Col span="5">
<Input {...getFieldProps(index + '.sy', {initialValue: item.result && item.result.sy})}/> <Input {...getFieldProps(item.key + '.sy', {initialValue: item.result && item.result.sy})}/>
</Col> </Col>
<Col span="5"> <Col span="5">
<Input {...getFieldProps(index + '.yj', {initialValue: item.result && item.result.yj})}/> <Input {...getFieldProps(item.key + '.yj', {initialValue: item.result && item.result.yj})}/>
</Col> </Col>
<Col span="4"> <Col span="4">
<Icon type="cross" <Icon type="cross"
......
...@@ -41,7 +41,31 @@ const product = handleActions({ ...@@ -41,7 +41,31 @@ const product = handleActions({
return {...state, loading: true}; return {...state, loading: true};
}, },
['UPDATE_PRODUCT_ITEM_SUCCESS'](state, action){ ['UPDATE_PRODUCT_ITEM_SUCCESS'](state, action){
return {...state, loading: false, item:{...state.item, ...action.item}}; if(action.item && action.item.commissionAlg && typeof action.item.commissionAlg === 'string'){
try{
action.item.commissionAlg = JSON.parse(action.item.commissionAlg);
}catch(err){
console.log('UPDATE_PRODUCT_ITEM_SUCCESS commissionAlg Error:', action.item.commissionAlg);
}
}
if(action.item && action.item.elements && typeof action.item.elements === 'string'){
try {
action.item.elements = JSON.parse(action.item.elements);
}catch(err){
console.log('UPDATE_PRODUCT_ITEM_SUCCESS elements Error:', action.item.elements);
}
}
if(action.item && action.item.staffs && typeof action.item.staffs === 'string'){
try{
action.item.staffs = JSON.parse(action.item.staffs);
}catch(err){
console.log('UPDATE_PRODUCT_ITEM_SUCCESS staffs Error:', action.item.staffs);
}
}
const ret = {...state, loading: false, item:{...state.item, ...action.item}};
console.log(ret, state);
return ret;
}, },
['UPDATE_PRODUCT_ITEM_FAILED'](state, action){ ['UPDATE_PRODUCT_ITEM_FAILED'](state, action){
return {...state, loading: false, err: action.err}; return {...state, loading: false, err: action.err};
......
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