From e7c61c82932312f8f45353583c77b2593830a582 Mon Sep 17 00:00:00 2001 From: yanran200730 Date: Tue, 24 May 2022 13:49:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B9=A1=E6=9D=91=E7=9B=B8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/saas/AppCountryAlbum/Watermark.vue | 42 +++++++++++++++---- .../components/watermark/Watermark1.vue | 41 +++++++++--------- .../components/watermark/Watermark2.vue | 12 +++--- .../components/watermark/Watermark3.vue | 6 +++ .../components/watermark/Watermark4.vue | 18 ++++++-- .../components/watermark/Watermark5.vue | 18 ++++---- .../components/watermark/Watermark6.vue | 9 +++- .../components/watermark/Watermark7.vue | 25 ++++++----- 8 files changed, 111 insertions(+), 60 deletions(-) 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 @@