乡村相册

This commit is contained in:
yanran200730
2022-05-24 13:49:03 +08:00
parent d89ee74993
commit e7c61c8293
8 changed files with 111 additions and 60 deletions

View File

@@ -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 => {