许静 5 years ago
parent
commit
032c2cbc38

+ 10
- 7
src/pages/building/list/add/amap.less View File

219
   border-top-color: grey;
219
   border-top-color: grey;
220
 }
220
 }
221
 
221
 
222
-.info {
222
+.infoBox {
223
   padding: .75rem 1.25rem;
223
   padding: .75rem 1.25rem;
224
-  margin-bottom: 1rem;
225
-  border-radius: .25rem;
226
-  position: fixed;
224
+  position: absolute;
227
   top: 1rem;
225
   top: 1rem;
228
   background-color: white;
226
   background-color: white;
229
   width: auto;
227
   width: auto;
230
   min-width: 22rem;
228
   min-width: 22rem;
231
-  border-width: 0;
232
-  right: 1rem;
229
+  left: 1rem;
233
   box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
230
   box-shadow: 0 2px 6px 0 rgba(114, 124, 245, .5);
234
-  position: absolute;
235
   z-index: 100;
231
   z-index: 100;
232
+  .inputText{
233
+    margin-right: 10px;
234
+  }
235
+  .input{
236
+    width: 200px;
237
+  }
238
+ 
236
 }
239
 }
237
 
240
 
238
 .code {
241
 .code {

+ 8
- 12
src/pages/building/list/add/components/amap.jsx View File

1
 import React from 'react';
1
 import React from 'react';
2
 import ReactDOM from 'react-dom';
2
 import ReactDOM from 'react-dom';
3
 import { Map, Marker } from 'react-amap';
3
 import { Map, Marker } from 'react-amap';
4
-import '../amap.less'
4
+import styles from '../amap.less'
5
 
5
 
6
 class Amap extends React.Component {
6
 class Amap extends React.Component {
7
   constructor(props) {
7
   constructor(props) {
54
                 // document.getElementById('info').innerHTML = '您当前所在城市:'+cityinfo;
54
                 // document.getElementById('info').innerHTML = '您当前所在城市:'+cityinfo;
55
                 // 地图显示当前城市
55
                 // 地图显示当前城市
56
                 mapInstance.setBounds(citybounds);
56
                 mapInstance.setBounds(citybounds);
57
-            }
57
+              }
58
             }
58
             }
59
           })
59
           })
60
         })
60
         })
86
 
86
 
87
     return (
87
     return (
88
       <>
88
       <>
89
-        <div style={{ width: '100%', height: '400px' }}>
89
+        <div style={{ width: '100%', height: '400px', position: 'relative' }}>
90
           <Map events={this.amapEvents} amapkey="f0d1d4f82432504003ebf46e5e36ff03">
90
           <Map events={this.amapEvents} amapkey="f0d1d4f82432504003ebf46e5e36ff03">
91
             <Marker position={this.markerPosition} events={this.markerEvents} />
91
             <Marker position={this.markerPosition} events={this.markerEvents} />
92
           </Map>
92
           </Map>
93
           {
93
           {
94
-              <div className="info">
95
-                <div className="input-item">
96
-                  <div className="input-item-prepend">
97
-                    <span className="input-item-text" style={{ width: '8rem' }}>请输入关键字</span>
98
-                  </div>
99
-                  <input id="amapInput" type="text" />
100
-                </div>
101
-            </div>
102
-            }
94
+          <div className={styles.infoBox}>
95
+            <span className={styles.inputText}>请输入关键字</span>
96
+            <input id="amapInput" className={styles.input} type="text" />
97
+          </div>
98
+          }
103
         </div>
99
         </div>
104
       </>
100
       </>
105
     )
101
     )