panhui пре 5 година
родитељ
комит
6c3af65748
1 измењених фајлова са 5 додато и 42 уклоњено
  1. 5 42
      src/main/map/src/views/ChooseLocation.vue

+ 5 - 42
src/main/map/src/views/ChooseLocation.vue

@@ -2,7 +2,6 @@
     <iframe id="iframe" ref="iframe" frameborder="0" scrolling="no"> </iframe>
 </template>
 <script>
-import axios from 'axios'
 window.addEventListener(
     'message',
     function(event) {
@@ -17,48 +16,12 @@ window.addEventListener(
     false,
 );
 export default {
-    name: '',
-    data() {
-        return {
-						location: '',
-						tengxunKey:"GLFBZ-ZR2W6-76XSA-MF7CQ-GDJ6Z-6FB5K"
-        };
-    },
-    computed: {
-        src() {
-            if (this.location) {
-                return (
-                    'https://apis.map.qq.com/tools/locpicker?search=1&type=1&zoom=18&key=${}&referer=Dingdong&coord=' +
-                    this.location
-                );
-            } else {
-                return '';
-            }
-        },
-    },
-    created() {
-			if("geolocation" in navigator) {
-				navigator.geolocation.getCurrentPosition((geolocation)=>{
-					const {coords}=geolocation
-					this.ChangeLocation(coords).then(res=>{
-						console.log(res)
-					})
-					// this.location=coords.latitude+','+coords.longitude
-					// console.log(	this.location)
-					// this.$refs.iframe.src=  'https://apis.map.qq.com/tools/locpicker?search=1&type=1&zoom=18&key=GLFBZ-ZR2W6-76XSA-MF7CQ-GDJ6Z-6FB5K&referer=Dingdong&coord=' +
-					// 						this.location
-					});
-			}
-		},
 		methods:{
-			ChangeLocation(coords){
-			 return 	axios.get(
-        `https://apis.map.qq.com/ws/coord/v1/translate?locations=${coords.latitude},${coords.longitude}&type=1&key=${this.tengxunKey}&get_poi=1`,
-        {
-          prefix: "",
-          mode: "no-cors",
-        }
-      )
+			mounted(){
+				window.setLocation=this.setLocation()
+			},
+			setLocation(location){
+				this.$refs.iframe.src='https://apis.map.qq.com/tools/locpicker?search=1&type=1&zoom=18&key=${}&referer=Dingdong&coord=' +location
 			}
 		}
 };