|
@@ -29,25 +29,41 @@ const formItemLayout = {
|
29
|
29
|
};
|
30
|
30
|
|
31
|
31
|
function AddBuilding(props) {
|
32
|
|
- function tabsCallback(key) {
|
33
|
|
- console.log(key);
|
|
32
|
+
|
|
33
|
+ const [tab, setTab] = useState('base')
|
|
34
|
+
|
|
35
|
+ function tabsCallback(e) {
|
|
36
|
+ console.log(e);
|
|
37
|
+ setTab(e.target.value)
|
34
|
38
|
}
|
35
|
39
|
|
36
|
|
- console.log(props.location)
|
|
40
|
+ // console.log(props.location)
|
37
|
41
|
|
38
|
42
|
return (
|
39
|
|
- <Tabs defaultActiveKey="1" onChange={tabsCallback}>
|
40
|
|
- <TabPane tab="基本信息" key="1">
|
41
|
|
- <Base building={{ buildingId: props.location.query && props.location.query.id }} />
|
42
|
|
- </TabPane>
|
43
|
|
- {
|
44
|
|
- props.location.query.id &&
|
45
|
|
- <TabPane tab="图片" key="2">
|
46
|
|
- {/* '159fd19bb973b6972c10fbebf07ddeb1' */}
|
47
|
|
- <ImageSet building={{ buildingId: props.location.query && props.location.query.id }} />
|
48
|
|
- </TabPane>
|
49
|
|
- }
|
50
|
|
- </Tabs>
|
|
43
|
+ <>
|
|
44
|
+ <Radio.Group value={ tab } buttonStyle="solid" onChange={e => tabsCallback(e)}>
|
|
45
|
+ <Radio.Button value="base">基本信息</Radio.Button>
|
|
46
|
+ {
|
|
47
|
+ props.location.query.id && <Radio.Button value="image">图片</Radio.Button>
|
|
48
|
+ }
|
|
49
|
+ </Radio.Group>
|
|
50
|
+ <div style={{ marginTop: '20px' }}>
|
|
51
|
+ { tab === 'base' && <Base building={{ buildingId: props.location.query && props.location.query.id }} /> }
|
|
52
|
+ { props.location.query.id && (tab === 'image' && <ImageSet building={{ buildingId: props.location.query && props.location.query.id }} />)}
|
|
53
|
+ </div>
|
|
54
|
+ </>
|
|
55
|
+ // <Tabs defaultActiveKey="1" onChange={tabsCallback}>
|
|
56
|
+ // <TabPane tab="基本信息" key="1">
|
|
57
|
+ // <Base building={{ buildingId: props.location.query && props.location.query.id }} />
|
|
58
|
+ // </TabPane>
|
|
59
|
+ // {
|
|
60
|
+ // props.location.query.id &&
|
|
61
|
+ // <TabPane tab="图片" key="2">
|
|
62
|
+ // {/* '159fd19bb973b6972c10fbebf07ddeb1' */}
|
|
63
|
+ // <ImageSet building={{ buildingId: props.location.query && props.location.query.id }} />
|
|
64
|
+ // </TabPane>
|
|
65
|
+ // }
|
|
66
|
+ // </Tabs>
|
51
|
67
|
)
|
52
|
68
|
}
|
53
|
69
|
|