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
5a303517
Commit
5a303517
authored
Aug 10, 2016
by
superman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2016-08-10
parent
613ea9d4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
378 additions
and
238 deletions
+378
-238
index.js
dist/index.js
+32
-32
proxy.config.js
proxy.config.js
+2
-2
ContactForm.jsx
src/components/ProductForm/ContactForm.jsx
+17
-14
DocumentsForm.jsx
src/components/ProductForm/DocumentsForm.jsx
+29
-11
ElementForm.jsx
src/components/ProductForm/ElementForm.jsx
+24
-16
KeyValue.jsx
src/components/ProductForm/KeyValue.jsx
+0
-40
ShouyiYongjingForm.jsx
src/components/ProductForm/ShouyiYongjingForm.jsx
+29
-11
List.jsx
src/containers/Announcement/List.jsx
+1
-1
EditItem.jsx
src/containers/Authority/EditItem.jsx
+2
-2
List.jsx
src/containers/Authority/List.jsx
+0
-10
EditItem.jsx
src/containers/Resource/EditItem.jsx
+2
-1
EditItem.jsx
src/containers/Users/EditItem.jsx
+190
-75
announcement.js
src/reducers/announcement.js
+2
-2
product.js
src/reducers/product.js
+2
-5
user.js
src/reducers/user.js
+8
-2
announcement.js
src/sagas/announcement.js
+15
-6
product.js
src/sagas/product.js
+4
-3
user.js
src/sagas/user.js
+18
-4
utils.js
src/utils.js
+1
-1
No files found.
dist/index.js
View file @
5a303517
This diff is collapsed.
Click to expand it.
proxy.config.js
View file @
5a303517
...
@@ -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 @
5a303517
...
@@ -35,26 +35,29 @@ export default class ContactForm extends Component {
...
@@ -35,26 +35,29 @@ export default class ContactForm extends Component {
constructor
(
props
,
context
)
{
constructor
(
props
,
context
)
{
super
(
props
,
context
);
super
(
props
,
context
);
this
.
state
=
{
this
.
state
=
{
staffs
:
props
.
product
.
staffs
.
map
(
staffs
=>
{
staffs
:
[]
staffs
.
key
=
UUID
();
return
staffs
;
})
};
};
}
}
componentDidMount
()
{
this
.
analysisStaffs
(
this
.
props
);
}
componentWillReceiveProps
(
nextProps
)
{
componentWillReceiveProps
(
nextProps
)
{
if
(
nextProps
&&
nextProps
.
product
.
staffs
&&
nextProps
.
product
.
staffs
)
{
if
(
nextProps
.
isEdit
!==
this
.
props
.
isEdit
)
{
if
(
nextProps
.
product
.
staffs
.
length
!=
this
.
props
.
product
.
staffs
.
length
)
{
this
.
analysisStaffs
(
nextProps
);
this
.
setState
({
}
staffs
:
nextProps
.
product
.
staffs
.
map
(
staffs
=>
{
}
staffs
.
key
=
UUID
();
return
staffs
;
})
});
}
else
{
}
analysisStaffs
(
props
)
{
if
(
props
.
product
&&
props
.
product
.
staffs
)
{
this
.
setState
({
staffs
:
props
.
product
.
staffs
.
map
(
staffs
=>
{
staffs
.
key
=
UUID
();
return
staffs
;
})
});
}
}
}
}
...
...
src/components/ProductForm/DocumentsForm.jsx
View file @
5a303517
...
@@ -52,10 +52,7 @@ export default class DocumentsForm extends Component {
...
@@ -52,10 +52,7 @@ export default class DocumentsForm extends Component {
product
:
PropTypes
.
object
,
product
:
PropTypes
.
object
,
};
};
componentWillMount
()
{
}
handleSubmit
(
e
)
{
handleSubmit
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
...
@@ -83,7 +80,7 @@ export default class DocumentsForm extends Component {
...
@@ -83,7 +80,7 @@ export default class DocumentsForm extends Component {
const
{
user
,
loading
,
isEdit
}
=
this
.
props
;
const
{
user
,
loading
,
isEdit
}
=
this
.
props
;
return
(
return
(
<
Spin
spinning=
{
loading
}
>
<
Spin
spinning=
{
loading
}
>
<
Form
horizontal
onSubmit=
{
this
.
handleSubmit
.
bind
(
this
)
}
style=
{
{
maxWidth
:
'
8
00px'
,
margin
:
'auto'
}
}
>
<
Form
horizontal
onSubmit=
{
this
.
handleSubmit
.
bind
(
this
)
}
style=
{
{
maxWidth
:
'
10
00px'
,
margin
:
'auto'
}
}
>
<
Row
style=
{
{
padding
:
'0 20px'
}
}
>
<
Row
style=
{
{
padding
:
'0 20px'
}
}
>
<
Col
span=
"24"
>
<
Col
span=
"24"
>
<
Form
.
Item
>
<
Form
.
Item
>
...
@@ -112,10 +109,10 @@ export default class DocumentsForm extends Component {
...
@@ -112,10 +109,10 @@ export default class DocumentsForm extends Component {
<
li
key=
{
file
.
uid
}
style=
{
{
margin
:
"10px 0"
}
}
>
<
li
key=
{
file
.
uid
}
style=
{
{
margin
:
"10px 0"
}
}
>
<
Copy
copyText=
{
file
.
url
}
>
<
Copy
copyText=
{
file
.
url
}
>
<
Row
>
<
Row
>
<
Col
span=
"
4
"
><
Icon
type=
"paper-clip"
<
Col
span=
"
6
"
><
Icon
type=
"paper-clip"
style=
{
{
marginRight
:
'.3em'
}
}
/>
{
file
.
name
}
style=
{
{
marginRight
:
'.3em'
}
}
/>
{
file
.
name
}
</
Col
>
</
Col
>
<
Col
span=
"
20
"
>
{
file
.
url
?
file
.
url
:
'正在上传...'
}
</
Col
>
<
Col
span=
"
18
"
>
{
file
.
url
?
file
.
url
:
'正在上传...'
}
</
Col
>
</
Row
>
</
Row
>
</
Copy
>
</
Copy
>
</
li
>
</
li
>
...
@@ -124,18 +121,39 @@ export default class DocumentsForm extends Component {
...
@@ -124,18 +121,39 @@ export default class DocumentsForm extends Component {
</
ul
>
</
ul
>
}
}
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
style=
{
{
marginTop
:
30
,
textAlign
:
'center'
}
}
>
<
Form
.
Item
{
...
footerFormSubmitLayout
}
style=
{
{
marginTop
:
30
}
}
>
<
Button
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
><
Icon
{
type=
"save"
/>
保存
</
Button
>
isEdit
?
<
Button
size=
"large"
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
&&
!
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'
}
}
>
style=
{
{
marginLeft
:
'1em'
}
}
>
<
Icon
type=
"rollback"
/>
<
Icon
type=
"rollback"
/>
{
isEdit
?
'取消'
:
'返回'
}
{
isEdit
?
'取消'
:
'返回'
}
</
Button
>
</
Button
>
}
}
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
</
Row
>
</
Row
>
</
Form
>
</
Form
>
...
...
src/components/ProductForm/ElementForm.jsx
View file @
5a303517
...
@@ -47,7 +47,7 @@ export default class ElementForm extends Component {
...
@@ -47,7 +47,7 @@ export default class ElementForm extends Component {
constructor
(
props
,
context
)
{
constructor
(
props
,
context
)
{
super
(
props
,
context
);
super
(
props
,
context
);
this
.
state
=
{
this
.
state
=
{
elements
:
BaseElementTransform
(
props
.
product
.
elements
)
elements
:
[]
};
};
}
}
...
@@ -57,15 +57,23 @@ export default class ElementForm extends Component {
...
@@ -57,15 +57,23 @@ export default class ElementForm extends Component {
};
};
componentDidMount
()
{
this
.
analysisBaseElement
(
this
.
props
);
}
componentWillReceiveProps
(
nextProps
)
{
componentWillReceiveProps
(
nextProps
)
{
if
(
nextProps
&&
nextProps
.
product
&&
nextProps
.
product
.
elements
)
{
if
(
nextProps
.
isEdit
!==
this
.
props
.
isEdit
)
{
if
(
Object
.
keys
(
nextProps
.
product
.
elements
).
length
!=
Object
.
keys
(
this
.
props
.
product
.
elements
).
length
)
{
this
.
analysisBaseElement
(
nextProps
);
this
.
setState
({
}
elements
:
BaseElementTransform
(
nextProps
.
product
.
elements
)
}
});
}
analysisBaseElement
(
props
)
{
if
(
props
.
product
&&
props
.
product
.
elements
)
{
const
newElements
=
BaseElementTransform
(
props
.
product
.
elements
);
this
.
setState
({
elements
:
newElements
});
}
}
console
.
log
(
nextProps
);
}
}
/**
/**
...
@@ -192,14 +200,14 @@ export default class ElementForm extends Component {
...
@@ -192,14 +200,14 @@ export default class ElementForm extends Component {
{
{
isEdit
?
isEdit
?
<
span
>
<
span
>
<
Button
size=
"large"
onClick=
{
this
.
handleAddElement
.
bind
(
this
)
}
<
Button
size=
"large"
onClick=
{
this
.
handleAddElement
.
bind
(
this
)
}
style=
{
{
marginRight
:
'1em'
}
}
>
style=
{
{
marginRight
:
'1em'
}
}
>
<
Icon
type=
"plus"
/>
添加
<
Icon
type=
"plus"
/>
添加
</
Button
>
</
Button
>
<
Button
size=
"large"
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
>
<
Button
size=
"large"
type=
"primary"
htmlType=
"submit"
loading=
{
loading
}
>
<
Icon
type=
"save"
/>
保存
<
Icon
type=
"save"
/>
保存
</
Button
>
</
Button
>
</
span
>
</
span
>
:
:
<
Button
type=
"primary"
onClick=
{
e
=>
{
<
Button
type=
"primary"
onClick=
{
e
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
...
...
src/components/ProductForm/KeyValue.jsx
deleted
100644 → 0
View file @
613ea9d4
import
React
,
{
Component
,
PropTypes
}
from
'react'
;
import
{
Row
,
Col
,
Form
,
Input
,
Button
,
Checkbox
,
Select
,
message
,
Tabs
,
Cascader
,
Radio
,
Upload
,
Icon
,
Modal
,
DatePicker
,
Table
,
Spin
}
from
'antd'
;
export
default
class
KeyValue
extends
Component
{
render
(){
const
{
label
,
content
,
operation
}
=
this
.
props
;
return
(
<
Row
>
<
Col
span=
{
label
.
layout
}
>
<
Input
{
...
label
.
input
}
/>
</
Col
>
<
Col
span=
{
content
.
layout
}
>
<
Input
{
...
content
.
input
}
/>
</
Col
>
<
Col
span=
{
operation
.
layout
}
>
{
operation
.
input
}
</
Col
>
</
Row
>
);
}
}
src/components/ProductForm/ShouyiYongjingForm.jsx
View file @
5a303517
...
@@ -43,26 +43,44 @@ export default class ShouyiYongjingForm extends Component {
...
@@ -43,26 +43,44 @@ export default class ShouyiYongjingForm extends Component {
super
(
props
,
context
);
super
(
props
,
context
);
this
.
state
=
{
this
.
state
=
{
yongjing
:
YongjingTransform
(
props
.
product
.
commissionAlg
)
yongjing
:
[]
};
};
}
}
componentDidMount
()
{
this
.
analysisYongjing
(
this
.
props
);
}
componentWillReceiveProps
(
nextProps
)
{
if
(
nextProps
.
isEdit
!==
this
.
props
.
isEdit
)
{
this
.
analysisYongjing
(
nextProps
);
}
}
analysisYongjing
(
props
)
{
if
(
props
.
product
&&
props
.
product
.
commissionAlg
)
{
this
.
setState
({
yongjing
:
YongjingTransform
(
props
.
product
.
commissionAlg
)
});
}
}
static
propsType
=
{
static
propsType
=
{
product
:
PropTypes
.
object
,
product
:
PropTypes
.
object
,
user
:
PropTypes
.
object
,
user
:
PropTypes
.
object
,
dispatch
:
PropTypes
.
func
dispatch
:
PropTypes
.
func
};
};
componentWillReceiveProps
(
nextProps
)
{
//
componentWillReceiveProps(nextProps) {
if
(
nextProps
&&
nextProps
.
product
&&
nextProps
.
product
.
commissionAlg
)
{
//
if (nextProps && nextProps.product && nextProps.product.commissionAlg) {
if
(
nextProps
.
product
.
commissionAlg
.
length
!=
this
.
props
.
product
.
commissionAlg
.
length
)
{
//
if (nextProps.product.commissionAlg.length != this.props.product.commissionAlg.length) {
this
.
setState
({
//
this.setState({
yongjing
:
YongjingTransform
(
nextProps
.
product
.
commissionAlg
)
//
yongjing: YongjingTransform(nextProps.product.commissionAlg)
});
//
});
}
//
}
//
}
//
}
}
//
}
/**
/**
* 添加佣金算法
* 添加佣金算法
...
...
src/containers/Announcement/List.jsx
View file @
5a303517
...
@@ -110,7 +110,7 @@ export default class List extends Component {
...
@@ -110,7 +110,7 @@ export default class List extends Component {
onChange=
{
checked
=>
{
onChange=
{
checked
=>
{
this
.
props
.
dispatch
({
this
.
props
.
dispatch
({
type
:
'UPDATE_ANNOUNCEMENT_ITEM'
,
type
:
'UPDATE_ANNOUNCEMENT_ITEM'
,
data
:{
item
:{
id
:
record
.
id
,
id
:
record
.
id
,
status
:
checked
?
1
:
0
status
:
checked
?
1
:
0
}
}
...
...
src/containers/Authority/EditItem.jsx
View file @
5a303517
...
@@ -65,7 +65,6 @@ export default class EditItem extends Component {
...
@@ -65,7 +65,6 @@ export default class EditItem extends Component {
componentWillReceiveProps
(
nextProps
)
{
componentWillReceiveProps
(
nextProps
)
{
if
(
nextProps
.
item
&&
nextProps
.
item
.
permissions
&&
nextProps
.
resources
)
{
if
(
nextProps
.
item
&&
nextProps
.
item
.
permissions
&&
nextProps
.
resources
)
{
this
.
analysisCheckedKeys
(
nextProps
);
this
.
analysisCheckedKeys
(
nextProps
);
console
.
log
(
'analysisCheckedKeys'
);
}
}
};
};
...
@@ -99,7 +98,8 @@ export default class EditItem extends Component {
...
@@ -99,7 +98,8 @@ export default class EditItem extends Component {
if
(
isNaN
(
data
.
status
))
{
if
(
isNaN
(
data
.
status
))
{
ENABLE_STATUS_LIST
.
forEach
(
item
=>
{
ENABLE_STATUS_LIST
.
forEach
(
item
=>
{
if
(
item
.
text
===
data
.
status
)
{
if
(
item
.
text
===
data
.
status
)
{
data
.
status
=
item
.
value
data
.
status
=
item
.
value
;
return
false
;
}
}
})
})
}
}
...
...
src/containers/Authority/List.jsx
View file @
5a303517
...
@@ -122,16 +122,6 @@ export default class List extends Component {
...
@@ -122,16 +122,6 @@ export default class List extends Component {
render
:
(
status
)
=>
(
render
:
(
status
)
=>
(
<
span
>
{
enableStatusToString
(
status
)
}
</
span
>
<
span
>
{
enableStatusToString
(
status
)
}
</
span
>
)
)
},
{
title
:
'操作'
,
key
:
'operation'
,
width
:
120
,
className
:
'tac'
,
render
:
(
text
,
item
)
=>
(
<
span
onClick=
{
e
=>
{
e
.
stopPropagation
();
e
.
preventDefault
();}
}
>
</
span
>
)
}
}
];
];
...
...
src/containers/Resource/EditItem.jsx
View file @
5a303517
...
@@ -73,7 +73,8 @@ export default class EditItem extends Component {
...
@@ -73,7 +73,8 @@ export default class EditItem extends Component {
if
(
isNaN
(
data
.
status
))
{
if
(
isNaN
(
data
.
status
))
{
ENABLE_STATUS_LIST
.
forEach
(
item
=>
{
ENABLE_STATUS_LIST
.
forEach
(
item
=>
{
if
(
item
.
text
===
data
.
status
)
{
if
(
item
.
text
===
data
.
status
)
{
data
.
status
=
item
.
value
data
.
status
=
item
.
value
;
return
false
;
}
}
})
})
}
}
...
...
src/containers/Users/EditItem.jsx
View file @
5a303517
This diff is collapsed.
Click to expand it.
src/reducers/announcement.js
View file @
5a303517
...
@@ -47,10 +47,10 @@ const announcement = handleActions({
...
@@ -47,10 +47,10 @@ const announcement = handleActions({
return
{...
state
,
loading
:
true
}
return
{...
state
,
loading
:
true
}
},
},
[
'UPDATE_ANNOUNCEMENT_ITEM_SUCCESS'
](
state
,
action
){
[
'UPDATE_ANNOUNCEMENT_ITEM_SUCCESS'
](
state
,
action
){
return
{...
state
,
loading
:
false
,
item
:
{...
state
.
item
,
...
action
.
item
}}
return
{...
state
,
loading
:
false
,
i
sEdit
:
false
,
i
tem
:
{...
state
.
item
,
...
action
.
item
}}
},
},
[
'UPDATE_ANNOUNCEMENT_ITEM_FAILED'
](
state
,
action
){
[
'UPDATE_ANNOUNCEMENT_ITEM_FAILED'
](
state
,
action
){
return
{...
state
,
err
:
action
.
err
,
loading
:
false
}
return
{...
state
,
err
:
action
.
err
,
loading
:
false
,
isEdit
:
false
}
},
},
},
initState
);
},
initState
);
...
...
src/reducers/product.js
View file @
5a303517
...
@@ -62,13 +62,11 @@ const product = handleActions({
...
@@ -62,13 +62,11 @@ const product = handleActions({
console
.
log
(
'UPDATE_PRODUCT_ITEM_SUCCESS staffs Error:'
,
action
.
item
.
staffs
);
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
{...
state
,
loading
:
false
,
item
:{...
state
.
item
,
...
action
.
item
},
isEdit
:
false
};
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
,
isEdit
:
false
};
},
},
...
@@ -82,7 +80,6 @@ const product = handleActions({
...
@@ -82,7 +80,6 @@ const product = handleActions({
return
{...
state
,
loading
:
false
,
err
:
action
.
err
};
return
{...
state
,
loading
:
false
,
err
:
action
.
err
};
}
}
},
{
},
{
//cates: [],
items
:
[],
items
:
[],
loading
:
false
,
loading
:
false
,
});
});
...
...
src/reducers/user.js
View file @
5a303517
...
@@ -53,14 +53,20 @@ const user = handleActions({
...
@@ -53,14 +53,20 @@ const user = handleActions({
return
{...
state
,
loading
:
false
,
err
:
action
.
err
};
return
{...
state
,
loading
:
false
,
err
:
action
.
err
};
},
},
[
'UPDATE_USER_START'
](
state
){
return
{...
state
,
isEdit
:
true
}
},
[
'UPDATE_USER_END'
](
state
){
return
{...
state
,
isEdit
:
false
}
},
[
'UPDATE_USER_ITEM'
](
state
){
[
'UPDATE_USER_ITEM'
](
state
){
return
{...
state
,
loading
:
true
};
return
{...
state
,
loading
:
true
};
},
},
[
'UPDATE_USER_ITEM_SUCCESS'
](
state
,
action
){
[
'UPDATE_USER_ITEM_SUCCESS'
](
state
,
action
){
return
{...
state
,
loading
:
false
,
item
:
{...
state
.
item
,
...
action
.
item
}};
return
{...
state
,
loading
:
false
,
item
:
{...
state
.
item
,
...
action
.
item
}
,
isEdit
:
false
};
},
},
[
'UPDATE_USER_ITEM_FAILED'
](
state
,
action
){
[
'UPDATE_USER_ITEM_FAILED'
](
state
,
action
){
return
{...
state
,
loading
:
false
,
err
:
action
.
err
};
return
{...
state
,
loading
:
false
,
err
:
action
.
err
,
isEdit
:
false
};
},
},
},
{
},
{
...
...
src/sagas/announcement.js
View file @
5a303517
...
@@ -78,13 +78,13 @@ function* watchAdd() {
...
@@ -78,13 +78,13 @@ function* watchAdd() {
}
}
}
}
function
*
editItem
(
data
)
{
function
*
editItem
(
item
)
{
try
{
try
{
yield
call
(
updateItem
,
data
);
yield
call
(
updateItem
,
item
);
message
.
success
(
'修改成功!'
);
message
.
success
(
'修改成功!'
);
yield
put
({
yield
put
({
type
:
'UPDATE_ANNOUNCEMENT_ITEM_SUCCESS'
,
type
:
'UPDATE_ANNOUNCEMENT_ITEM_SUCCESS'
,
item
:
data
item
});
});
}
catch
(
err
){
}
catch
(
err
){
console
.
log
(
err
);
console
.
log
(
err
);
...
@@ -109,10 +109,18 @@ function* watchEdit() {
...
@@ -109,10 +109,18 @@ function* watchEdit() {
if
(
data
&&
data
.
item
)
{
if
(
data
&&
data
.
item
)
{
yield
fork
(
editItem
,
data
.
item
);
yield
fork
(
editItem
,
data
.
item
);
}
else
{
yield
put
({
type
:
'UPDATE_ANNOUNCEMENT_END'
});
}
}
yield
put
({
}
type
:
'UPDATE_ANNOUNCEMENT_END'
}
});
function
*
watchSwidth
()
{
while
(
true
){
const
{
item
}
=
yield
take
(
'UPDATE_ANNOUNCEMENT_ITEM'
);
yield
fork
(
editItem
,
item
);
}
}
}
}
...
@@ -121,4 +129,5 @@ export default function*() {
...
@@ -121,4 +129,5 @@ export default function*() {
yield
fork
(
watchItem
);
yield
fork
(
watchItem
);
yield
fork
(
watchAdd
);
yield
fork
(
watchAdd
);
yield
fork
(
watchEdit
);
yield
fork
(
watchEdit
);
yield
fork
(
watchSwidth
);
}
}
src/sagas/product.js
View file @
5a303517
...
@@ -105,10 +105,11 @@ function* watchEditProductItem() {
...
@@ -105,10 +105,11 @@ function* watchEditProductItem() {
if
(
data
&&
data
.
item
)
{
if
(
data
&&
data
.
item
)
{
yield
fork
(
editItem
,
data
.
item
);
yield
fork
(
editItem
,
data
.
item
);
}
else
{
yield
put
({
type
:
'UPDATE_PRODUCT_END'
});
}
}
yield
put
({
type
:
'UPDATE_PRODUCT_END'
});
}
}
}
}
...
...
src/sagas/user.js
View file @
5a303517
import
{
takeLatest
}
from
'redux-saga'
;
import
{
takeLatest
}
from
'redux-saga'
;
import
{
take
,
call
,
put
,
fork
,
cancel
}
from
'redux-saga/effects'
;
import
{
take
,
call
,
put
,
fork
,
cancel
,
race
}
from
'redux-saga/effects'
;
import
{
fetch
,
clear
,
save
,
create
,
fetchList
,
fetchItem
,
updateItem
}
from
'../services/user'
;
import
{
fetch
,
clear
,
save
,
create
,
fetchList
,
fetchItem
,
updateItem
}
from
'../services/user'
;
import
{
message
}
from
'antd'
;
import
{
message
}
from
'antd'
;
...
@@ -107,9 +107,23 @@ function* modifyItem(data) {
...
@@ -107,9 +107,23 @@ function* modifyItem(data) {
}
}
function
*
watchMidfiyItem
(){
function
*
watchMidfiyItem
(){
while
(
true
){
while
(
true
)
{
const
{
data
}
=
yield
take
(
'UPDATE_USER_ITEM'
);
yield
take
(
'UPDATE_USER'
);
yield
fork
(
modifyItem
,
data
);
yield
put
({
type
:
'UPDATE_USER_START'
});
const
{
data
}
=
yield
race
({
data
:
take
(
'UPDATE_USER_ITEM'
),
canceled
:
take
(
'CANCEL_UPDATE_USER'
)
});
if
(
data
&&
data
.
item
)
{
yield
fork
(
modifyItem
,
data
.
item
);
}
else
{
yield
put
({
type
:
'UPDATE_USER_END'
});
}
}
}
}
}
...
...
src/utils.js
View file @
5a303517
...
@@ -69,7 +69,7 @@ export const productEnableCreateTrade = status => {
...
@@ -69,7 +69,7 @@ export const productEnableCreateTrade = status => {
export
const
USER_STATUS
=
{
export
const
USER_STATUS
=
{
0
:
'未激活'
,
0
:
'未激活'
,
1
:
'
正常
'
1
:
'
已激活
'
};
};
export
const
userStatusToString
=
status
=>
{
export
const
userStatusToString
=
status
=>
{
...
...
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