This commit is contained in:
yanran200730
2022-07-28 16:23:32 +08:00
parent bcb87f4356
commit 3fd6a284c7

View File

@@ -120,7 +120,7 @@
import Watermark6 from './components/watermark/Watermark6' import Watermark6 from './components/watermark/Watermark6'
import Watermark7 from './components/watermark/Watermark7' import Watermark7 from './components/watermark/Watermark7'
import Watermark8 from './components/watermark/Watermark8' import Watermark8 from './components/watermark/Watermark8'
import { mapActions } from 'vuex' import { mapActions, mapState } from 'vuex'
export default { export default {
name: 'Watermark', name: 'Watermark',
@@ -174,7 +174,8 @@
if (this.currIndex < 0 || !this.watermarkList.length) return [] if (this.currIndex < 0 || !this.watermarkList.length) return []
return this.watermarkList[this.currIndex].itemList return this.watermarkList[this.currIndex].itemList
} },
...mapState(['wxwork'])
}, },
onLoad (query) { onLoad (query) {
@@ -215,7 +216,7 @@
}, },
methods: { methods: {
...mapActions(['injectJWeixin']), ...mapActions(['injectJWeixin', 'agentSign']),
toClipping () { toClipping () {
uni.navigateTo({ uni.navigateTo({
@@ -325,39 +326,44 @@
}, },
getLocation () { getLocation () {
this.injectJWeixin(['getLocation']).then(() => { this.agentSign({
wx.getLocation({ corpId: this.wxwork.config.corpId,
type: 'wgs84', suiteId: this.wxwork.config.suiteId
success: res => { }).then(() => {
var lat = res.latitude this.injectJWeixin(['getLocation']).then(() => {
var lng = res.longitude wx.getLocation({
console.log(res) type: 'wgs84',
alert(JSON.stringify(res)) success: res => {
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 => { var lat = res.latitude
if (res.code === 0) { var lng = res.longitude
const data = res.data.result console.log(res)
uni.setStorageSync('address', { alert(JSON.stringify(res))
lat, 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 => {
lng, if (res.code === 0) {
address: data.address, const data = res.data.result
cityCode: `${data.ad_info.adcode}` uni.setStorageSync('address', {
}) lat,
lng,
address: data.address,
cityCode: `${data.ad_info.adcode}`
})
this.address = { this.address = {
...uni.getStorageSync('address') ...uni.getStorageSync('address')
}
this.getWeather(`${data.ad_info.adcode}`)
} }
})
this.getWeather(`${data.ad_info.adcode}`) },
} error: res => {
}) alert(JSON.stringify(res))
}, console.log(res)
error: res => { }
alert(JSON.stringify(res)) })
console.log(res) }).catch(e => {
} alert(JOSN.stringify(e))
}) })
}).catch(e => {
alert(JOSN.stringify(e))
}) })
}, },