This commit is contained in:
yanran200730
2022-07-29 09:31:13 +08:00
parent 166d8801e6
commit f979551fd4

View File

@@ -6,7 +6,7 @@
<script> <script>
import Tabbar from './components/Tabbar.vue' import Tabbar from './components/Tabbar.vue'
import { mapActions } from "vuex" import { mapActions, mapState } from "vuex"
export default { export default {
name: 'AppCountryAlbum', name: 'AppCountryAlbum',
@@ -39,8 +39,12 @@ export default {
this.$refs?.TabPage?.show() this.$refs?.TabPage?.show()
}, },
computed: {
...mapState['wxwork']
},
methods: { methods: {
...mapActions(['injectJWeixin']), ...mapActions(['injectJWeixin', 'agentSign']),
onChange(e) { onChange(e) {
this.params = e.params this.params = e.params
@@ -48,30 +52,40 @@ export default {
}, },
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({
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 => { type: 'wgs84',
if (res.code === 0) { success: res => {
const data = res.data.result var lat = res.latitude
uni.setStorageSync('address', { var lng = res.longitude
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,
this.getWeather(`${data.ad_info.adcode}`) lng,
} address: data.address,
}) cityCode: `${data.ad_info.adcode}`
}, })
error: res => {
console.log(res) this.address = {
} ...uni.getStorageSync('address')
}
this.getWeather(`${data.ad_info.adcode}`)
}
})
},
error: res => {
console.log(res)
}
})
}).catch(e => {
}) })
}).catch(e => {
}) })
}, },