liukangdong
2024-07-25 b6d5c43b9dd39066a949c0dcdc944d4c17351256
admin/src/components/business/OperaShopWindow.vue
@@ -63,6 +63,8 @@
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import { jsonp } from 'vue-jsonp'
export default {
  name: 'OperaShopWindow',
  extends: BaseOpera,
@@ -109,8 +111,21 @@
  },
  methods: {
    searchAddress( ){
      if(this.geocoder && this.searchValue){
        this.geocoder.getLocation(this.searchValue)
      if (  this.searchValue) {
       var that = this
        jsonp('https://apis.map.qq.com/ws/geocoder/v1/', {
          address: this.searchValue,
          key: 'HIDBZ-2QXL4-TAWUD-XET6Q-EKTJE-CCBSQ',
          output: 'jsonp'
        }).then(result => {
          console.log(result)
          if(result.result.location){
            that.changePostion(result.result.location.lng, result.result.location.lat)
          }
        }).catch(error => {
          // 请求失败处理
          console.log(error)
        })
      }
    },
    initMap (lat, long) {
@@ -126,14 +141,14 @@
          that.changePostion(event.latLng.lng, event.latLng.lat)
        }
      )
      this.geocoder = new qq.maps.Geocoder()
     /* this.geocoder = new qq.maps.Geocoder()
      this.geocoder.setComplete(function (result) {
        that.changePostion(result.detail.location.lng,result.detail.location.lat)
      })
      // 若服务请求失败,则运行以下函数
      this.geocoder.setError(function () {
        console.log('逆解析失败')
      })
      this.geocoder.setError(function (e) {
        console.log(that.searchValue + '=====逆解析失败')
      })*/
    },
    open (title, target) {
      this.title = title
@@ -236,7 +251,7 @@
          if(this.marker){
            this.marker.setMap(null)
          }
          var pos =new qq.maps.LatLng(lat,lng);
          var pos = new qq.maps.LatLng(lat, lng)
          this.map.setCenter(pos)
          this.marker= new qq.maps.Marker({
            position: pos,