Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
hfpp2012
/
react-spd
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0cdbcdba
authored
May 26, 2017
by
hfpp2012 yinsigan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
组织代码
1 parent
1eaeb789
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
23 deletions
src/components/ElementGroup.js
src/components/Header.js
src/components/ModalRepoForm.js
src/containers/Spd.js
src/index.js
src/stores/index.js
src/components/ElementGroup.js
View file @
0cdbcdb
...
@@ -2,10 +2,10 @@ import React from 'react'
...
@@ -2,10 +2,10 @@ import React from 'react'
import
Element
from
'./Element'
import
Element
from
'./Element'
import
ReactAddonsUpdate
from
'react-addons-update'
import
ReactAddonsUpdate
from
'react-addons-update'
import
autobind
from
'autobind-decorator'
import
autobind
from
'autobind-decorator'
import
{
observer
}
from
'mobx-react'
import
{
observer
,
inject
}
from
'mobx-react'
;
@
inject
([
"elementGroupStore"
])
@
observer
@
autobind
@
autobind
@
observer
export
default
class
ElementGroup
extends
React
.
Component
{
export
default
class
ElementGroup
extends
React
.
Component
{
cloneElement
(
element
)
{
cloneElement
(
element
)
{
this
.
store
().
cloneElement
(
element
)
this
.
store
().
cloneElement
(
element
)
...
...
src/components/Header.js
View file @
0cdbcdb
...
@@ -2,12 +2,11 @@ import React from 'react'
...
@@ -2,12 +2,11 @@ import React from 'react'
import
ModalRepoForm
from
'./ModalRepoForm'
import
ModalRepoForm
from
'./ModalRepoForm'
import
Loader
from
'halogen/PulseLoader'
import
Loader
from
'halogen/PulseLoader'
import
{
Link
}
from
'react-router-dom'
import
{
Link
}
from
'react-router-dom'
import
{
observer
}
from
'mobx-react'
import
{
observer
,
inject
}
from
'mobx-react'
;
import
autobind
from
'autobind-decorator'
import
autobind
from
'autobind-decorator'
import
stores
from
'../stores'
@
autobind
@
autobind
@
observer
@
inject
([
"headerStore"
])
@
observer
export
default
class
Header
extends
React
.
Component
{
export
default
class
Header
extends
React
.
Component
{
componentDidMount
()
{
componentDidMount
()
{
this
.
props
.
headerStore
.
loadHeaderData
()
this
.
props
.
headerStore
.
loadHeaderData
()
...
@@ -41,7 +40,7 @@ export default class Header extends React.Component {
...
@@ -41,7 +40,7 @@ export default class Header extends React.Component {
return
(
return
(
<
div
className
=
"text-left top-header"
>
<
div
className
=
"text-left top-header"
>
<
ModalRepoForm
handleNewRepo
=
{
this
.
addRepo
}
modalRepoFormStore
=
{
stores
.
ModalRepoFormStore
}
/
>
<
ModalRepoForm
handleNewRepo
=
{
this
.
addRepo
}
/
>
<
div
className
=
'col-md-10'
>
<
div
className
=
'col-md-10'
>
{
result
}
{
result
}
<
/div
>
<
/div
>
...
...
src/components/ModalRepoForm.js
View file @
0cdbcdb
...
@@ -3,10 +3,10 @@ import { Modal, Button } from 'react-bootstrap'
...
@@ -3,10 +3,10 @@ import { Modal, Button } from 'react-bootstrap'
import
EventEmitter
from
'../libs/eventEmitter'
import
EventEmitter
from
'../libs/eventEmitter'
import
$
from
'jquery'
import
$
from
'jquery'
import
autobind
from
'autobind-decorator'
import
autobind
from
'autobind-decorator'
import
{
observer
}
from
'mobx-react'
import
{
observer
,
inject
}
from
'mobx-react'
;
@
inject
([
"modalRepoFormStore"
])
@
observer
@
autobind
@
autobind
@
observer
export
default
class
ModalRepoForm
extends
React
.
Component
{
export
default
class
ModalRepoForm
extends
React
.
Component
{
store
()
{
store
()
{
return
this
.
props
.
modalRepoFormStore
return
this
.
props
.
modalRepoFormStore
...
@@ -17,6 +17,7 @@ export default class ModalRepoForm extends React.Component {
...
@@ -17,6 +17,7 @@ export default class ModalRepoForm extends React.Component {
}
}
open
()
{
open
()
{
console
.
log
(
this
);
this
.
store
().
open
();
this
.
store
().
open
();
}
}
...
...
src/containers/Spd.js
View file @
0cdbcdb
...
@@ -3,7 +3,6 @@ import ElementGroup from '../components/ElementGroup'
...
@@ -3,7 +3,6 @@ import ElementGroup from '../components/ElementGroup'
import
Header
from
'../components/Header'
import
Header
from
'../components/Header'
import
AlertContainer
from
'react-alert'
import
AlertContainer
from
'react-alert'
import
EventEmitter
from
'../libs/eventEmitter'
import
EventEmitter
from
'../libs/eventEmitter'
import
stores
from
'../stores'
export
default
class
Spd
extends
React
.
Component
{
export
default
class
Spd
extends
React
.
Component
{
componentDidMount
()
{
componentDidMount
()
{
...
@@ -39,12 +38,12 @@ export default class Spd extends React.Component {
...
@@ -39,12 +38,12 @@ export default class Spd extends React.Component {
<
div
id
=
"app"
>
<
div
id
=
"app"
>
<
AlertContainer
ref
=
{
a
=>
this
.
msg
=
a
}
{...
this
.
alertOptions
}
/
>
<
AlertContainer
ref
=
{
a
=>
this
.
msg
=
a
}
{...
this
.
alertOptions
}
/
>
<
div
className
=
"row"
>
<
div
className
=
"row"
>
<
Header
headerStore
=
{
stores
.
HeaderStore
}
/
>
<
Header
/>
<
/div
>
<
/div
>
<
div
className
=
"row"
>
<
div
className
=
"row"
>
<
div
className
=
"col-md-2 sidebar"
id
=
'sidebar'
>
<
div
className
=
"col-md-2 sidebar"
id
=
'sidebar'
>
<
h3
className
=
'sidebar-header'
>
元件
<
/h3
>
<
h3
className
=
'sidebar-header'
>
元件
<
/h3
>
<
ElementGroup
elementGroupStore
=
{
stores
.
ElementGroupStore
}
/
>
<
ElementGroup
/>
<
/div
>
<
/div
>
<
div
id
=
"dropzone"
className
=
"col-md-10 dropzone"
>
<
div
id
=
"dropzone"
className
=
"col-md-10 dropzone"
>
{
this
.
props
.
children
}
{
this
.
props
.
children
}
...
...
src/index.js
View file @
0cdbcdb
...
@@ -8,11 +8,20 @@ import {
...
@@ -8,11 +8,20 @@ import {
import
RegionalDesign
from
'./components/RegionalDesign'
import
RegionalDesign
from
'./components/RegionalDesign'
import
{
Provider
}
from
'mobx-react'
import
elementGroupStore
from
'./stores/ElementGroup'
import
headerStore
from
'./stores/Header'
import
modalRepoFormStore
from
'./stores/ModalRepoForm'
const
stores
=
{
elementGroupStore
,
headerStore
,
modalRepoFormStore
}
ReactDOM
.
render
(
ReactDOM
.
render
(
<
Provider
{
...
stores
}
>
<
Router
handler
=
{
Spd
}
history
=
{
Router
}
>
<
Router
handler
=
{
Spd
}
history
=
{
Router
}
>
<
Spd
>
<
Spd
>
<
Route
path
=
"/web/regional_design/:id"
component
=
{
RegionalDesign
}
/
>
<
Route
path
=
"/web/regional_design/:id"
component
=
{
RegionalDesign
}
/
>
<
/Spd
>
<
/Spd
>
<
/Router>
,
<
/Router
>
<
/Provider>
,
document
.
getElementById
(
'root'
)
document
.
getElementById
(
'root'
)
);
);
src/stores/index.js
deleted
100644 → 0
View file @
1eaeb78
import
ModalRepoFormStore
from
'./ModalRepoForm'
import
HeaderStore
from
'./Header'
import
ElementGroupStore
from
'./ElementGroup'
const
stores
=
{
ModalRepoFormStore
,
HeaderStore
,
ElementGroupStore
}
export
default
stores
Write
Preview
Markdown
is supported
Attach a file
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 post a comment