| xqd
@@ -52,4 +52,41 @@
|
|
|
return input.replace(',','--');
|
|
|
};
|
|
|
});
|
|
|
+ module.filter('mapPic', ["$http", function ($http) {
|
|
|
+ return function (input) {
|
|
|
+
|
|
|
+ if (!input) return "img/demo/defaultmap.png";
|
|
|
+ var arr = input.split(',');
|
|
|
+ var key = '9f832e163baac0a04d437a52dd3e5d29';
|
|
|
+ var keywords = arr[arr.length - 1];
|
|
|
+
|
|
|
+ var url = 'http://restapi.amap.com/v3/place/text?key=' + key + '&keywords=' + keywords + "&callback=JSON_CALLBACK";
|
|
|
+
|
|
|
+ // http://restapi.amap.com/v3/staticmap?location=116.481485,39.990464&zoom=10&size=750*300&markers=mid,,A:116.481485,39.990464&key=9f832e163baac0a04d437a52dd3e5d29
|
|
|
+ //$http({
|
|
|
+ // url: 'http://restapi.amap.com/v3/place/text?key=' + key + '&keywords=' + keywords,
|
|
|
+ // method: "get",
|
|
|
+ // withCredentials: true,
|
|
|
+ // headers: {
|
|
|
+ // common: { Authorization: undefined },
|
|
|
+ // 'Content-Type': 'application/json; charset=utf-8'
|
|
|
+ // }
|
|
|
+ //}).then(function (result) {
|
|
|
+ // debugger;
|
|
|
+ //});
|
|
|
+ var map = '';
|
|
|
+ $http.jsonp(url).success(function (result) {
|
|
|
+ var p = result.pois[0];
|
|
|
+ if (p) {
|
|
|
+ var l = result.pois[0].location;
|
|
|
+ map = "http://restapi.amap.com/v3/staticmap?location=" + l + "&zoom=9&size=360*160&markers=mid,,A:" + l + "&key=" + key;
|
|
|
+ debugger;
|
|
|
+ } else {
|
|
|
+ map="img/demo/defaultmap.png";
|
|
|
+ }
|
|
|
+ });
|
|
|
+ debugger;
|
|
|
+ return map;
|
|
|
+ };
|
|
|
+ }]);
|
|
|
})(angular.module('app.filters'));
|