暂时提交三轮车游走,定位问题

This commit is contained in:
weipengfei 2023-09-20 20:09:43 +08:00
parent 53e6582892
commit 66d6ba723e
4 changed files with 429 additions and 342 deletions

View File

@ -23,6 +23,10 @@
// })
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('APP_token', info.referrerInfo?.extraData?.token);
try {

View File

@ -25,7 +25,8 @@
"Barcode" : {},
"Camera" : {},
"Maps" : {},
"VideoPlayer" : {}
"VideoPlayer" : {},
"Geolocation" : {}
},
/* */
"distribute" : {
@ -70,8 +71,17 @@
"maps" : {
"amap" : {
// "appkey_ios" : "0799f37420c0784f1e6cba230a68bdb1",
// "appkey_android" : "0799f37420c0784f1e6cba230a68bdb1"
"appkey_ios" : "048d9f3f323eea894b49c3a7edbc8d87",
// "appkey_android" : "0799f37420c0784f1e6cba230a68bdb1",
"appkey_ios" : "82af93ec51139c712c4118d84ba684ee",
"appkey_android" : "048d9f3f323eea894b49c3a7edbc8d87"
// "appkey_ios" : "4f8f55618010007147aab96fc72bb408",
// "appkey_android" : "4f8f55618010007147aab96fc72bb408"
}
},
"geolocation" : {
"amap" : {
"__platform__" : [ "ios", "android" ],
"appkey_ios" : "82af93ec51139c712c4118d84ba684ee",
"appkey_android" : "048d9f3f323eea894b49c3a7edbc8d87"
}
}

View File

@ -580,6 +580,12 @@ export default {
},
},
async onPullDownRefresh () {
uni.sendHostEvent('test', '测试', (ret) => {
// uni.showModal({
// title:'',
// content:JSON.stringify(ret)
// })
});
await this.getOrderList();
await this.$store.dispatch('initConfig');
await this.getApproveList();

View File

@ -8,8 +8,8 @@
<u-toast ref="uToast"></u-toast>
<view class="map" style="position: relative;">
<map :class="mapClass" id="map" @markertap='mapFun' :enable-zoom="true" :polyline="polyline"
:markers='markers' :scale="scale" style="width:100%;height: 100%;"
:latitude="markers[0].latitude" :enable-scroll="true" :longitude="markers[0].longitude">
:markers='markers' :scale="scale" style="width:100%;height: 100%;" :latitude="markers[0].latitude"
:enable-scroll="true" :longitude="markers[0].longitude">
</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> -->
</view>
@ -22,7 +22,9 @@
</view>
<view v-if="address.transfer">{{address.transfer.address}}</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>车辆状态</text>
<text v-if="address.transfer.status==2">已完成</text>
@ -42,7 +44,9 @@
</view>
<view v-if="address.terminus">{{address.terminus.address}}</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="{red: status==5}">车辆状态</text>
<text v-if="address.terminus.status==2">已完成</text>
@ -161,6 +165,9 @@
//
locationFn() {
let that = this;
// uni.showLoading({
// title: ''
// })
uni.getLocation({
type: 'gcj02',
geocode: true,
@ -169,17 +176,69 @@
that.markers[1].latitude = res.latitude;
that.markers[1].longitude = res.longitude;
that.getDriverLine();
that.$u.sleep(500).then(()=>{
uni.hideLoading();
// uni.hideLoading();
uni.showModal({
title: '成功',
content: JSON.stringify(res)
})
},
fail() {
that.$u.sleep(1000).then(()=>{
uni.hideLoading();
fail(e) {
// uni.hideLoading();
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() {
this.$refs.uToast.show({
@ -295,8 +354,7 @@
dottedLine: true,
width: 10,
}, ];
}
else {
} else {
that.polyline = [{
points: points,
color: "#0091ff",
@ -345,6 +403,7 @@
display: flex;
flex-direction: column;
justify-content: space-between;
.model_title {
height: 92rpx;
line-height: 92rpx;
@ -352,34 +411,42 @@
font-size: 16px;
font-weight: bold;
}
.model_content {
margin: 12px 25px 25px 25px;
font-size: 15px;
}
.model_btn {
display: flex;
height: 96rpx;
font-size: 16px;
.item {
flex: 1;
text-align: center;
line-height: 96rpx;
}
.model_confirm {
color: #0122c7;
}
}
}
}
.red {
color: #ff0000;
}
.green {
color: #40bc5e;
}
.yellow {
color: #ff7c32;
}
.custom-map /deep/ .polyline {
stroke-width: 20px;
}