Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
console
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
console
Commits
3d31834a
Commit
3d31834a
authored
Mar 30, 2017
by
nano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
15c4b1c3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
162 additions
and
91 deletions
+162
-91
src/index.js
src/index.js
+2
-0
src/models/Apps.js
src/models/Apps.js
+3
-0
src/router.js
src/router.js
+0
-1
src/routes/AppDetail.js
src/routes/AppDetail.js
+128
-90
src/routes/Login.css
src/routes/Login.css
+3
-0
src/routes/Login.js
src/routes/Login.js
+17
-0
src/services/Packages.js
src/services/Packages.js
+9
-0
No files found.
src/index.js
View file @
3d31834a
...
@@ -16,6 +16,8 @@ app.model(require("./models/Apps"));
...
@@ -16,6 +16,8 @@ app.model(require("./models/Apps"));
app
.
model
(
require
(
"
./models/user
"
));
app
.
model
(
require
(
"
./models/user
"
));
// app.model(require("./models/packages"));
app
.
model
(
require
(
"
./models/Common
"
));
app
.
model
(
require
(
"
./models/Common
"
));
app
.
model
(
require
(
"
./models/App
"
));
app
.
model
(
require
(
"
./models/App
"
));
...
...
src/models/Apps.js
View file @
3d31834a
...
@@ -37,6 +37,9 @@ export default {
...
@@ -37,6 +37,9 @@ export default {
}
else
{
}
else
{
yield
put
({
type
:
'
faile
'
})
yield
put
({
type
:
'
faile
'
})
}
}
},
*
success
({
payload
},
{
call
,
put
})
{
yield
put
({
type
:
'
fetch
'
})
}
}
},
},
subscriptions
:
{
subscriptions
:
{
...
...
src/router.js
View file @
3d31834a
...
@@ -14,7 +14,6 @@ function RouterConfig({ history }) {
...
@@ -14,7 +14,6 @@ function RouterConfig({ history }) {
<
Route
path
=
"
apps
"
component
=
{
Apps
}
/
>
<
Route
path
=
"
apps
"
component
=
{
Apps
}
/
>
<
Route
path
=
"
apps/:id
"
component
=
{
AppDetail
}
/
>
<
Route
path
=
"
apps/:id
"
component
=
{
AppDetail
}
/
>
<
/Route
>
<
/Route
>
<
Route
path
=
"
/loginCallback
"
component
=
{
LoginCallback
}
/
>
<
Route
path
=
"
/loginCallback
"
component
=
{
LoginCallback
}
/
>
<
Route
path
=
"
*
"
component
=
{()
=>
<
div
>
404
<
/div>}/
>
<
Route
path
=
"
*
"
component
=
{()
=>
<
div
>
404
<
/div>}/
>
<
/Router
>
<
/Router
>
...
...
src/routes/AppDetail.js
View file @
3d31834a
...
@@ -2,6 +2,7 @@ import React from 'react';
...
@@ -2,6 +2,7 @@ import React from 'react';
import
{
connect
}
from
'
dva
'
;
import
{
connect
}
from
'
dva
'
;
import
styles
from
'
./AppDetail.less
'
;
import
styles
from
'
./AppDetail.less
'
;
import
config
from
'
../config
'
import
config
from
'
../config
'
import
uuid
from
'
uuid
'
import
{
Form
,
Input
,
Icon
,
Radio
,
Tag
,
Tooltip
,
Button
,
Select
,
Tabs
,
Upload
,
Modal
,
Table
,
Popconfirm
,
Row
,
Col
,
Card
}
from
'
antd
'
import
{
Form
,
Input
,
Icon
,
Radio
,
Tag
,
Tooltip
,
Button
,
Select
,
Tabs
,
Upload
,
Modal
,
Table
,
Popconfirm
,
Row
,
Col
,
Card
}
from
'
antd
'
const
FormItem
=
Form
.
Item
;
const
FormItem
=
Form
.
Item
;
const
RadioButton
=
Radio
.
Button
;
const
RadioButton
=
Radio
.
Button
;
...
@@ -27,18 +28,20 @@ defLocales.forEach(locale => {
...
@@ -27,18 +28,20 @@ defLocales.forEach(locale => {
defNews
[
locale
]
=
[]
defNews
[
locale
]
=
[]
})
})
const
defPackage
=
{
const
defPackage
=
()
=>
{
id
:
''
,
return
{
version
:
''
,
id
:
uuid
.
v1
(),
platforms
:
[],
name
:
''
,
locales
:
[]
version
:
''
,
platforms
:
[],
locales
:
[],
isNew
:
true
}
}
}
const
defPackages
=
{
const
defPackages
=
{
main
:
[]
}
}
const
formItemLayout
=
{
const
formItemLayout
=
{
labelCol
:
{
span
:
5
},
labelCol
:
{
span
:
5
},
wrapperCol
:
{
span
:
24
},
wrapperCol
:
{
span
:
24
},
...
@@ -48,7 +51,6 @@ const uploadProps = {
...
@@ -48,7 +51,6 @@ const uploadProps = {
name
:
'
file
'
,
name
:
'
file
'
,
multiple
:
false
,
multiple
:
false
,
showUploadList
:
false
,
showUploadList
:
false
,
action
:
'
//jsonplaceholder.typicode.com/posts/
'
,
onChange
(
info
)
{
onChange
(
info
)
{
const
status
=
info
.
file
.
status
;
const
status
=
info
.
file
.
status
;
if
(
status
!==
'
uploading
'
)
{
if
(
status
!==
'
uploading
'
)
{
...
@@ -75,16 +77,16 @@ class AppDetail extends React.Component {
...
@@ -75,16 +77,16 @@ class AppDetail extends React.Component {
developers
:
{},
developers
:
{},
publishers
:
{},
publishers
:
{},
news
:
{},
news
:
{},
packages
:
{}
,
packages
:
[]
,
isDanger
:
false
isDanger
:
false
};
};
componentWillReceiveProps
(
nextProps
){
componentWillReceiveProps
(
nextProps
){
const
{
App
:{
developers
,
publishers
,
news
,
packages
=
{}
}
}
=
nextProps
const
{
App
:{
developers
,
publishers
,
news
,
packages
=
[]
}
}
=
nextProps
this
.
setState
({
this
.
setState
({
developers
:
{...
defDevelopers
,
...
developers
},
developers
:
{...
defDevelopers
,
...
developers
},
publishers
:
{...
defPublishers
,
...
publishers
},
publishers
:
{...
defPublishers
,
...
publishers
},
packages
:
{...
defPackages
,
...
packages
}
,
packages
:
[...
defPackages
,
...
packages
]
,
news
:
{...
defNews
,
...
news
},
news
:
{...
defNews
,
...
news
},
})
})
}
}
...
@@ -124,7 +126,7 @@ class AppDetail extends React.Component {
...
@@ -124,7 +126,7 @@ class AppDetail extends React.Component {
onSubmitBase
=
(
e
)
=>
{
onSubmitBase
=
(
e
)
=>
{
const
{
form
,
dispatch
,
params
:
{
id
}}
=
this
.
props
const
{
form
,
dispatch
,
params
:
{
id
}}
=
this
.
props
e
.
preventDefault
();
e
&&
e
.
preventDefault
();
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
if
(
!
err
)
{
if
(
!
err
)
{
console
.
log
(
'
Received values of form:
'
,
values
);
console
.
log
(
'
Received values of form:
'
,
values
);
...
@@ -139,7 +141,7 @@ class AppDetail extends React.Component {
...
@@ -139,7 +141,7 @@ class AppDetail extends React.Component {
onSubmitIntro
=
(
e
)
=>
{
onSubmitIntro
=
(
e
)
=>
{
const
{
form
,
dispatch
,
params
:
{
id
}}
=
this
.
props
const
{
form
,
dispatch
,
params
:
{
id
}}
=
this
.
props
e
.
preventDefault
();
e
&&
e
.
preventDefault
();
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
if
(
!
err
)
{
if
(
!
err
)
{
console
.
log
(
'
Received values of form:
'
,
values
);
console
.
log
(
'
Received values of form:
'
,
values
);
...
@@ -154,7 +156,7 @@ class AppDetail extends React.Component {
...
@@ -154,7 +156,7 @@ class AppDetail extends React.Component {
onSubmitManage
=
(
e
)
=>
{
onSubmitManage
=
(
e
)
=>
{
const
{
form
,
dispatch
,
params
:
{
id
}}
=
this
.
props
const
{
form
,
dispatch
,
params
:
{
id
}}
=
this
.
props
e
.
preventDefault
();
e
&&
e
.
preventDefault
();
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
if
(
!
err
)
{
if
(
!
err
)
{
console
.
log
(
'
Received values of form:
'
,
values
);
console
.
log
(
'
Received values of form:
'
,
values
);
...
@@ -173,45 +175,62 @@ class AppDetail extends React.Component {
...
@@ -173,45 +175,62 @@ class AppDetail extends React.Component {
onSubmitUpload
=
(
e
)
=>
{
onSubmitUpload
=
(
e
)
=>
{
const
{
form
,
dispatch
,
params
:
{
id
}}
=
this
.
props
const
{
form
,
dispatch
,
params
:
{
id
}}
=
this
.
props
e
.
preventDefault
();
e
&&
e
.
preventDefault
();
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
if
(
!
err
)
{
if
(
!
err
)
{
console
.
log
(
'
Received values of form:
'
,
values
);
console
.
log
(
'
Received values of form:
'
,
values
);
let
{
packages
}
=
values
let
{
upload
:
{
packages
}
}
=
values
// dispatch({type: "Apps/update", payload: {id, packages}})
dispatch
({
type
:
"
Apps/update
"
,
payload
:
{
id
,
packages
}})
}
});
}
onDeletePackage
=
(
_id
)
=>
{
const
{
form
,
dispatch
,
params
:
{
id
}}
=
this
.
props
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
if
(
!
err
)
{
let
{
upload
:
{
packages
}}
=
values
packages
.
splice
(
_id
,
1
)
dispatch
({
type
:
"
Apps/update
"
,
payload
:
{
id
,
packages
}})
}
}
});
});
}
}
onEdit
=
(
targetKey
,
action
)
=>
{
onEdit
=
(
targetKey
,
action
)
=>
{
console
.
log
(
targetKey
,
action
)
this
[
action
](
targetKey
);
this
[
action
](
targetKey
);
}
}
add
=
(
targetKey
)
=>
{
add
=
async
(
targetKey
)
=>
{
let
packages
=
this
.
state
.
packages
let
packages
=
this
.
state
.
packages
packages
[
"
main
"
].
push
(
defPackage
)
packages
.
push
(
defPackage
()
)
this
.
setState
({
await
this
.
setState
({
packages
packages
})
})
this
.
onSubmitUpload
()
}
}
remove
=
(
targetKey
)
=>
{
remove
=
async
(
targetKey
)
=>
{
if
(
!
this
.
props
.
isDanger
)
{
if
(
!
this
.
props
.
isDanger
)
{
let
{
packages
}
=
this
.
state
let
{
packages
}
=
this
.
state
packages
[
"
main
"
]
.
splice
(
targetKey
,
1
)
packages
.
splice
(
targetKey
,
1
)
this
.
setState
({
await
this
.
setState
({
packages
packages
})
})
this
.
onDeletePackage
(
targetKey
)
}
}
}
}
...
@@ -591,72 +610,91 @@ class AppDetail extends React.Component {
...
@@ -591,72 +610,91 @@ class AppDetail extends React.Component {
<
div
className
=
{
styles
.
form
}
>
<
div
className
=
{
styles
.
form
}
>
<
Tabs
type
=
"
editable-card
"
className
=
"
app-detail-nav
"
onEdit
=
{
this
.
onEdit
}
>
<
Tabs
type
=
"
editable-card
"
className
=
"
app-detail-nav
"
onEdit
=
{
this
.
onEdit
}
>
{
packages
[
"
main
"
]
&&
packages
[
"
main
"
].
map
((
pack
,
i
)
=>
{
{
packages
&&
packages
.
map
((
pack
,
i
)
=>
{
return
(
if
(
pack
)
{
<
TabPane
tab
=
{
pack
.
id
||
"
New
"
}
key
=
{
i
}
closable
=
{
true
}
>
return
(
<
Form
onSubmit
=
{
this
.
onSubmitUpload
}
>
<
TabPane
tab
=
{
pack
.
name
||
"
New
"
}
key
=
{
i
}
closable
=
{
false
}
>
<
Form
onSubmit
=
{
this
.
onSubmitUpload
}
>
<
FormItem
{...
formItemLayout
}
help
=
"
id
"
>
{
getFieldDecorator
(
`packages["main"][
${
i
}
]["id"]`
,
{
<
FormItem
{...
formItemLayout
}
help
=
"
id
"
>
initialValue
:
pack
[
"
id
"
]
{
getFieldDecorator
(
`upload["packages"][
${
i
}
]["id"]`
,
{
})(
initialValue
:
pack
[
"
id
"
]
<
Input
addonBefore
=
{
<
Icon
type
=
"
info-circle-o
"
/>
}
placeholder
=
"
id
"
/>
})(
)}
<
Input
addonBefore
=
{
<
Icon
type
=
"
info-circle-o
"
/>
}
placeholder
=
"
id
"
disabled
/>
<
/FormItem
>
)}
<
/FormItem
>
<
FormItem
{...
formItemLayout
}
help
=
"
version
"
>
{
getFieldDecorator
(
`packages["main"][
${
i
}
]["version"]`
,
{
<
FormItem
{...
formItemLayout
}
help
=
"
name
"
>
initialValue
:
pack
[
"
version
"
]
{
getFieldDecorator
(
`upload["packages"][
${
i
}
]["name"]`
,
{
})(
initialValue
:
pack
[
"
name
"
]
<
Input
addonBefore
=
{
<
Icon
type
=
"
info-circle-o
"
/>
}
placeholder
=
"
版本号
"
/>
})(
)}
<
Input
addonBefore
=
{
<
Icon
type
=
"
info-circle-o
"
/>
}
placeholder
=
"
name
"
/>
<
/FormItem
>
)}
<
/FormItem
>
<
FormItem
{...
formItemLayout
}
help
=
"
platforms
"
>
{
getFieldDecorator
(
`packages["main"][
${
i
}
]["platforms"]`
,
{
<
FormItem
{...
formItemLayout
}
help
=
"
version
"
>
initialValue
:
pack
[
"
platforms
"
]
{
getFieldDecorator
(
`upload["packages"][
${
i
}
]["version"]`
,
{
})(
initialValue
:
pack
[
"
version
"
]
<
Select
multiple
style
=
{{
width
:
'
100%
'
}}
placeholder
=
"
platforms
"
>
})(
{
defPlatform
.
map
((
_platform
,
i
)
=>
{
<
Input
addonBefore
=
{
<
Icon
type
=
"
info-circle-o
"
/>
}
placeholder
=
"
版本号
"
/>
return
<
Select
.
Option
key
=
{
i
}
value
=
{
_platform
}
>
{
_platform
}
<
/Select.Option
>
)}
})}
<
/FormItem
>
<
/Select
>
)}
<
FormItem
{...
formItemLayout
}
help
=
"
platforms
"
>
<
/FormItem
>
{
getFieldDecorator
(
`upload["packages"][
${
i
}
]["platforms"]`
,
{
initialValue
:
pack
[
"
platforms
"
]
<
FormItem
{...
formItemLayout
}
help
=
"
locales
"
>
})(
{
getFieldDecorator
(
`packages["main"][
${
i
}
]["locales"]`
,
{
<
Select
multiple
style
=
{{
width
:
'
100%
'
}}
placeholder
=
"
platforms
"
>
initialValue
:
pack
[
"
locales
"
]
{
defPlatform
.
map
((
_platform
,
i
)
=>
{
})(
return
<
Select
.
Option
key
=
{
i
}
value
=
{
_platform
}
>
{
_platform
}
<
/Select.Option
>
<
Select
multiple
style
=
{{
width
:
'
100%
'
}}
placeholder
=
"
locales
"
>
})}
{
defLocales
.
map
((
_locales
,
i
)
=>
{
<
/Select
>
return
<
Select
.
Option
key
=
{
i
}
value
=
{
_locales
}
>
{
_locales
}
<
/Select.Option
>
)}
})}
<
/FormItem
>
<
/Select
>
)}
<
FormItem
{...
formItemLayout
}
help
=
"
locales
"
>
<
/FormItem
>
{
getFieldDecorator
(
`upload["packages"][
${
i
}
]["locales"]`
,
{
initialValue
:
pack
[
"
locales
"
]
<
FormItem
{...
formItemLayout
}
>
})(
{
getFieldDecorator
(
`packages["main"][
${
i
}
]["upload"]`
,
{
<
Select
multiple
style
=
{{
width
:
'
100%
'
}}
placeholder
=
"
locales
"
>
})(
{
defLocales
.
map
((
_locales
,
i
)
=>
{
<
Dragger
{...
uploadProps
}
>
return
<
Select
.
Option
key
=
{
i
}
value
=
{
_locales
}
>
{
_locales
}
<
/Select.Option
>
<
p
className
=
"
ant-upload-drag-icon
"
>
})}
<
Icon
type
=
"
inbox
"
/>
<
/Select
>
<
/p
>
)}
<
p
className
=
"
ant-upload-text
"
>
Click
or
drag
file
to
this
area
to
upload
<
/p
>
<
/FormItem
>
<
p
className
=
"
ant-upload-hint
"
>
Support
for
a
single
or
bulk
upload
.
Strictly
prohibit
from
uploading
company
data
or
other
band
files
<
/p
>
<
/Dragger
>
<
FormItem
{...
formItemLayout
}
>
)}
{
getFieldDecorator
(
`upload["packages"][
${
i
}
]["upload"]`
,
{
<
/FormItem
>
})(
<
Dragger
<
FormItem
{...
formItemLayout
}
>
{...
uploadProps
}
<
div
className
=
{
styles
.
wrapSubmit
}
>
action
=
{
`
${
config
.
apiRoot
}
/upload/packages/
${
pack
[
"
id
"
]}
`
}
<
Button
type
=
"
primary
"
htmlType
=
"
submit
"
size
=
"
large
"
>
提交
<
/Button>
disabled
=
{
pack
.
isNew
}
>
<
/div
>
<
p
className
=
"
ant-upload-drag-icon
"
>
<
/FormItem
>
<
Icon
type
=
"
inbox
"
/>
<
/Form
>
<
/p
>
<
/TabPane
>
<
p
className
=
"
ant-upload-text
"
>
Click
or
drag
file
to
this
area
to
upload
<
/p
>
)
<
p
className
=
"
ant-upload-hint
"
>
Support
for
a
single
or
bulk
upload
.
Strictly
prohibit
from
uploading
company
data
or
other
band
files
<
/p
>
<
/Dragger
>
)}
<
/FormItem
>
<
FormItem
{...
formItemLayout
}
>
<
div
className
=
{
styles
.
wrapSubmit
}
>
<
Button
type
=
"
primary
"
htmlType
=
"
submit
"
size
=
"
large
"
>
提交
<
/Button>
<
/div
>
<
/FormItem
>
<
/Form
>
<
/TabPane
>
)
}
else
{
return
(
<
TabPane
tab
=
{
"
!
"
}
key
=
{
i
}
closable
=
{
true
}
>
<
div
>
好像出了什么问题,
请联系
xxxxxx
<
/div
>
<
/TabPane
>
)
}
})}
})}
<
/Tabs
>
<
/Tabs
>
<
/div
>
<
/div
>
...
...
src/routes/Login.css
0 → 100644
View file @
3d31834a
.normal
{
}
src/routes/Login.js
0 → 100644
View file @
3d31834a
import
React
from
'
react
'
;
import
{
connect
}
from
'
dva
'
;
import
styles
from
'
./Login.css
'
;
function
Login
()
{
return
(
<
div
className
=
{
styles
.
normal
}
>
Route
Component
:
Login
<
/div
>
);
}
function
mapStateToProps
()
{
return
{};
}
export
default
connect
(
mapStateToProps
)(
Login
);
src/services/Packages.js
0 → 100644
View file @
3d31834a
import
request
from
'
../utils/request
'
export
async
function
create
(
params
)
{
return
request
(
`/packages/
${
params
.
id
}
`
,
{
method
:
'
POST
'
,
body
:
JSON
.
stringify
(
params
)
})
}
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