//获取位置
chooseLocation(event) {
var that = this
var key = event.currentTarget.dataset.key
var formDatas = that.data.formDatas
var obj = {
success: function (res) {
//console.log(res)
var url = app.globalData.swtBase + 'config.php?act=mapInfo&latitude=' + res.latitude + '&longitude=' + res.longitude + ''
util.http(that, url, function (that, data) {
var mapInfo = data.mapInfo
if (mapInfo.status == 0) {
formDatas.latitude = res.latitude
formDatas.longitude = res.longitude
formDatas[key] = res.name
//解析获得
formDatas.d_big_txt = mapInfo.province
formDatas.d_small_txt = mapInfo.city
formDatas.d_xiao_txt = mapInfo.district
that.setData({
formDatas
})
}
})
}
}
if (formDatas.latitude) {
obj.latitude = formDatas.latitude
}
if (formDatas.latitude) {
obj.longitude = formDatas.longitude
}
wx.chooseLocation(obj)
},
有什么抱错吗