技师页面 定位修复

This commit is contained in:
山兮 2024-04-12 13:33:06 +08:00
parent b3f49cb408
commit 96bde81921
4 changed files with 50 additions and 8 deletions

View File

@ -62,4 +62,8 @@ export default {
getUpOrderGoods(param) { getUpOrderGoods(param) {
return req.get("massage/app/IndexOrder/getUpOrderGoods", param) return req.get("massage/app/IndexOrder/getUpOrderGoods", param)
}, },
// 获取定位
getAddress(param) {
return req.get("index/getLocaltion", param)
},
} }

View File

@ -181,5 +181,5 @@ export default {
// 修改技师白天夜间免费出行距离 // 修改技师白天夜间免费出行距离
updateCoachRidingForfree(param) { updateCoachRidingForfree(param) {
return req.post("massage/app/IndexCoach/updateCoachRidingForfree", param) return req.post("massage/app/IndexCoach/updateCoachRidingForfree", param)
}, }
} }

View File

@ -6,8 +6,9 @@
<view @tap.stop="toChooseLocation" class="map-info flex-y-center" slot="left"> <view @tap.stop="toChooseLocation" class="map-info flex-y-center" slot="left">
<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 max-400 ellipsis"> <view class="map-text ellipsis">
{{location&&location.name ?location.name : isLoad ? '定位失败' : '定位中...'}} <!-- {{location&&location.name ?location.name : isLoad ? '定位失败' : '定位中...'}} -->
{{location&&location.address ?location.address : isLoad ? '定位失败' : '定位中...'}}
</view> </view>
<i class="iconfont icon-down"></i> <i class="iconfont icon-down"></i>
</view> </view>
@ -108,6 +109,7 @@
import tabbar from "@/components/tabbar.vue" import tabbar from "@/components/tabbar.vue"
import technicianListItem from "@/components/technician-list-item.vue" import technicianListItem from "@/components/technician-list-item.vue"
import technicianListPopup from "@/components/technician-list-popup.vue" import technicianListPopup from "@/components/technician-list-popup.vue"
import getaddress from "../api/modules/service.js"
export default { export default {
components: { components: {
tabbar, tabbar,
@ -142,6 +144,7 @@
haveShieldOper: state => state.user.haveShieldOper, haveShieldOper: state => state.user.haveShieldOper,
}), }),
async onLoad(options) { async onLoad(options) {
this.init();
this.options = options this.options = options
let { let {
pid = 0, pid = 0,
@ -226,10 +229,44 @@
title: '', title: '',
imageUrl: '', imageUrl: '',
path, path,
lng:'',
lat:''
} }
}, },
methods: { methods: {
...mapActions(['getConfigInfo', 'getUserInfo', 'getCityList', 'getServiceCoachList']), //
init(){
uni.getLocation({
type: 'wgs84',
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({
url: `https://tianjin.tianjinhualong.cn/index.php?s=index/getLocaltion&latitude=`+res.latitude+`&longitude=`+res.longitude,
data: {
text: 'uni.request'
},
header: {
'custom-header': 'hello' //
},
success: (res) => {
console.log(res.data.result.address);
const index = res.data.result.address.indexOf("区")
console.log(222,index);
this.location.address = res.data.result.address.slice(index+1)
console.log("测试一下",res.data.result.address.slice(index+1));
}
});
}
});
},
...mapActions(['getConfigInfo', 'getUserInfo', 'getCityList', 'getServiceCoachList','getAddressList']),
...mapMutations(['updateUserItem', 'updateTechnicianItem']), ...mapMutations(['updateUserItem', 'updateTechnicianItem']),
async initIndex(refresh = false) { async initIndex(refresh = false) {
// #ifdef H5 // #ifdef H5
@ -493,7 +530,7 @@
activeIndex, activeIndex,
cityList, cityList,
cityIndex, cityIndex,
cityId: city_id cityId: city_id,
} = this } = this
let param = this.$util.deepCopy(this.param) let param = this.$util.deepCopy(this.param)
@ -530,12 +567,13 @@
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

View File

@ -48,7 +48,7 @@
</view> </view>
</view> </view>
</view> </view>
<view @tap.stop="$util.goUrl({url:`/user/pages/distribution/bind-technician?type=1`})" <!-- <view @tap.stop="$util.goUrl({url:`/user/pages/distribution/bind-technician?type=1`})"
class="mine-menu-list fill-base mt-md radius-16" style=" class="mine-menu-list fill-base mt-md radius-16" style="
background: linear-gradient(90deg, #FFE9E9 0%, #FFFFFF 100%);"> background: linear-gradient(90deg, #FFE9E9 0%, #FFFFFF 100%);">
<view class="flex-center pd-lg"> <view class="flex-center pd-lg">
@ -65,7 +65,7 @@ background: linear-gradient(90deg, #FFE9E9 0%, #FFFFFF 100%);">
<view class="share-btn flex-center f-desc c-base radius">前往邀请</view> <view class="share-btn flex-center f-desc c-base radius">前往邀请</view>
</view> </view>
</view> </view>
</view> </view> -->
<view @tap.stop="$util.goUrl({url:`/user/pages/distribution/poster`})" <view @tap.stop="$util.goUrl({url:`/user/pages/distribution/poster`})"
class="mine-menu-list fill-base mt-md radius-16" style=" class="mine-menu-list fill-base mt-md radius-16" style="
background: linear-gradient(90deg, #FFE9E9 0%, #FFFFFF 100%);"> background: linear-gradient(90deg, #FFE9E9 0%, #FFFFFF 100%);">