123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- let amapFile = require("./amap-wx");
- // 高德开发者key
- let key = '2ff0325d74a2d6edbdaf5338cc4eb37f';
- let myAmapFun = new amapFile.AMapWX({
- key
- });
- class Amap {
- /**
- * 获取POI数据
- * @param {string} querykeywords
- */
- static getPoiAround(querykeywords = '', location = '') {
- //console.log({
- // querykeywords,
- // location
- // });
- return new Promise((resolve, reject) => myAmapFun.getPoiAround({
- querykeywords,
- success: resolve,
- fail: reject,
- location
- }));
- }
- /**
- * 获取地理描述数据
- */
- static getRegeo() {
- return new Promise((resolve, reject) => myAmapFun.getRegeo({
- success: resolve,
- fail: reject
- }));
- }
- /**
- * 获取天气数据
- *
- */
- static getWeather() {
- return new Promise((resolve, reject) => myAmapFun.getWeather({
- success: resolve,
- fail: reject
- }));
- }
- /**
- * 获取输入提示词
- * @param {string} keywords
- * @param {string} location
- */
- static getInputtips(city, location = '', keywords = '') {
- return new Promise((resolve, reject) => myAmapFun.getInputtips({
- keywords,
- location,
- city,
- success: resolve,
- fail: reject
- }));
- }
- /**
- * 获取路线规划
- * type : getDrivingRoute --驾车
- * type : getWalkingRoute --步行
- * type : getTransitRoute --公交
- * type : getRidingRoute --骑行
- * @param {string} origin
- * @param {string} destination
- */
- static getRoute(origin, destination, type, city) {
- return new Promise((resolve, reject) => myAmapFun[type]({
- origin,
- destination,
- city,
- success: resolve,
- fail: reject
- }));
- }
- }
- module.exports = Amap;
|