Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
shuniu-admin-react
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
superman
shuniu-admin-react
Commits
2da6334e
Commit
2da6334e
authored
Jul 29, 2016
by
superman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
7f0913d4
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
86 additions
and
33 deletions
+86
-33
index.js
dist/index.js
+15
-15
proxy.config.js
proxy.config.js
+2
-2
ContactForm.jsx
src/components/ProductForm/ContactForm.jsx
+17
-2
ElementForm.jsx
src/components/ProductForm/ElementForm.jsx
+13
-2
ShouyiYongjingForm.jsx
src/components/ProductForm/ShouyiYongjingForm.jsx
+14
-11
product.js
src/reducers/product.js
+25
-1
No files found.
dist/index.js
View file @
2da6334e
This source diff could not be displayed because it is too large. You can
view the blob
instead.
proxy.config.js
View file @
2da6334e
...
@@ -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/'
};
};
src/components/ProductForm/ContactForm.jsx
View file @
2da6334e
...
@@ -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
(
i
ndex
+
'
.
name
',
{
{
...
getFieldProps
(
i
tem
.
key
+
'
.
name
',
{
initialValue
:
item
.
name
initialValue
:
item
.
name
})}
/>
})}
/>
</
Col
>
</
Col
>
<
Col
span=
"10"
>
<
Col
span=
"10"
>
<
Input
placeholder=
"电话"
<
Input
placeholder=
"电话"
{
...
getFieldProps
(
i
ndex
+
'
.
mobile
',
{
{
...
getFieldProps
(
i
tem
.
key
+
'
.
mobile
',
{
initialValue
:
item
.
mobile
initialValue
:
item
.
mobile
})}
/>
})}
/>
</
Col
>
</
Col
>
...
...
src/components/ProductForm/ElementForm.jsx
View file @
2da6334e
...
@@ -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
(
i
ndex
+
'
.
title
',
{
{
...
getFieldProps
(
i
tem
.
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
(
i
ndex
+
'
.
content
',
{
{
...
getFieldProps
(
i
tem
.
key
+
'
.
content
',
{
initialValue
:
item
.
content
initialValue
:
item
.
content
})}
})}
/>
/>
...
...
src/components/ProductForm/ShouyiYongjingForm.jsx
View file @
2da6334e
...
@@ -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
(
i
ndex
+
'
.
min
',
{
initialValue
:
item
.
min
})}
/>
<
Input
{
...
getFieldProps
(
i
tem
.
key
+
'
.
min
',
{
initialValue
:
item
.
min
})}
/>
</
Col
>
</
Col
>
<
Col
span=
"5"
>
<
Col
span=
"5"
>
<
Input
{
...
getFieldProps
(
i
ndex
+
'
.
max
',
{
initialValue
:
item
.
max
})}
/>
<
Input
{
...
getFieldProps
(
i
tem
.
key
+
'
.
max
',
{
initialValue
:
item
.
max
})}
/>
</
Col
>
</
Col
>
<
Col
span=
"5"
>
<
Col
span=
"5"
>
<
Input
{
...
getFieldProps
(
i
ndex
+
'
.
sy
',
{
initialValue
:
item
.
result
&&
item
.
result
.
sy
})}
/>
<
Input
{
...
getFieldProps
(
i
tem
.
key
+
'
.
sy
',
{
initialValue
:
item
.
result
&&
item
.
result
.
sy
})}
/>
</
Col
>
</
Col
>
<
Col
span=
"5"
>
<
Col
span=
"5"
>
<
Input
{
...
getFieldProps
(
i
ndex
+
'
.
yj
',
{
initialValue
:
item
.
result
&&
item
.
result
.
yj
})}
/>
<
Input
{
...
getFieldProps
(
i
tem
.
key
+
'
.
yj
',
{
initialValue
:
item
.
result
&&
item
.
result
.
yj
})}
/>
</
Col
>
</
Col
>
<
Col
span=
"4"
>
<
Col
span=
"4"
>
<
Icon
type=
"cross"
<
Icon
type=
"cross"
...
...
src/reducers/product.js
View file @
2da6334e
...
@@ -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
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment