|
@@ -611,76 +611,67 @@ export default {
|
|
|
// document.body.appendChild(oScript);
|
|
|
// this.onlinemap();
|
|
|
},
|
|
|
- async displayPlaceDetail() {
|
|
|
- const placeId = "I63802885C8189B2B"; // 替换为你的Place ID
|
|
|
- const lookup = new mapkit.PlaceLookup();
|
|
|
- lookup.getPlace(placeId, (error, place) => {
|
|
|
- if (error) {
|
|
|
- console.error('Error fetching place:', error);
|
|
|
- return;
|
|
|
- }
|
|
|
- const placeDetailElement = document.getElementById("map");
|
|
|
- const placeDetail = new mapkit.PlaceDetail(placeDetailElement, place, {
|
|
|
- colorScheme: mapkit.PlaceDetail.ColorSchemes.Adaptive
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- calloutForLandmarkAnnotation(annotation) {
|
|
|
- var div = document.createElement("div");
|
|
|
-
|
|
|
- div.className = "landmark";
|
|
|
-
|
|
|
- var title = div.appendChild(document.createElement("h1"));
|
|
|
- console.log(annotation);
|
|
|
- title.textContent = annotation.landmark.title;
|
|
|
-
|
|
|
- var section = div.appendChild(document.createElement("section"));
|
|
|
-
|
|
|
- var phone = section.appendChild(document.createElement("p"));
|
|
|
- phone.className = "phone";
|
|
|
- phone.textContent = annotation.landmark.phone;
|
|
|
-
|
|
|
- var link = section.appendChild(document.createElement("p"));
|
|
|
- link.className = "homepage";
|
|
|
- var a = link.appendChild(document.createElement("a"));
|
|
|
- a.href = annotation.landmark.url;
|
|
|
- a.textContent = "website";
|
|
|
-
|
|
|
- return div;
|
|
|
- },
|
|
|
//在线地图
|
|
|
async onlinemap(){
|
|
|
const token = "eyJraWQiOiI1NEIyRkFLODMzIiwidHlwIjoiSldUIiwiYWxnIjoiRVMyNTYifQ.eyJpc3MiOiJIS0YzNzJKU01LIiwiaWF0IjoxNzMzMTkxMzI2LCJvcmlnaW4iOiJvYS5wYW4tYW1lcmljYW4taW50bC5jb20ifQ.1czYQb-Nxh6n4kG9sVylQH32XawN92gBKXjn6i_SU0F2M9fpwbStM-gDRvfANEiEUDz5ogUmm_FQf9eBF8o9Zg";
|
|
|
mapkit.init({
|
|
|
- language: 'zh-Hans',
|
|
|
+ libraries:'services',
|
|
|
+ language: 'es',
|
|
|
authorizationCallback: function(done) {
|
|
|
done(token);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ mapkit.addEventListener("configuration-change", function(event) {
|
|
|
+ switch (event.status) {
|
|
|
+ case "Initialized":
|
|
|
+ console.log('dasd');
|
|
|
+
|
|
|
+ // MapKit JS initializes and configures.
|
|
|
+ break;
|
|
|
+ case "Refreshed":
|
|
|
+ console.log('das222d');
|
|
|
+ // The MapKit JS configuration updates.
|
|
|
+ break;
|
|
|
}
|
|
|
});
|
|
|
+ // mapkit.load({
|
|
|
+ // libraries: ['services'],
|
|
|
+ // // 这里可以包含授权回调函数
|
|
|
+ // authorizationCallback: function (done, error) {
|
|
|
+ // // 你的授权逻辑
|
|
|
+ // }
|
|
|
+ // }).then(function () {
|
|
|
+ // // 库加载完成后的代码
|
|
|
+ // }).catch(function (error) {
|
|
|
+ // // 错误处理
|
|
|
+ // });
|
|
|
+ // var geocoder = new mapkit.Geocoder();
|
|
|
+
|
|
|
+ var geocoder = new mapkit.Geocoder({
|
|
|
+ language: "zh-Hans",
|
|
|
+ getsUserLocation: true
|
|
|
+ });
|
|
|
+ geocoder.lookup('成都', function (err, data) {
|
|
|
+ console.log(err);
|
|
|
+
|
|
|
+ console.log(data);
|
|
|
+ });
|
|
|
var CALLOUT_OFFSET = new DOMPoint(-148, -78);
|
|
|
var landmarkAnnotationCallout = {
|
|
|
calloutElementForAnnotation: function(annotation) {
|
|
|
- console.log(annotation);
|
|
|
var div = document.createElement("div");
|
|
|
-
|
|
|
div.className = "landmark";
|
|
|
-
|
|
|
var title = div.appendChild(document.createElement("h1"));
|
|
|
- console.log(annotation);
|
|
|
title.textContent = annotation.landmark.title;
|
|
|
-
|
|
|
var section = div.appendChild(document.createElement("section"));
|
|
|
-
|
|
|
- var phone = section.appendChild(document.createElement("p"));
|
|
|
+ var phone = section.appendChild(document.createElement("div"));
|
|
|
phone.className = "phone";
|
|
|
- phone.textContent = annotation.landmark.phone;
|
|
|
-
|
|
|
+ phone.innerHTML = annotation.landmark.phone;
|
|
|
var link = section.appendChild(document.createElement("p"));
|
|
|
link.className = "homepage";
|
|
|
var a = link.appendChild(document.createElement("a"));
|
|
|
a.href = annotation.landmark.url;
|
|
|
a.textContent = "website";
|
|
|
-
|
|
|
return div;
|
|
|
},
|
|
|
|
|
@@ -693,14 +684,16 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
var sanFranciscoLandmarks = [
|
|
|
- { coordinate: new mapkit.Coordinate(104.096488, 30.635261), title: "银泰中心", phone: "+1-415-983-5420", url: "http://www.transamericapyramidcenter.com/" },
|
|
|
- { coordinate: new mapkit.Coordinate(37.7954201, -122.39352), title: "Ferry Building", phone: "+1 (415) 983-8030", url: "http://www.ferrybuildingmarketplace.com" },
|
|
|
+ { coordinate: new mapkit.Coordinate(52.2402, 13.0333), title: "波茨坦", phone: "水电费水电费<br/>asdasdasdasd<br/>tgtgtg", url: "http://www.transamericapyramidcenter.com/" },
|
|
|
+ { coordinate: new mapkit.Coordinate(30.39, 104.04), title: "成都", phone: "+1 (415) 983-8030", url: "http://www.ferrybuildingmarketplace.com" },
|
|
|
{ coordinate: new mapkit.Coordinate(37.8083396, -122.415727), title: "Fisherman's Wharf", phone: "+1 (415) 673-3530", url: "http://visitfishermanswharf.com" },
|
|
|
- { coordinate: new mapkit.Coordinate(37.8023553, -122.405742), title: "Coit Tower", phone: "+1 (415) 249-0995", url: "http://sfrecpark.org/destination/telegraph-hill-pioneer-park/coit-tower/" },
|
|
|
- { coordinate: new mapkit.Coordinate(37.7552305, -122.452624), title: "Sutro Tower", phone: "+1 (415) 681-8850", url: "http://www.sutrotower.com" },
|
|
|
+ { coordinate: new mapkit.Coordinate(52.2285426,21.0128161), title: "波兰国家农业理事会 ", phone: "+1 (415) 249-0995", url: "http://sfrecpark.org/destination/telegraph-hill-pioneer-park/coit-tower/" },
|
|
|
+ { coordinate: new mapkit.Coordinate(31.2203102, 121.4623931), title: "上海", phone: "+1 (415) 681-8850", url: "http://www.sutrotower.com" },
|
|
|
{ coordinate: new mapkit.Coordinate(37.779267, -122.419269), title: "City Hall", phone: "+1 (415) 701-2311", url: "http://sfgsa.org/index.aspx?page=1085" },
|
|
|
{ coordinate: new mapkit.Coordinate(37.8184493, -122.478409), title: "Golden Gate Bridge", phone: "+1 (415) 921-5858", url: "http://www.goldengatebridge.org" },
|
|
|
- { coordinate: new mapkit.Coordinate(37.7785538, -122.514035), title: "Cliff House", phone: "+1 (415) 386-3330", url: "http://www.cliffhouse.com/" }
|
|
|
+ { coordinate: new mapkit.Coordinate(37.7785538, -122.514035), title: "Cliff House", phone: "+1 (415) 386-3330", url: "http://www.cliffhouse.com/" },
|
|
|
+ // { locality:"成都", title: "成都", phone: "+1 (415) 983-8030", url: "http://www.ferrybuildingmarketplace.com" },
|
|
|
+ // { coordinate: new mapkit.Geocoder("成都"), title: "成都", phone: "+1 (415) 983-8030", url: "http://www.ferrybuildingmarketplace.com" }
|
|
|
];
|
|
|
var annotations = sanFranciscoLandmarks.map(function(landmark) {
|
|
|
var annotation = new mapkit.MarkerAnnotation(landmark.coordinate, {
|
|
@@ -713,7 +706,7 @@ export default {
|
|
|
|
|
|
|
|
|
this.map = new mapkit.Map("map");
|
|
|
- this.map.showItems(annotations);
|
|
|
+ this.map.showItems(annotations);
|
|
|
|
|
|
// this.map = new mapkit.Map("map", {
|
|
|
// center: new mapkit.Coordinate(104.096488, 30.635261),
|
|
@@ -1636,10 +1629,10 @@ export default {
|
|
|
}
|
|
|
|
|
|
a:link, a:visited {
|
|
|
- color: #2aaef5;
|
|
|
- outline: none;
|
|
|
- text-decoration: none;
|
|
|
-}
|
|
|
+ color: #2aaef5;
|
|
|
+ outline: none;
|
|
|
+ text-decoration: none;
|
|
|
+ }
|
|
|
.landmark {
|
|
|
width: 250px;
|
|
|
padding: 7px 0 0 0;
|