diff --git a/src/saas/AppCountryAlbum/Watermark.vue b/src/saas/AppCountryAlbum/Watermark.vue index 23480b63..50fd6569 100644 --- a/src/saas/AppCountryAlbum/Watermark.vue +++ b/src/saas/AppCountryAlbum/Watermark.vue @@ -87,7 +87,8 @@ albumName: '', watermarkList: [], isShowAlbum: false, - albumList: [] + albumList: [], + address: {} } }, @@ -116,12 +117,7 @@ this.height = uni.getSystemInfoSync().windowHeight this.getWatermarkList() - this.getLocation() - - this.$http.post('/api/appdvcpconfig/apiForward', 'https://apis.map.qq.com/ws/geocoder/v1/?location=39.984154,116.307490&key=3RZBZ-LZUCF-CT6J5-NWKZH-FCWOQ-UUFKY&get_poi=1').then(res => { - console.log(res) - }) }, methods: { @@ -170,18 +166,46 @@ }) }, + getWeather (code) { + this.$http.post(`/api/bdweather/wdata?districtId=${code}`).then(res => { + console.log(res) + if (res.code === 0) { + const data = res.data.result.now + + uni.setStorageSync('address', { + ...uni.getStorageSync('address'), + weather: data.text || '' + }) + + this.address = { + ...uni.getStorageSync('address'), + weather: data.text || '' + } + } + }) + }, + getLocation () { this.injectJWeixin(['getLocation']).then(res => { console.log(res) wx.getLocation({ type: 'wgs84', - success: function (res) { + success: res => { var lat = res.latitude var lng = res.longitude - console.log(lat, lng) this.$http.post('/api/appdvcpconfig/apiForward', `https://apis.map.qq.com/ws/geocoder/v1/?location=${lat},${lng}&key=3RZBZ-LZUCF-CT6J5-NWKZH-FCWOQ-UUFKY&get_poi=1`).then(res => { - console.log(res) + if (res.code === 0) { + const data = res.data.result + uni.setStorageSync('address', { + lat, + lng, + address: data.address, + cityCode: `${data.ad_info.adcode}` + }) + + this.getWeather(`${data.ad_info.adcode}`) + } }) }, error: res => { diff --git a/src/saas/AppCountryAlbum/components/watermark/Watermark1.vue b/src/saas/AppCountryAlbum/components/watermark/Watermark1.vue index 1e38f817..c5b5eaf6 100644 --- a/src/saas/AppCountryAlbum/components/watermark/Watermark1.vue +++ b/src/saas/AppCountryAlbum/components/watermark/Watermark1.vue @@ -14,7 +14,6 @@