|
@@ -260,149 +260,43 @@
|
|
|
console.log('当前位置的纬度:' + res.latitude);
|
|
|
uni.chooseLocation({
|
|
|
success: function(res) {
|
|
|
+ // var locationObj = that.$helper.formatLocation(res);
|
|
|
+ // console.log(locationObj)
|
|
|
console.log(res);
|
|
|
console.log('位置名称:' + res.name);
|
|
|
console.log('详细地址:' + res.address);
|
|
|
console.log('纬度:' + res.latitude);
|
|
|
console.log('经度:' + res.longitude);
|
|
|
- var locationObj = that.$helper.formatLocation(res);
|
|
|
- console.log(locationObj)
|
|
|
- that.temporaryAddress.latitude = res.latitude
|
|
|
- that.temporaryAddress.longitude = res.longitude
|
|
|
- that.temporaryAddress.detailedAddress = locationObj.ADDRESS
|
|
|
- that.temporaryAddress.province = locationObj.REGION_PROVINCE
|
|
|
- that.temporaryAddress.city = locationObj.REGION_CITY
|
|
|
- that.temporaryAddress.area = locationObj.REGION_COUNTRY
|
|
|
- that.temporaryAddress.commonId = that.userInfo.id
|
|
|
- that.configAddress(that.temporaryAddress)
|
|
|
+ let _address = that.$helper.formatLocation(res.address)
|
|
|
+ console.log('----------------------------')
|
|
|
+ console.log(_address,that.type)
|
|
|
+ var data={}
|
|
|
+ data.latitude = res.latitude
|
|
|
+ data.longitude = res.longitude
|
|
|
+ data.detailedAddress = _address.Village
|
|
|
+ data.province = _address.Province
|
|
|
+ data.city = _address.City
|
|
|
+ data.area = _address.Country
|
|
|
+ data.commonId = that.userInfo.id
|
|
|
+ data.type=that.type
|
|
|
+ uni.setStorageSync('addressInfo',data)
|
|
|
+ uni.$u.route('/pages/release/release');
|
|
|
+ // that.temporaryAddress.latitude = res.latitude
|
|
|
+ // that.temporaryAddress.longitude = res.longitude
|
|
|
+ // that.temporaryAddress.detailedAddress = locationObj.ADDRESS
|
|
|
+ // that.temporaryAddress.province = locationObj.REGION_PROVINCE
|
|
|
+ // that.temporaryAddress.city = locationObj.REGION_CITY
|
|
|
+ // that.temporaryAddress.area = locationObj.REGION_COUNTRY
|
|
|
+ // that.temporaryAddress.commonId = that.userInfo.id
|
|
|
+ // that.configAddress(that.temporaryAddress)
|
|
|
+ // that.$forceUpdate()
|
|
|
},
|
|
|
- fail: function() {
|
|
|
- console.log(2222222)
|
|
|
- // uni.getSetting({
|
|
|
- // success: function(res) {
|
|
|
- // var statu = res.authSetting;
|
|
|
- // if (!statu['scope.userLocation']) {
|
|
|
- // uni.showModal({
|
|
|
- // title: '是否授权当前位置',
|
|
|
- // content: '需要获取您的地理位置,请确认授权,否则地图功能将无法使用',
|
|
|
- // success: function(tip) {
|
|
|
- // if (tip.confirm) {
|
|
|
- // uni.openSetting({
|
|
|
- // success: function(
|
|
|
- // data
|
|
|
- // ) {
|
|
|
- // if (data
|
|
|
- // .authSetting[
|
|
|
- // "scope.userLocation"
|
|
|
- // ] ===
|
|
|
- // true
|
|
|
- // ) {
|
|
|
- // uni.showToast({
|
|
|
- // title: '授权成功',
|
|
|
- // icon: 'success',
|
|
|
- // duration: 1000
|
|
|
- // })
|
|
|
- // //授权成功之后,再调用chooseLocation选择地方
|
|
|
- // uni.chooseLocation({
|
|
|
- // success: function(
|
|
|
- // res
|
|
|
- // ) {
|
|
|
- // console
|
|
|
- // .log(
|
|
|
- // res
|
|
|
- // );
|
|
|
- // console
|
|
|
- // .log(
|
|
|
- // '位置名称:' +
|
|
|
- // res
|
|
|
- // .name
|
|
|
- // );
|
|
|
- // console
|
|
|
- // .log(
|
|
|
- // '详细地址:' +
|
|
|
- // res
|
|
|
- // .address
|
|
|
- // );
|
|
|
- // console
|
|
|
- // .log(
|
|
|
- // '纬度:' +
|
|
|
- // res
|
|
|
- // .latitude
|
|
|
- // );
|
|
|
- // console
|
|
|
- // .log(
|
|
|
- // '经度:' +
|
|
|
- // res
|
|
|
- // .longitude
|
|
|
- // );
|
|
|
- // var locationObj =
|
|
|
- // that
|
|
|
- // .$helper
|
|
|
- // .formatLocation(
|
|
|
- // res
|
|
|
- // );
|
|
|
- // console
|
|
|
- // .log(
|
|
|
- // locationObj
|
|
|
- // )
|
|
|
- // that.temporaryAddress
|
|
|
- // .latitude =
|
|
|
- // res
|
|
|
- // .latitude
|
|
|
- // that.temporaryAddress
|
|
|
- // .longitude =
|
|
|
- // res
|
|
|
- // .longitude
|
|
|
- // that.temporaryAddress
|
|
|
- // .detailedAddress =
|
|
|
- // locationObj
|
|
|
- // .ADDRESS
|
|
|
- // that.temporaryAddress
|
|
|
- // .province =
|
|
|
- // locationObj
|
|
|
- // .REGION_PROVINCE
|
|
|
- // that.temporaryAddress
|
|
|
- // .city =
|
|
|
- // locationObj
|
|
|
- // .REGION_CITY
|
|
|
- // that.temporaryAddress
|
|
|
- // .area =
|
|
|
- // locationObj
|
|
|
- // .REGION_COUNTRY
|
|
|
- // that.temporaryAddress
|
|
|
- // .commonId =
|
|
|
- // that
|
|
|
- // .userInfo
|
|
|
- // .id
|
|
|
- // that.configAddress(
|
|
|
- // that
|
|
|
- // .temporaryAddress
|
|
|
- // )
|
|
|
- // },
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // uni.showToast({
|
|
|
- // title: '授权失败',
|
|
|
- // icon: 'none',
|
|
|
- // duration: 1000
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
- // },
|
|
|
- // fail: function(res) {
|
|
|
- // uni.showToast({
|
|
|
- // title: '调用授权窗口失败',
|
|
|
- // icon: 'none',
|
|
|
- // duration: 1000
|
|
|
- // })
|
|
|
- // }
|
|
|
- // })
|
|
|
|
|
|
+ fail(err) {
|
|
|
+ console.log(err)
|
|
|
+ },
|
|
|
+ complete(res1) {
|
|
|
+ console.log(res1)
|
|
|
}
|
|
|
});
|
|
|
}
|