export const getWeather = () => {
  return new Promise((resolve, reject) => {
    AMap.plugin('AMap.CitySearch', function () {
      var citySearch = new AMap.CitySearch()
      citySearch.getLocalCity(function (status, result) {
        if (status === 'complete' && result.info === 'OK') {
          // 查询成功，result即为当前所在城市信息
          AMap.plugin('AMap.Weather', function () {
            var weather = new AMap.Weather()
            weather.getLive(result.city, function (err, data) {
              resolve({
                err: err,
                data: data
              })
            })
          })
        }
      })
    })
  })
}
