Browse Source

百度地图处理

koul 3 weeks ago
parent
commit
1b33195791

+ 5 - 5
uas-office-web/uas-mobile/src/components/common/formNew/FormInput.jsx

@@ -31,7 +31,7 @@ import BillModel, {
   billReadOnly,
 } from '../../../model/common/BillModel'
 
-//import MapSearch from '../map/MapSearch'
+import MapSearch from '../map/MapSearch'
 
 /**
  * Created by RaoMeng on 2020/2/19
@@ -456,10 +456,10 @@ export default class FormInput extends Component {
              title={billModel.caption}
              popup
       >
-        {/*<div className='map-modal-root'>
+        <div className='map-modal-root'>
           <MapSearch
               onLocationSelect={this.onMapSelect}/>
-        </div>*/}
+        </div>
       </Modal>
     </div>
 
@@ -524,7 +524,7 @@ export default class FormInput extends Component {
   /**
    * 地图选择
    * */
-  /*onMapSelect = (location) => {
+  onMapSelect = (location) => {
     const { billModel } = this.state
     this.setState({
       modalOpen: false,
@@ -558,7 +558,7 @@ export default class FormInput extends Component {
         },
       },
     ], 'default', location.title)
-  }*/
+  }
   /**
    * 多选本地数据确认
    */

+ 1 - 1
uas-office-web/wxuasapproval/public/index.html

@@ -48,7 +48,7 @@
 <noscript>
     You need to enable JavaScript to run this app.
 </noscript>
-<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=T1GtvYvfay3OYbSauKyRSYZCGE31mnXv"></script>
+<!--<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=T1GtvYvfay3OYbSauKyRSYZCGE31mnXv"></script>-->
 <div id="root" style="width: 100%;height: 100%;"></div>
 <!--
   This HTML file is a template.

+ 1 - 3
uas-office-web/wxuasapproval/src/components/approvalAdd/FormInput.jsx

@@ -16,10 +16,8 @@ import {
   Toast,
 } from 'antd-mobile'
 import { isObjEmpty, isObjNull } from '../../utils/common'
-//import MapSearch from '../map/MapSearch'
+/*import MapSearch from '../map/MapSearch'*/
 import moment from 'moment'
-import 'moment/locale/zh-cn'
-moment.locale('zh-cn')
 
 const prompt = Modal.prompt
 

+ 4 - 0
uas-office-web/wxuasapproval/src/components/map/MapSearch.jsx

@@ -28,6 +28,10 @@
  
    componentDidMount () {
      this.searchBar.focus()
+       if (!window.BMap) {
+           console.warn('百度地图未加载,搜索功能将不可用')
+           return
+       }
      const { BMap } = window
      let that = this
      this.localSearch = new BMap.LocalSearch(this.map,