Skip to content
This repository was archived by the owner on Aug 24, 2019. It is now read-only.

Commit 5078941

Browse files
committed
popaddapp
1 parent be06b59 commit 5078941

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed

src/components/ProductList/PopAddApp/PopAddApp.js

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,36 @@
11

22
import React, { PropTypes, Component } from 'react';
3-
import {Modal, Button, FormGroup, FormControl, HelpBlock, ControlLabel} from 'react-bootstrap';
3+
import {Modal, Button, FormGroup, FormControl, HelpBlock, ControlLabel, Col} from 'react-bootstrap';
44

55
class PopAddApp extends Component {
66
static propTypes = {
7-
value: PropTypes.string,
7+
submit: PropTypes.func,
88
};
99

1010
static defaultProps = {
11-
value: '',
11+
submit: (name)=>{},
1212
};
1313

1414
constructor() {
1515
super();
1616
this.close = this.close.bind(this);
1717
this.open = this.open.bind(this);
18-
this.state = {showModal: false};
18+
this.setName = this.setName.bind(this);
19+
this.setSelect = this.setSelect.bind(this);
20+
this.submit = this.submit.bind(this);
21+
this.state = {showModal: false, select:0, name: ''};
22+
}
23+
24+
setSelect(event){
25+
this.setState({select: event.target.value})
26+
}
27+
28+
setName(event){
29+
this.setState({name: event.target.value})
30+
}
31+
32+
submit(){
33+
this.props.submit(name);
1934
}
2035

2136
close() {
@@ -34,17 +49,28 @@ class PopAddApp extends Component {
3449
</Modal.Header>
3550
<Modal.Body>
3651
<FormGroup>
37-
<ControlLabel>App名字</ControlLabel>
52+
<ControlLabel style={{ display:'block' }}>App名字</ControlLabel>
3853
<FormControl
39-
value={this.props.value}
54+
style={{ display:'inline-block', width:'60%' }}
55+
onChange={this.setName}
56+
value={this.state.value}
4057
type="text"
4158
/>
59+
<FormControl
60+
style={{ display:'inline-block', marginLeft: 10, width:'30%' }}
61+
componentClass='select'
62+
onChange={this.setSelect}
63+
>
64+
<option value="0" >请选择后缀</option>
65+
<option value="1" >-ios</option>
66+
<option value="2" >-android</option>
67+
</FormControl>
4268
<HelpBlock>必须以后缀(-ios|-android)命名</HelpBlock>
4369
</FormGroup>
4470
</Modal.Body>
4571
<Modal.Footer>
4672
<Button onClick={this.close}>关闭</Button>
47-
<Button onClick={this.close}>确定</Button>
73+
<Button onClick={this.submit}>确定</Button>
4874
</Modal.Footer>
4975
</Modal>
5076
)

0 commit comments

Comments
 (0)