修复定位问题
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState, mapActions} from 'vuex'
|
||||
import {mapActions, mapState} from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'Add',
|
||||
@@ -63,7 +63,7 @@ export default {
|
||||
this.forms.girdName = this.user.girdName
|
||||
this.forms.girdId = this.user.girdId
|
||||
this.forms.girdMemberId = this.user.girdMemberId
|
||||
this.$dict.load(['wyGirdNewsType'])
|
||||
this.$dict.load('wyGirdNewsType')
|
||||
// this.forms.lng = '114.305000'
|
||||
// this.forms.lat = '30.592800'
|
||||
this.getLocation()
|
||||
@@ -95,26 +95,25 @@ export default {
|
||||
this.forms.typeName = e[0].label
|
||||
},
|
||||
getLocation() {
|
||||
this.injectJWeixin('getLocation').then(() => {
|
||||
this.injectJWeixin("getLocation").then(() => {
|
||||
const {wx} = window
|
||||
wx.getLocation({
|
||||
type: 'wgs84',
|
||||
success: res2 => {
|
||||
console.log('获取当前定位信息:', res2)
|
||||
this.forms.lng = res2.longitude
|
||||
this.forms.lat = res2.latitude
|
||||
this.$http.post('/api/appdvcpconfig/apiForward', null, {
|
||||
this.$http.post('/app/appdvcpconfig/apiForward', null, {
|
||||
params: {
|
||||
url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${this.forms.lat},${this.forms.lng}&key=3RZBZ-LZUCF-CT6J5-NWKZH-FCWOQ-UUFKY&get_poi=1`
|
||||
}
|
||||
}).then(res => {
|
||||
console.log("获取详细地址信息:", res)
|
||||
if (res?.code == 0) {
|
||||
this.forms.address = res.data.result.address
|
||||
}
|
||||
})
|
||||
},
|
||||
error: err => {
|
||||
console.log(err)
|
||||
console.log("获取位置失败:", err)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user