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
a87baa4e
Commit
a87baa4e
authored
Jul 28, 2016
by
superman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
92d0fce3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
523 additions
and
210 deletions
+523
-210
index.css
dist/index.css
+1
-1
index.js
dist/index.js
+33
-33
BaseInfoForm.jsx
src/components/ProductForm/BaseInfoForm.jsx
+29
-10
ContactForm.jsx
src/components/ProductForm/ContactForm.jsx
+107
-39
DateTimeStatusForm.jsx
src/components/ProductForm/DateTimeStatusForm.jsx
+95
-38
DocumentsForm.jsx
src/components/ProductForm/DocumentsForm.jsx
+60
-28
ElementForm.jsx
src/components/ProductForm/ElementForm.jsx
+50
-18
HuikuanInfoForm.jsx
src/components/ProductForm/HuikuanInfoForm.jsx
+25
-3
ShouyiYongjingForm.jsx
src/components/ProductForm/ShouyiYongjingForm.jsx
+39
-6
BaseUpload.jsx
src/containers/BaseFunction/BaseUpload.jsx
+2
-2
AddItem.jsx
src/containers/Product/AddItem.jsx
+14
-2
EditItem.jsx
src/containers/Product/EditItem.jsx
+27
-13
Commission.jsx
src/containers/Trade/Commission.jsx
+2
-2
product.js
src/reducers/product.js
+12
-2
product.js
src/sagas/product.js
+25
-11
utils.js
src/utils.js
+2
-2
No files found.
dist/index.css
View file @
a87baa4e
This source diff could not be displayed because it is too large. You can
view the blob
instead.
dist/index.js
View file @
a87baa4e
This diff is collapsed.
Click to expand it.
src/components/ProductForm/BaseInfoForm.jsx
View file @
a87baa4e
...
...
@@ -46,19 +46,14 @@ export default class BaseInfoForm extends Component {
this
.
state
=
{
priviewVisible
:
false
,
priviewImage
:
''
,
fileList
:
[]
fileList
:
[]
,
};
}
componentDidMount
()
{
this
.
updateStateOfNextProps
(
this
.
props
);
}
componentWillReceiveProps
(
nextProps
)
{
this
.
updateStateOfNextProps
(
nextProps
);
}
updateStateOfNextProps
(
props
)
{
const
{
product
:{
itemPic
}}
=
props
;
...
...
@@ -81,6 +76,7 @@ export default class BaseInfoForm extends Component {
const
data
=
this
.
props
.
form
.
getFieldsValue
();
if
(
Array
.
isArray
(
data
.
categoryId
)
&&
data
.
categoryId
.
length
===
2
)
{
data
.
categoryParentId
=
data
.
categoryId
[
0
];
data
.
categoryId
=
data
.
categoryId
[
1
];
}
else
{
delete
data
.
categoryId
;
...
...
@@ -104,6 +100,8 @@ export default class BaseInfoForm extends Component {
render
()
{
const
{
user
,
cates
,
product
,
loading
,
form
:{
getFieldProps
},
isEdit
}
=
this
.
props
;
let
productCate
=
[];
...
...
@@ -236,13 +234,34 @@ export default class BaseInfoForm extends Component {
</
Modal
>
</
Form
.
Item
>
<
Form
.
Item
wrapperCol=
{
{
span
:
16
,
offset
:
6
}
}
style=
{
{
marginTop
:
30
}
}
>
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
><
Icon
type=
"save"
/>
保存
</
Button
>
{
isEdit
?
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
>
<
Icon
type=
"save"
/>
保存
</
Button
>
:
<
Button
type=
"primary"
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
props
.
dispatch
({
type
:
'UPDATE_PRODUCT'
});
}
}
>
<
Icon
type=
"edit"
/>
编辑
</
Button
>
}
{
!
this
.
props
.
isCreate
&&
<
Button
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
props
.
history
.
goBack
();}
}
<
Button
onClick=
{
e
=>
{
e
.
preventDefault
();
isEdit
?
this
.
props
.
dispatch
({
type
:
'CANCEL_UPDATE_PRODUCT'
})
:
this
.
props
.
history
.
goBack
();
}
}
style=
{
{
marginLeft
:
'1em'
}
}
>
<
Icon
type=
"rollback"
/>
返回
<
Icon
type=
"rollback"
/>
{
isEdit
?
'取消'
:
'返回'
}
</
Button
>
}
</
Form
.
Item
>
...
...
src/components/ProductForm/ContactForm.jsx
View file @
a87baa4e
...
...
@@ -20,7 +20,14 @@ import {
Spin
}
from
'antd'
;
import
{
arrayRemoveIndex
,
UUID
,
formItemLayout
,
smallFormItemLayout
,
footerFormSubmitLayout
}
from
'../../utils'
;
import
{
arrayRemoveIndex
,
UUID
,
NULL
,
formItemLayout
,
smallFormItemLayout
,
footerFormSubmitLayout
}
from
'../../utils'
;
@
Form
.
create
()
...
...
@@ -87,10 +94,14 @@ export default class ContactForm extends Component {
}
render
()
{
const
{
form
:{
getFieldProps
},
loading
}
=
this
.
props
;
const
{
form
:{
getFieldProps
},
loading
,
isEdit
}
=
this
.
props
;
return
(
<
Spin
spinning=
{
loading
}
>
<
Form
horizontal
onSubmit=
{
this
.
handleSubmit
.
bind
(
this
)
}
>
<
Row
style=
{
{
padding
:
'0 20px'
}
}
>
<
Col
span=
"24"
>
{
isEdit
?
<
Form
.
Item
>
{
this
.
state
.
staffs
.
map
((
item
,
index
)
=>
...
...
@@ -109,25 +120,82 @@ export default class ContactForm extends Component {
})}
/>
</
Col
>
<
Col
span=
"4"
>
<
Icon
type=
"cross"
title=
"删除"
onClick=
{
this
.
handleRemove
.
bind
(
this
,
index
)
}
/>
<
Icon
type=
"cross"
title=
"删除"
onClick=
{
this
.
handleRemove
.
bind
(
this
,
index
)
}
/>
</
Col
>
</
Input
.
Group
>
</
div
>
)
}
</
Form
.
Item
>
:
this
.
state
.
staffs
.
length
?
<
table
>
<
thead
>
<
tr
>
<
th
>
姓名
</
th
>
<
th
>
电话
</
th
>
</
tr
>
</
thead
>
<
tbody
>
{
this
.
state
.
staffs
.
map
((
item
,
index
)
=>
<
tr
key=
{
index
}
>
<
td
>
{
item
.
name
}
</
td
>
<
td
>
{
item
.
mobile
||
NULL
}
</
td
>
</
tr
>
)
}
</
tbody
>
</
table
>
:
<
Form
.
Item
{
...
footerFormSubmitLayout
}
>
还没有设置过任何一位服务经理及其联系电话
</
Form
.
Item
>
}
<
Form
.
Item
{
...
footerFormSubmitLayout
}
style=
{
{
marginTop
:
30
}
}
>
<
Button
onClick=
{
this
.
handleAdd
.
bind
(
this
)
}
style=
{
{
marginRight
:
'1em'
}
}
><
Icon
type=
"plus"
/>
添加
</
Button
>
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
><
Icon
type=
"save"
/>
保存
</
Button
>
{
isEdit
?
<
span
>
<
Button
size=
"large"
onClick=
{
this
.
handleAdd
.
bind
(
this
)
}
style=
{
{
marginRight
:
'1em'
}
}
>
<
Icon
type=
"plus"
/>
添加
</
Button
>
<
Button
size=
"large"
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
>
<
Icon
type=
"save"
/>
保存
</
Button
>
</
span
>
:
<
Button
type=
"primary"
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
props
.
dispatch
({
type
:
'UPDATE_PRODUCT'
});
}
}
>
<
Icon
type=
"edit"
/>
编辑
</
Button
>
}
{
!
this
.
props
.
isCreate
&&
<
Button
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
props
.
history
.
goBack
();}
}
<
Button
onClick=
{
e
=>
{
e
.
preventDefault
();
isEdit
?
this
.
props
.
dispatch
({
type
:
'CANCEL_UPDATE_PRODUCT'
})
:
this
.
props
.
history
.
goBack
();
}
}
style=
{
{
marginLeft
:
'1em'
}
}
>
<
Icon
type=
"rollback"
/>
返回
<
Icon
type=
"rollback"
/>
{
isEdit
?
'取消'
:
'返回'
}
</
Button
>
}
</
Form
.
Item
>
</
Col
>
</
Row
>
</
Form
>
</
Spin
>
);
...
...
src/components/ProductForm/DateTimeStatusForm.jsx
View file @
a87baa4e
...
...
@@ -22,6 +22,7 @@ import {
import
{
PRODUCT_STATUS
,
productStatusToString
,
formatDateTime
,
arrayRemoveIndex
,
UUID
,
...
...
@@ -79,7 +80,7 @@ export default class DateTimeSatausForm extends Component {
render
()
{
const
{
product
,
loading
,
form
:{
getFieldProps
},
isCreate
}
=
this
.
props
;
const
{
product
,
loading
,
form
:{
getFieldProps
},
isCreate
,
isEdit
}
=
this
.
props
;
const
{
fundReservationStartTime
,
fundRaisedEndTime
,
...
...
@@ -97,6 +98,8 @@ export default class DateTimeSatausForm extends Component {
{
!
isCreate
&&
<
Form
.
Item
label=
"产品状态"
{
...
formItemLayout
}
wrapperCol=
{
{
span
:
20
}
}
>
{
isEdit
?
<
Radio
.
Group
{
...
getFieldProps
('
status
',
{
initialValue
:
product
.
status
+
''})}
>
{
ProductStatus
.
map
((
status
,
index
)
=>
...
...
@@ -105,16 +108,28 @@ export default class DateTimeSatausForm extends Component {
)
}
</
Radio
.
Group
>
:
productStatusToString
(
product
.
status
)
}
</
Form
.
Item
>
}
<
Form
.
Item
label=
"预约开始时间"
{
...
formItemLayout
}
>
{
isEdit
?
<
DatePicker
showTime
format=
"yyyy-MM-dd HH:mm:ss"
placeholder=
"请选择预约开始时间"
{
...
getFieldProps
('
fundReservationStartTime
',
{
initialValue
:
fundReservationStartTime
?
formatDateTime
(
fundReservationStartTime
)
:
''
})}
/>
:
fundReservationStartTime
?
formatDateTime
(
fundReservationStartTime
)
:
NULL
}
</
Form
.
Item
>
<
Form
.
Item
label=
"募集开始与结束时间"
{
...
formItemLayout
}
>
{
isEdit
?
<
DatePicker
.
RangePicker
showTime
format=
"yyyy-MM-dd HH:mm:ss"
{
...
getFieldProps
('
fundRaisedStartTime
',
{
initialValue
:
[
...
...
@@ -123,15 +138,30 @@ export default class DateTimeSatausForm extends Component {
]
})}
/>
:
((
fundReservationStartTime
?
formatDateTime
(
fundReservationStartTime
)
:
NULL
)
+
' 、'
+
(
fundRaisedEndTime
?
formatDateTime
(
fundRaisedEndTime
)
:
NULL
))
}
</
Form
.
Item
>
<
Form
.
Item
label=
"汇款结束时间"
{
...
formItemLayout
}
>
{
isEdit
?
<
DatePicker
showTime
format=
"yyyy-MM-dd HH:mm:ss"
placeholder=
"请选择汇款结束时间"
{
...
getFieldProps
('
remittanceEndTime
',
{
initialValue
:
remittanceEndTime
?
formatDateTime
(
remittanceEndTime
)
:
''
})}
/>
:
remittanceEndTime
?
formatDateTime
(
remittanceEndTime
)
:
NULL
}
</
Form
.
Item
>
<
Form
.
Item
label=
"基金成立与到期时间"
{
...
formItemLayout
}
>
{
isEdit
?
<
DatePicker
.
RangePicker
showTime
format=
"yyyy-MM-dd HH:mm:ss"
{
...
getFieldProps
('
fundEstablishedTime
',
{
initialValue
:
[
...
...
@@ -140,14 +170,41 @@ export default class DateTimeSatausForm extends Component {
]
})}
/>
:
((
fundEstablishedTime
?
formatDateTime
(
fundEstablishedTime
)
:
NULL
)
+
' 、'
+
(
fundExpireTime
?
formatDateTime
(
fundExpireTime
)
:
NULL
))
}
</
Form
.
Item
>
<
Form
.
Item
{
...
footerFormSubmitLayout
}
style=
{
{
marginTop
:
30
}
}
>
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
><
Icon
type=
"save"
/>
保存
</
Button
>
{
isEdit
?
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
>
<
Icon
type=
"save"
/>
保存
</
Button
>
:
<
Button
type=
"primary"
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
props
.
dispatch
({
type
:
'UPDATE_PRODUCT'
});
}
}
>
<
Icon
type=
"edit"
/>
编辑
</
Button
>
}
{
!
this
.
props
.
isCreate
&&
<
Button
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
props
.
history
.
goBack
();}
}
<
Button
onClick=
{
e
=>
{
e
.
preventDefault
();
isEdit
?
this
.
props
.
dispatch
({
type
:
'CANCEL_UPDATE_PRODUCT'
})
:
this
.
props
.
history
.
goBack
();
}
}
style=
{
{
marginLeft
:
'1em'
}
}
>
<
Icon
type=
"rollback"
/>
返回
<
Icon
type=
"rollback"
/>
{
isEdit
?
'取消'
:
'返回'
}
</
Button
>
}
</
Form
.
Item
>
...
...
src/components/ProductForm/DocumentsForm.jsx
View file @
a87baa4e
...
...
@@ -23,11 +23,14 @@ import {
import
{
arrayRemoveIndex
,
UUID
,
NULL
,
formItemLayout
,
smallFormItemLayout
,
footerFormSubmitLayout
,
handleUpload
}
from
'../../utils'
;
import
Copy
from
'../../components/CopyToClipboard/CopyToClipboard'
;
@
Form
.
create
()
export
default
class
DocumentsForm
extends
Component
{
...
...
@@ -49,7 +52,7 @@ export default class DocumentsForm extends Component {
};
componentWillMount
(){
componentWillMount
()
{
}
...
...
@@ -76,35 +79,64 @@ export default class DocumentsForm extends Component {
}
render
()
{
const
{
user
,
loading
}
=
this
.
props
;
const
{
user
,
loading
,
isEdit
}
=
this
.
props
;
return
(
<
Spin
spinning=
{
loading
}
>
<
Form
horizontal
onSubmit=
{
this
.
handleSubmit
.
bind
(
this
)
}
style=
{
{
maxWidth
:
'800px'
,
margin
:
'auto'
}
}
>
<
Row
style=
{
{
padding
:
'0 20px'
}
}
>
<
Col
span=
"24"
>
<
Form
.
Item
>
{
isEdit
?
<
Upload
.
Dragger
action=
"/api/fileUpload/upload"
multiple=
{
true
}
headers=
{
{
authorization
:
user
&&
user
.
token
,
}
}
onChange=
{
info
=>
this
.
setState
({
fileList
:
handleUpload
(
info
)})
}
fileList=
{
this
.
state
.
fileList
}
>
//showUploadList=
{
false
}
onPreview=
{
(
e
)
=>
console
.
log
(
e
)
}
fileList=
{
this
.
state
.
fileList
}
>
<
p
className=
"ant-upload-drag-icon"
>
<
Icon
type=
"inbox"
/>
</
p
>
<
p
className=
"ant-upload-text"
>
点击或将文件拖拽到此区域上传
</
p
>
<
p
className=
"ant-upload-hint"
>
支持单个或批量上传,严禁上传公司内部资料及其他违禁文件
</
p
>
</
Upload
.
Dragger
>
:
<
ul
style=
{
{
paddingTop
:
30
}
}
>
{
this
.
state
.
fileList
.
map
(
file
=>
<
li
key=
{
file
.
uid
}
style=
{
{
margin
:
"10px 0"
}
}
>
<
Copy
copyText=
{
file
.
url
}
>
<
Row
>
<
Col
span=
"4"
><
Icon
type=
"paper-clip"
style=
{
{
marginRight
:
'.3em'
}
}
/>
{
file
.
name
}
</
Col
>
<
Col
span=
"20"
>
{
file
.
url
?
file
.
url
:
'正在上传...'
}
</
Col
>
</
Row
>
</
Copy
>
</
li
>
)
}
</
ul
>
}
</
Form
.
Item
>
<
Form
.
Item
style=
{
{
marginTop
:
30
,
textAlign
:
'center'
}
}
>
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
><
Icon
type=
"save"
/>
保存
</
Button
>
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
><
Icon
type=
"save"
/>
保存
</
Button
>
{
!
this
.
props
.
isCreate
&&
<
Button
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
props
.
history
.
goBack
();}
}
style=
{
{
marginLeft
:
'1em'
}
}
>
<
Icon
type=
"rollback"
/>
返回
<
Icon
type=
"rollback"
/>
{
isEdit
?
'取消'
:
'返回'
}
</
Button
>
}
</
Form
.
Item
>
</
Col
>
</
Row
>
</
Form
>
</
Spin
>
);
...
...
src/components/ProductForm/ElementForm.jsx
View file @
a87baa4e
...
...
@@ -140,30 +140,62 @@ export default class ElementForm extends Component {
</
Form
.
Item
>
</
div
>
:
this
.
state
.
elements
.
length
?
<
table
>
<
tbody
>
{
this
.
state
.
elements
.
map
(
item
=>
this
.
state
.
elements
.
map
(
item
=>
{
item
.
title
&&
item
.
content
&&
<
tr
>
<
th
>
{
item
.
title
}
</
th
>
<
td
>
{
item
.
content
||
NULL
}
</
td
>
<
td
>
{
item
.
content
}
</
td
>
</
tr
>
}
)
}
</
tbody
>
</
table
>
:
<
Form
.
Item
{
...
footerFormSubmitLayout
}
>
还没有设置过任何基本要素
</
Form
.
Item
>
}
<
Form
.
Item
{
...
footerFormSubmitLayout
}
style=
{
{
marginTop
:
30
}
}
>
<
Button
onClick=
{
this
.
handleAddElement
.
bind
(
this
)
}
style=
{
{
marginRight
:
'1em'
}
}
><
Icon
type=
"plus"
/>
添加
</
Button
>
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
><
Icon
type=
"save"
/>
保存
</
Button
>
{
isEdit
?
<
span
>
<
Button
size=
"large"
onClick=
{
this
.
handleAddElement
.
bind
(
this
)
}
style=
{
{
marginRight
:
'1em'
}
}
>
<
Icon
type=
"plus"
/>
添加
</
Button
>
<
Button
size=
"large"
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
>
<
Icon
type=
"save"
/>
保存
</
Button
>
</
span
>
:
<
Button
type=
"primary"
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
props
.
dispatch
({
type
:
'UPDATE_PRODUCT'
});
}
}
>
<
Icon
type=
"edit"
/>
编辑
</
Button
>
}
{
!
this
.
props
.
isCreate
&&
<
Button
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
props
.
history
.
goBack
();}
}
<
Button
onClick=
{
e
=>
{
e
.
preventDefault
();
isEdit
?
this
.
props
.
dispatch
({
type
:
'CANCEL_UPDATE_PRODUCT'
})
:
this
.
props
.
history
.
goBack
();
}
}
style=
{
{
marginLeft
:
'1em'
}
}
>
<
Icon
type=
"rollback"
/>
返回
<
Icon
type=
"rollback"
/>
{
isEdit
?
'取消'
:
'返回'
}
</
Button
>
}
</
Form
.
Item
>
...
...
src/components/ProductForm/HuikuanInfoForm.jsx
View file @
a87baa4e
...
...
@@ -108,12 +108,34 @@ export default class HuikuanInfoForm extends Component {
</
Form
.
Item
>
<
Form
.
Item
{
...
footerFormSubmitLayout
}
style=
{
{
marginTop
:
30
}
}
>
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
><
Icon
type=
"save"
/>
保存
</
Button
>
{
isEdit
?
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
>
<
Icon
type=
"save"
/>
保存
</
Button
>
:
<
Button
type=
"primary"
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
props
.
dispatch
({
type
:
'UPDATE_PRODUCT'
});
}
}
>
<
Icon
type=
"edit"
/>
编辑
</
Button
>
}
{
!
this
.
props
.
isCreate
&&
<
Button
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
props
.
history
.
goBack
();}
}
<
Button
onClick=
{
e
=>
{
e
.
preventDefault
();
isEdit
?
this
.
props
.
dispatch
({
type
:
'CANCEL_UPDATE_PRODUCT'
})
:
this
.
props
.
history
.
goBack
();
}
}
style=
{
{
marginLeft
:
'1em'
}
}
>
<
Icon
type=
"rollback"
/>
返回
<
Icon
type=
"rollback"
/>
{
isEdit
?
'取消'
:
'返回'
}
</
Button
>
}
</
Form
.
Item
>
...
...
src/components/ProductForm/ShouyiYongjingForm.jsx
View file @
a87baa4e
...
...
@@ -53,6 +53,14 @@ export default class ShouyiYongjingForm extends Component {
dispatch
:
PropTypes
.
func
};
componentWillReceiveProps
(
nextProps
){
// if(nextProps && nextProps.product && nextProps.product.commissionAlg){
// this.setState({
// yongjing: YongjingTransform(nextProps.product.commissionAlg)
// });
// }
}
/**
* 添加佣金算法
* @param e
...
...
@@ -210,15 +218,40 @@ export default class ShouyiYongjingForm extends Component {
}
</
Form
.
Item
>
<
Form
.
Item
{
...
footerFormSubmitLayout
}
style=
{
{
marginTop
:
30
}
}
>
<
Button
style=
{
{
marginRight
:
'1em'
}
}
onClick=
{
this
.
handleAddYongjing
.
bind
(
this
)
}
><
Icon
type=
"plus"
/>
添加
</
Button
>
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
><
Icon
type=
"save"
/>
保存
</
Button
>
{
isEdit
?
<
span
>
<
Button
size=
"large"
onClick=
{
this
.
handleAddYongjing
.
bind
(
this
)
}
style=
{
{
marginRight
:
'1em'
}
}
>
<
Icon
type=
"plus"
/>
添加
</
Button
>
<
Button
size=
"large"
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
>
<
Icon
type=
"save"
/>
保存
</
Button
>
</
span
>
:
<
Button
type=
"primary"
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
props
.
dispatch
({
type
:
'UPDATE_PRODUCT'
});
}
}
>
<
Icon
type=
"edit"
/>
编辑
</
Button
>
}
{
!
this
.
props
.
isCreate
&&
<
Button
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
props
.
history
.
goBack
();}
}
<
Button
onClick=
{
e
=>
{
e
.
preventDefault
();
isEdit
?
this
.
props
.
dispatch
({
type
:
'CANCEL_UPDATE_PRODUCT'
})
:
this
.
props
.
history
.
goBack
();
}
}
style=
{
{
marginLeft
:
'1em'
}
}
>
<
Icon
type=
"rollback"
/>
返回
<
Icon
type=
"rollback"
/>
{
isEdit
?
'取消'
:
'返回'
}
</
Button
>
}
</
Form
.
Item
>
...
...
src/containers/BaseFunction/BaseUpload.jsx
View file @
a87baa4e
...
...
@@ -67,10 +67,10 @@ export default class BaseUpload extends Component {
<
p
className=
"ant-upload-text"
>
点击或将图片拖拽到此区域上传
</
p
>
<
p
className=
"ant-upload-hint"
>
支持单个或批量上传,严禁上传公司内部资料及其他违禁文件
</
p
>
</
Upload
.
Dragger
>
<
ul
className=
{
styles
.
fileList
}
>
<
ul
style=
{
{
paddingTop
:
30
}
}
>
{
this
.
state
.
fileList
.
map
(
file
=>
<
li
key=
{
file
.
uid
}
>
<
li
key=
{
file
.
uid
}
style=
{
{
margin
:
'10px 0'
}
}
>
<
Copy
copyText=
{
file
.
url
}
>
<
Row
>
<
Col
span=
"4"
><
Icon
type=
"paper-clip"
...
...
src/containers/Product/AddItem.jsx
View file @
a87baa4e
...
...
@@ -69,6 +69,7 @@ class PublishForm extends Component {
product
:
state
.
product
.
item
,
loading
:
state
.
product
.
loading
,
isCreate
:
true
,
isEdit
:
state
.
product
.
isEdit
}))
export
default
class
AddItem
extends
Component
{
...
...
@@ -76,7 +77,7 @@ export default class AddItem extends Component {
constructor
(
props
,
content
)
{
super
(
props
,
content
);
this
.
state
=
{
step
:
parseInt
(
location
.
hash
.
replace
(
'#'
,
''
),
10
)
||
1
isEdit
:
true
}
}
...
...
@@ -98,6 +99,15 @@ export default class AddItem extends Component {
};
componentWillReceiveProps
(
nextProps
)
{
this
.
setState
({
isEdit
:
nextProps
.
isEdit
});
if
(
nextProps
.
product
&&
nextProps
.
product
.
id
){
this
.
props
.
dispatch
({
type
:
'UPDATE_PRODUCT'
});
}
}
fetchCates
()
{
this
.
props
.
dispatch
({
type
:
'FETCH_PRODUCT_CATES'
...
...
@@ -109,6 +119,8 @@ export default class AddItem extends Component {
const
{
product
}
=
this
.
props
;
const
{
isEdit
}
=
this
.
state
;
const
styles
=
require
(
'./Product.less'
);
const
tabs
=
[{
...
...
@@ -148,7 +160,7 @@ export default class AddItem extends Component {
<
Tabs
className=
{
styles
.
tabs
}
tabPosition=
"left"
>
{
tabs
.
map
(
tp
=>
<
Tabs
.
TabPane
tab=
{
tp
.
tab
}
key=
{
tp
.
key
}
>
{
product
&&
<
tp
.
children
{
...
this
.
props
}
isEdit=
{
true
}
/>
}
{
product
&&
<
tp
.
children
{
...
this
.
props
}
isEdit=
{
isEdit
}
/>
}
</
Tabs
.
TabPane
>
)
}
</
Tabs
>
...
...
src/containers/Product/EditItem.jsx
View file @
a87baa4e
...
...
@@ -36,6 +36,7 @@ import Layout from '../../components/Layout/Layout';
product
:
state
.
product
.
item
,
loading
:
state
.
product
.
loading
,
user
:
state
.
user
,
isEdit
:
state
.
product
.
isEdit
}))
export
default
class
EditItem
extends
Component
{
...
...
@@ -46,8 +47,8 @@ export default class EditItem extends Component {
product
:
PropTypes
.
object
};
constructor
()
{
super
(
...
arguments
);
constructor
(
props
,
content
)
{
super
(
props
,
content
);
this
.
state
=
{
isEdit
:
false
}
...
...
@@ -61,6 +62,10 @@ export default class EditItem extends Component {
this
.
fetchItem
(
this
.
props
.
params
.
id
);
};
componentWillReceiveProps
(
nextProps
)
{
this
.
setState
({
isEdit
:
nextProps
.
isEdit
});
}
fetchCates
()
{
this
.
props
.
dispatch
({
type
:
'FETCH_PRODUCT_CATES'
...
...
@@ -82,13 +87,13 @@ export default class EditItem extends Component {
const
styles
=
require
(
'./Product.less'
);
const
tabs
=
[
{
tab
:
'基本信息'
,
children
:
BaseInfoForm
},
{
tab
:
'收益佣金'
,
children
:
ShouyiYongjingForm
},
{
tab
:
'汇款账号'
,
children
:
HuikuanInfoForm
},
{
tab
:
'基本要素'
,
children
:
ElementForm
},
{
tab
:
'时间状态'
,
children
:
DateTimeStatusForm
},
{
tab
:
'相关附件'
,
children
:
DocumentsForm
},
{
tab
:
'服务经理'
,
children
:
ContactForm
}
{
tab
:
'基本信息'
,
children
:
BaseInfoForm
},
{
tab
:
'收益佣金'
,
children
:
ShouyiYongjingForm
},
{
tab
:
'汇款账号'
,
children
:
HuikuanInfoForm
},
{
tab
:
'基本要素'
,
children
:
ElementForm
},
{
tab
:
'时间状态'
,
children
:
DateTimeStatusForm
},
{
tab
:
'相关附件'
,
children
:
DocumentsForm
},
{
tab
:
'服务经理'
,
children
:
ContactForm
}
].
map
((
tabPane
,
index
)
=>
{
tabPane
.
key
=
'tabs-pane-'
+
(
index
+
1
);
return
tabPane
;
...
...
@@ -102,14 +107,23 @@ export default class EditItem extends Component {
{
product
&&
<
Button
type=
"ghost"
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
setState
({
isEdit
:
!
this
.
state
.
isEdit
})}
}
>
onClick=
{
e
=>
{
e
.
preventDefault
();
this
.
props
.
dispatch
({
type
:
isEdit
?
'CANCEL_UPDATE_PRODUCT'
:
'UPDATE_PRODUCT'
});
}
}
>
<
Icon
type=
"edit"
/>
</
Button
>
}
<
Button
type=
"ghost"
onClick=
{
e
=>
{
e
.
preventDefault
();
isEdit
?
this
.
setState
({
isEdit
:
!
this
.
state
.
isEdit
})
:
this
.
props
.
dispatch
({
type
:
'CANCEL_UPDATE_PRODUCT'
})
:
this
.
props
.
history
.
goBack
();
}
}
>
<
Icon
type=
"rollback"
/>
...
...
@@ -118,7 +132,7 @@ export default class EditItem extends Component {
</
div
>
);
const
title
=
(
product
&&
product
.
itemShortTitle
?
product
.
itemShortTitle
+
' - '
:
''
)
+
'产品详情'
+
(
isEdit
?
' - 编辑中'
:
''
);
const
title
=
(
product
&&
product
.
itemShortTitle
?
product
.
itemShortTitle
+
' - '
:
''
)
+
'产品详情'
+
(
isEdit
?
' - 编辑中'
:
''
);
const
header
=
(<
MainHeader
breadcrumb=
{
[
'产品管理'
,
'产品详情'
]
}
title=
{
title
}
operation=
{
operation
}
/>);
...
...
@@ -127,7 +141,7 @@ export default class EditItem extends Component {
<
Tabs
className=
{
styles
.
tabs
}
tabPosition=
"left"
>
{
tabs
.
map
(
tp
=>
<
Tabs
.
TabPane
tab=
{
tp
.
tab
}
key=
{
tp
.
key
}
>
{
product
&&
<
tp
.
children
{
...
this
.
props
}
isEdit=
{
isEdit
}
/>
}
{
product
&&
<
tp
.
children
{
...
this
.
props
}
isEdit=
{
isEdit
}
/>
}
</
Tabs
.
TabPane
>
)
}
</
Tabs
>
...
...
src/containers/Trade/Commission.jsx
View file @
a87baa4e
...
...
@@ -38,7 +38,7 @@ import MainHeader from '../../components/MainHeader/MainHeader';
@
Form
.
create
()
export
default
class
Commission
extends
Component
{
component
Will
Mount
()
{
component
Did
Mount
()
{
const
{
dispatch
,
params
:{
id
}}
=
this
.
props
;
dispatch
({
type
:
'FETCH_TRADE_ITEM'
,
...
...
src/reducers/product.js
View file @
a87baa4e
...
...
@@ -29,15 +29,25 @@ const product = handleActions({
[
'FETCH_PRODUCT_ITEM_FAILED'
](
state
,
action
){
return
{...
state
,
err
:
action
.
err
,
loading
:
false
}
},
[
'UPDATE_PRODUCT_START'
](
state
){
return
{...
state
,
isEdit
:
true
}
},
[
'UPDATE_PRODUCT_END'
](
state
){
return
{...
state
,
isEdit
:
false
}
},
[
'UPDATE_PRODUCT_ITEM'
](
state
){
return
{...
state
,
loading
:
true
};
},
[
'UPDATE_PRODUCT_ITEM_SUCCESS'
](
state
){
return
{...
state
,
loading
:
false
};
[
'UPDATE_PRODUCT_ITEM_SUCCESS'
](
state
,
action
){
return
{...
state
,
loading
:
false
,
item
:{...
state
.
item
,
...
action
.
item
}
};
},
[
'UPDATE_PRODUCT_ITEM_FAILED'
](
state
,
action
){
return
{...
state
,
loading
:
false
,
err
:
action
.
err
};
},
[
'CREATE_PRODUCT_ITEM'
](
state
){
return
{...
state
,
loading
:
true
};
},
...
...
src/sagas/product.js
View file @
a87baa4e
import
{
takeLatest
}
from
'redux-saga'
;
import
{
take
,
call
,
put
,
fork
,
cancel
,
select
}
from
'redux-saga/effects'
;
import
{
take
,
call
,
put
,
fork
,
cancel
,
select
,
race
}
from
'redux-saga/effects'
;
import
{
fetchList
,
fetchCates
,
fetchItem
,
updateItem
,
createItem
}
from
'../services/product'
;
import
{
message
}
from
'antd'
;
...
...
@@ -75,41 +75,55 @@ function* watchProductItem() {
}
function
*
editItem
(
item
)
{
try
{
try
{
yield
call
(
updateItem
,
item
);
message
.
success
(
'保存成功!'
);
yield
put
({
type
:
'UPDATE_PRODUCT_ITEM_SUCCESS'
,
item
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
err
);
message
.
error
(
err
);
yield
put
({
type
:
'UPDATE_PRODUCT_ITEM_FAILED'
,
type
:
'UPDATE_PRODUCT_ITEM_FAILED'
,
err
});
}
}
function
*
watchEditProductItem
(){
while
(
true
){
const
{
item
}
=
yield
take
(
'UPDATE_PRODUCT_ITEM'
);
yield
fork
(
editItem
,
item
);
function
*
watchEditProductItem
()
{
while
(
true
)
{
yield
take
(
'UPDATE_PRODUCT'
);
yield
put
({
type
:
'UPDATE_PRODUCT_START'
});
const
{
data
}
=
yield
race
({
data
:
take
(
'UPDATE_PRODUCT_ITEM'
),
canceled
:
take
(
'CANCEL_UPDATE_PRODUCT'
)
});
if
(
data
&&
data
.
item
)
{
yield
fork
(
editItem
,
data
.
item
);
}
yield
put
({
type
:
'UPDATE_PRODUCT_END'
});
}
}
function
*
addItem
()
{
try
{
try
{
const
item
=
yield
call
(
createItem
);
yield
put
({
type
:
'CREATE_PRODUCT_ITEM_SUCCESS'
,
item
});
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
err
);
message
.
error
(
err
);
yield
put
({
type
:
'CREATE_PRODUCT_ITEM_FAILED'
,
type
:
'CREATE_PRODUCT_ITEM_FAILED'
,
err
});
}
...
...
src/utils.js
View file @
a87baa4e
...
...
@@ -102,9 +102,9 @@ export const tradeStatusToString = status => {
export
const
tradeCreateTypeToString
=
type
=>
{
switch
(
type
)
{
case
1
:
return
'后台创建'
;
case
5
:
return
'APP创建'
;
case
5
:
return
'后台创建'
;
default
:
return
'未知创建者'
;
}
...
...
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