定位修改
This commit is contained in:
parent
96bde81921
commit
14e6a0d19d
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"name" : "登澜到家",
|
"name" : "登澜到家",
|
||||||
"appid" : "__UNI__B500DDB", // 改为自己的
|
"appid" : "__UNI__B500DDB", // 改为自己的
|
||||||
"description" : "上门预约",
|
"description" : "上门按摩服务",
|
||||||
"versionName" : "1.0.7",
|
"versionName" : "1.0.8",
|
||||||
"versionCode" : 107,
|
"versionCode" : 108,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
"uniStatistics" : {
|
"uniStatistics" : {
|
||||||
"enable" : false //全局关闭
|
"enable" : false //全局关闭
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
<view class="flex-y-center c-base">
|
<view class="flex-y-center c-base">
|
||||||
<i class="iconfont iconjuli mr-sm"></i>
|
<i class="iconfont iconjuli mr-sm"></i>
|
||||||
<view class="map-text ellipsis">
|
<view class="map-text ellipsis">
|
||||||
<!-- {{location&&location.name ?location.name : isLoad ? '定位失败' : '定位中...'}} -->
|
{{location&&location.name ?location.name : isLoad ? '定位失败' : '定位中...'}}
|
||||||
{{location&&location.address ?location.address : isLoad ? '定位失败' : '定位中...'}}
|
<!-- {{location&&location.address ?location.address : isLoad ? '定位失败' : '定位中...'}} -->
|
||||||
</view>
|
</view>
|
||||||
<i class="iconfont icon-down"></i>
|
<i class="iconfont icon-down"></i>
|
||||||
</view>
|
</view>
|
||||||
|
@ -229,44 +229,45 @@
|
||||||
title: '',
|
title: '',
|
||||||
imageUrl: '',
|
imageUrl: '',
|
||||||
path,
|
path,
|
||||||
lng:'',
|
|
||||||
lat:''
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 获取当前定位
|
// 获取当前定位
|
||||||
init(){
|
init() {
|
||||||
|
const _this = this;
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'wgs84',
|
type: 'wgs84',
|
||||||
success: function (res) {
|
success: function(res) {
|
||||||
this.lng = res.longitude;
|
|
||||||
this.lat = res.latitude;
|
|
||||||
console.log(111,res);
|
|
||||||
const data = {
|
|
||||||
lng:res.longitude,
|
|
||||||
lat:res.latitude,
|
|
||||||
key:"ac07017e-6409-4aa4-88eb-6e252556d392"
|
|
||||||
}
|
|
||||||
uni.request({
|
uni.request({
|
||||||
url: `https://tianjin.tianjinhualong.cn/index.php?s=index/getLocaltion&latitude=`+res.latitude+`&longitude=`+res.longitude,
|
url: `https://tianjin.tianjinhualong.cn/index.php?s=index/getLocaltion&latitude=` +
|
||||||
data: {
|
res.latitude + `&longitude=` + res.longitude,
|
||||||
text: 'uni.request'
|
data: {
|
||||||
},
|
text: 'uni.request'
|
||||||
header: {
|
},
|
||||||
'custom-header': 'hello' //自定义请求头信息
|
header: {
|
||||||
},
|
'custom-header': 'hello' //自定义请求头信息
|
||||||
success: (res) => {
|
},
|
||||||
console.log(res.data.result.address);
|
success: (res) => {
|
||||||
const index = res.data.result.address.indexOf("区")
|
const index = res.data.result.address.indexOf("区")
|
||||||
console.log(222,index);
|
let location = {
|
||||||
this.location.address = res.data.result.address.slice(index+1)
|
lng: res.data.result.ad_info.location.lng,
|
||||||
console.log("测试一下",res.data.result.address.slice(index+1));
|
lat: res.data.result.ad_info.location.lat,
|
||||||
}
|
address: res.data.result.address,
|
||||||
|
city: '',
|
||||||
|
district: '',
|
||||||
|
name: res.data.result.address.slice(index + 1),
|
||||||
|
province: ''
|
||||||
|
}
|
||||||
|
_this.updateUserItem({
|
||||||
|
key: 'location',
|
||||||
|
val: location
|
||||||
|
})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
...mapActions(['getConfigInfo', 'getUserInfo', 'getCityList', 'getServiceCoachList','getAddressList']),
|
...mapActions(['getConfigInfo', 'getUserInfo', 'getCityList', 'getServiceCoachList', 'getAddressList']),
|
||||||
...mapMutations(['updateUserItem', 'updateTechnicianItem']),
|
...mapMutations(['updateUserItem', 'updateTechnicianItem']),
|
||||||
async initIndex(refresh = false) {
|
async initIndex(refresh = false) {
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
|
@ -567,13 +568,11 @@
|
||||||
key: 'cityId',
|
key: 'cityId',
|
||||||
val: city_id
|
val: city_id
|
||||||
})
|
})
|
||||||
console.log(333,param);
|
|
||||||
param = Object.assign({}, param, {
|
param = Object.assign({}, param, {
|
||||||
lng,
|
lng,
|
||||||
lat,
|
lat,
|
||||||
city_id
|
city_id
|
||||||
})
|
})
|
||||||
console.log(222,param);
|
|
||||||
|
|
||||||
let {
|
let {
|
||||||
coach_format = 1
|
coach_format = 1
|
||||||
|
|
Loading…
Reference in New Issue