浏览代码

修改项目编辑页排版

魏熙美 5 年前
父节点
当前提交
6b3885f963

+ 1
- 0
package.json 查看文件

55
     "path-to-regexp": "^3.0.0",
55
     "path-to-regexp": "^3.0.0",
56
     "qs": "^6.7.0",
56
     "qs": "^6.7.0",
57
     "react": "^16.8.6",
57
     "react": "^16.8.6",
58
+    "react-amap": "^1.2.8",
58
     "react-copy-to-clipboard": "^5.0.1",
59
     "react-copy-to-clipboard": "^5.0.1",
59
     "react-document-title": "^2.0.3",
60
     "react-document-title": "^2.0.3",
60
     "react-dom": "^16.8.6",
61
     "react-dom": "^16.8.6",

+ 20
- 0
src/pages/building/list/add/components/amap.jsx 查看文件

1
+import React from 'react';
2
+import ReactDOM from 'react-dom';
3
+import { Map } from 'react-amap';
4
+
5
+class Amap extends React.Component {
6
+  constructor(props) {
7
+    super(props)
8
+    this.state = { coordinates: [] }
9
+  }
10
+
11
+  render() {
12
+    return (
13
+      <div style={{ width: '100%', height: '400px' }}>
14
+        <Map amapkey="f0d1d4f82432504003ebf46e5e36ff03"/>
15
+      </div>
16
+    )
17
+  }
18
+}
19
+
20
+export default Amap

+ 2
- 1
src/pages/building/list/add/components/base.jsx 查看文件

9
 import ImageListUpload from '../../../../../components/XForm/ImageListUpload'
9
 import ImageListUpload from '../../../../../components/XForm/ImageListUpload'
10
 import Wangedit from '../../../../../components/Wangedit/Wangedit'
10
 import Wangedit from '../../../../../components/Wangedit/Wangedit'
11
 import TagGroup from './tags'
11
 import TagGroup from './tags'
12
+import Amap from './amap'
12
 import BudildingProjectType from './buildingProjectType'
13
 import BudildingProjectType from './buildingProjectType'
13
 
14
 
14
 const { Option } = Select
15
 const { Option } = Select
177
             {getFieldDecorator('coordinate')(<Input disabled />)}
178
             {getFieldDecorator('coordinate')(<Input disabled />)}
178
           </Form.Item>
179
           </Form.Item>
179
           <Form.Item label="地图位置" hasFeedback>
180
           <Form.Item label="地图位置" hasFeedback>
180
-            {(<Input />)}
181
+            {(<Amap />)}
181
           </Form.Item>
182
           </Form.Item>
182
           <Form.Item label="周边交通" hasFeedback>
183
           <Form.Item label="周边交通" hasFeedback>
183
             {getFieldDecorator('buildingTransport')(
184
             {getFieldDecorator('buildingTransport')(

+ 31
- 15
src/pages/building/list/add/index.jsx 查看文件

29
 };
29
 };
30
 
30
 
31
 function AddBuilding(props) {
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
   return (
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