暂时提交三轮车游走,定位问题
This commit is contained in:
parent
53e6582892
commit
66d6ba723e
10
App.vue
10
App.vue
@ -23,9 +23,13 @@
|
|||||||
// })
|
// })
|
||||||
|
|
||||||
if (info.referrerInfo?.extraData?.uniMP) {
|
if (info.referrerInfo?.extraData?.uniMP) {
|
||||||
|
//监听宿主App通讯数据
|
||||||
|
uni.onHostEventReceive((event, data) => {
|
||||||
|
if(event=='getLocation') uni.$emit('uniMP_getLocation', data);
|
||||||
|
});
|
||||||
uni.setStorageSync('uniMP', info.referrerInfo?.extraData?.uniMP);
|
uni.setStorageSync('uniMP', info.referrerInfo?.extraData?.uniMP);
|
||||||
uni.setStorageSync('APP_token', info.referrerInfo?.extraData?.token);
|
uni.setStorageSync('APP_token', info.referrerInfo?.extraData?.token);
|
||||||
try{
|
try {
|
||||||
let res = await loginShopAccount({
|
let res = await loginShopAccount({
|
||||||
shop_token: info.referrerInfo?.extraData?.token
|
shop_token: info.referrerInfo?.extraData?.token
|
||||||
});
|
});
|
||||||
@ -40,8 +44,8 @@
|
|||||||
this.$store.commit('setUserInfo', data);
|
this.$store.commit('setUserInfo', data);
|
||||||
this.$isResolve()
|
this.$isResolve()
|
||||||
// uni.$emit('home_initUserInfo', data);
|
// uni.$emit('home_initUserInfo', data);
|
||||||
return ;
|
return;
|
||||||
}catch(e){
|
} catch (e) {
|
||||||
this.$isResolve()
|
this.$isResolve()
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,8 @@
|
|||||||
"Barcode" : {},
|
"Barcode" : {},
|
||||||
"Camera" : {},
|
"Camera" : {},
|
||||||
"Maps" : {},
|
"Maps" : {},
|
||||||
"VideoPlayer" : {}
|
"VideoPlayer" : {},
|
||||||
|
"Geolocation" : {}
|
||||||
},
|
},
|
||||||
/* 应用发布信息 */
|
/* 应用发布信息 */
|
||||||
"distribute" : {
|
"distribute" : {
|
||||||
@ -70,8 +71,17 @@
|
|||||||
"maps" : {
|
"maps" : {
|
||||||
"amap" : {
|
"amap" : {
|
||||||
// "appkey_ios" : "0799f37420c0784f1e6cba230a68bdb1",
|
// "appkey_ios" : "0799f37420c0784f1e6cba230a68bdb1",
|
||||||
// "appkey_android" : "0799f37420c0784f1e6cba230a68bdb1"
|
// "appkey_android" : "0799f37420c0784f1e6cba230a68bdb1",
|
||||||
"appkey_ios" : "048d9f3f323eea894b49c3a7edbc8d87",
|
"appkey_ios" : "82af93ec51139c712c4118d84ba684ee",
|
||||||
|
"appkey_android" : "048d9f3f323eea894b49c3a7edbc8d87"
|
||||||
|
// "appkey_ios" : "4f8f55618010007147aab96fc72bb408",
|
||||||
|
// "appkey_android" : "4f8f55618010007147aab96fc72bb408"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"geolocation" : {
|
||||||
|
"amap" : {
|
||||||
|
"__platform__" : [ "ios", "android" ],
|
||||||
|
"appkey_ios" : "82af93ec51139c712c4118d84ba684ee",
|
||||||
"appkey_android" : "048d9f3f323eea894b49c3a7edbc8d87"
|
"appkey_android" : "048d9f3f323eea894b49c3a7edbc8d87"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -580,6 +580,12 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
async onPullDownRefresh () {
|
async onPullDownRefresh () {
|
||||||
|
uni.sendHostEvent('test', '测试', (ret) => {
|
||||||
|
// uni.showModal({
|
||||||
|
// title:'内容',
|
||||||
|
// content:JSON.stringify(ret)
|
||||||
|
// })
|
||||||
|
});
|
||||||
await this.getOrderList();
|
await this.getOrderList();
|
||||||
await this.$store.dispatch('initConfig');
|
await this.$store.dispatch('initConfig');
|
||||||
await this.getApproveList();
|
await this.getApproveList();
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
<u-toast ref="uToast"></u-toast>
|
<u-toast ref="uToast"></u-toast>
|
||||||
<view class="map" style="position: relative;">
|
<view class="map" style="position: relative;">
|
||||||
<map :class="mapClass" id="map" @markertap='mapFun' :enable-zoom="true" :polyline="polyline"
|
<map :class="mapClass" id="map" @markertap='mapFun' :enable-zoom="true" :polyline="polyline"
|
||||||
:markers='markers' :scale="scale" style="width:100%;height: 100%;"
|
:markers='markers' :scale="scale" style="width:100%;height: 100%;" :latitude="markers[0].latitude"
|
||||||
:latitude="markers[0].latitude" :enable-scroll="true" :longitude="markers[0].longitude">
|
:enable-scroll="true" :longitude="markers[0].longitude">
|
||||||
</map>
|
</map>
|
||||||
<!-- <cover-view v-show="modelShow" style="background-color: rgba(#000, 0.9);height: 100px;width: 100px;position: absolute;top: 0;left: 0;"></cover-view> -->
|
<!-- <cover-view v-show="modelShow" style="background-color: rgba(#000, 0.9);height: 100px;width: 100px;position: absolute;top: 0;left: 0;"></cover-view> -->
|
||||||
</view>
|
</view>
|
||||||
@ -22,7 +22,9 @@
|
|||||||
</view>
|
</view>
|
||||||
<view v-if="address.transfer">{{address.transfer.address}}</view>
|
<view v-if="address.transfer">{{address.transfer.address}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="status!=5||address.transfer.status==2" :class="{lg_status1:address.transfer.status==2,lg_status2:address.transfer.status==1}" style="margin-top: 10rpx;">
|
<view v-if="status!=5||address.transfer.status==2"
|
||||||
|
:class="{lg_status1:address.transfer.status==2,lg_status2:address.transfer.status==1}"
|
||||||
|
style="margin-top: 10rpx;">
|
||||||
<text class="cir" style="background-color: transparent;"></text>
|
<text class="cir" style="background-color: transparent;"></text>
|
||||||
<text>车辆状态:</text>
|
<text>车辆状态:</text>
|
||||||
<text v-if="address.transfer.status==2">已完成</text>
|
<text v-if="address.transfer.status==2">已完成</text>
|
||||||
@ -42,7 +44,9 @@
|
|||||||
</view>
|
</view>
|
||||||
<view v-if="address.terminus">{{address.terminus.address}}</view>
|
<view v-if="address.terminus">{{address.terminus.address}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view :class="{red: address.terminus.status!=2&&address.transfer.status==1,yellow:address.transfer.status!=1&&address.terminus.status!=2, green: address.terminus.status==2}" style="margin-top: 10rpx;">
|
<view
|
||||||
|
:class="{red: address.terminus.status!=2&&address.transfer.status==1,yellow:address.transfer.status!=1&&address.terminus.status!=2, green: address.terminus.status==2}"
|
||||||
|
style="margin-top: 10rpx;">
|
||||||
<text class="cir" style="background-color: transparent;"></text>
|
<text class="cir" style="background-color: transparent;"></text>
|
||||||
<text :class="{red: status==5}">车辆状态:</text>
|
<text :class="{red: status==5}">车辆状态:</text>
|
||||||
<text v-if="address.terminus.status==2">已完成</text>
|
<text v-if="address.terminus.status==2">已完成</text>
|
||||||
@ -150,17 +154,20 @@
|
|||||||
this.markers[0].longitude = +res.data.extend.transfer.lnglat[0];
|
this.markers[0].longitude = +res.data.extend.transfer.lnglat[0];
|
||||||
this.address.transfer['status'] = 1;
|
this.address.transfer['status'] = 1;
|
||||||
}
|
}
|
||||||
if (res.data.extend?.update?.terminus?.lnglat[0]||res.data.status==3) {
|
if (res.data.extend?.update?.terminus?.lnglat[0] || res.data.status == 3) {
|
||||||
this.address.terminus['status'] = 2;
|
this.address.terminus['status'] = 2;
|
||||||
this.status = 3;
|
this.status = 3;
|
||||||
} else this.address.terminus['status'] = 1;
|
} else this.address.terminus['status'] = 1;
|
||||||
if(res.data.status==5){
|
if (res.data.status == 5) {
|
||||||
this.status = 5;
|
this.status = 5;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 位置
|
// 位置
|
||||||
locationFn() {
|
locationFn() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
// uni.showLoading({
|
||||||
|
// title: '获取位置中'
|
||||||
|
// })
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'gcj02',
|
type: 'gcj02',
|
||||||
geocode: true,
|
geocode: true,
|
||||||
@ -169,17 +176,69 @@
|
|||||||
that.markers[1].latitude = res.latitude;
|
that.markers[1].latitude = res.latitude;
|
||||||
that.markers[1].longitude = res.longitude;
|
that.markers[1].longitude = res.longitude;
|
||||||
that.getDriverLine();
|
that.getDriverLine();
|
||||||
that.$u.sleep(500).then(()=>{
|
// uni.hideLoading();
|
||||||
uni.hideLoading();
|
uni.showModal({
|
||||||
|
title: '成功',
|
||||||
|
content: JSON.stringify(res)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
fail() {
|
fail(e) {
|
||||||
that.$u.sleep(1000).then(()=>{
|
// uni.hideLoading();
|
||||||
uni.hideLoading();
|
|
||||||
Toast('获取位置失败');
|
Toast('获取位置失败');
|
||||||
|
console.log(e);
|
||||||
|
// uni.showModal({
|
||||||
|
// title: '失败',
|
||||||
|
// content: JSON.stringify(e)
|
||||||
|
// })
|
||||||
|
try {
|
||||||
|
plus.geolocation.getCurrentPosition(function(position) {
|
||||||
|
console.log('经度:' + position.coords.longitude);
|
||||||
|
console.log('纬度:' + position.coords.latitude);
|
||||||
|
that.markers[1].latitude = position.coords.longitude;
|
||||||
|
that.markers[1].longitude = position.coords.longitude;
|
||||||
|
that.getDriverLine();
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.showModal({
|
||||||
|
title: 'plus成功',
|
||||||
|
content: JSON.parse(position)
|
||||||
|
})
|
||||||
|
}, function(error) {
|
||||||
|
console.error('获取位置失败:', error.message);
|
||||||
|
uni.showModal({
|
||||||
|
title: 'plus失败',
|
||||||
|
content: JSON.parse(error)
|
||||||
|
})
|
||||||
|
uni.sendHostEvent('getLocation', '获取位置', (ret) => {
|
||||||
|
uni.$on('uniMP_getLocation', (res) => {
|
||||||
|
try {
|
||||||
|
that.markers[1].latitude = res.latitude;
|
||||||
|
that.markers[1].longitude = res.longitude;
|
||||||
|
that.getDriverLine();
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.showModal({
|
||||||
|
title: 'uniMP成功',
|
||||||
|
content: JSON.parse(res)
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
Toast('获取位置失败');
|
||||||
|
uni.showModal({
|
||||||
|
title: 'uniMP失败',
|
||||||
|
content: JSON.parse(e)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '没有plus',
|
||||||
|
content: JSON.parse(e)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
showToast() {
|
showToast() {
|
||||||
this.$refs.uToast.show({
|
this.$refs.uToast.show({
|
||||||
@ -287,7 +346,7 @@
|
|||||||
that.runningRoute = data.paths[0].steps[0].instruction;
|
that.runningRoute = data.paths[0].steps[0].instruction;
|
||||||
}
|
}
|
||||||
uni.getSystemInfo({
|
uni.getSystemInfo({
|
||||||
success: function(e){
|
success: function(e) {
|
||||||
if (e.platform == 'ios') {
|
if (e.platform == 'ios') {
|
||||||
that.polyline = [{
|
that.polyline = [{
|
||||||
points: points,
|
points: points,
|
||||||
@ -295,8 +354,7 @@
|
|||||||
dottedLine: true,
|
dottedLine: true,
|
||||||
width: 10,
|
width: 10,
|
||||||
}, ];
|
}, ];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
that.polyline = [{
|
that.polyline = [{
|
||||||
points: points,
|
points: points,
|
||||||
color: "#0091ff",
|
color: "#0091ff",
|
||||||
@ -325,7 +383,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
.cover{
|
.cover {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
@ -333,7 +391,7 @@
|
|||||||
height: 100vh;
|
height: 100vh;
|
||||||
background-color: rgba(#000, 0.3);
|
background-color: rgba(#000, 0.3);
|
||||||
|
|
||||||
.cover_model{
|
.cover_model {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
@ -345,41 +403,50 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
.model_title{
|
|
||||||
|
.model_title {
|
||||||
height: 92rpx;
|
height: 92rpx;
|
||||||
line-height: 92rpx;
|
line-height: 92rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.model_content{
|
|
||||||
|
.model_content {
|
||||||
margin: 12px 25px 25px 25px;
|
margin: 12px 25px 25px 25px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
.model_btn{
|
|
||||||
|
.model_btn {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 96rpx;
|
height: 96rpx;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
.item{
|
|
||||||
|
.item {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 96rpx;
|
line-height: 96rpx;
|
||||||
}
|
}
|
||||||
.model_confirm{
|
|
||||||
|
.model_confirm {
|
||||||
color: #0122c7;
|
color: #0122c7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.red{
|
|
||||||
|
.red {
|
||||||
color: #ff0000;
|
color: #ff0000;
|
||||||
}
|
}
|
||||||
.green{
|
|
||||||
|
.green {
|
||||||
color: #40bc5e;
|
color: #40bc5e;
|
||||||
}
|
}
|
||||||
.yellow{
|
|
||||||
|
.yellow {
|
||||||
color: #ff7c32;
|
color: #ff7c32;
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-map /deep/ .polyline {
|
.custom-map /deep/ .polyline {
|
||||||
stroke-width: 20px;
|
stroke-width: 20px;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user