骑行端桌面
This commit is contained in:
parent
a9d9a42a1a
commit
c7f263fb13
@ -5,18 +5,17 @@
|
|||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #d8d3d3db;
|
color: #d8d3d3db;
|
||||||
display: flex;
|
|
||||||
justify-content: space-evenly;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.divHead label {
|
.divHead label {
|
||||||
margin-right: 20px;
|
margin-right: 30px;
|
||||||
|
padding-bottom: 3px;
|
||||||
|
border-bottom: 2px solid #bdb9b9a1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.divHeadSel {
|
.divHeadSel {
|
||||||
margin-right: 20px;
|
|
||||||
padding-bottom: 3px;
|
border-bottom: 2px solid white !important;
|
||||||
border-bottom: 2px solid white;
|
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: white !important;
|
color: white !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,8 @@
|
|||||||
@click="lockRiding" />
|
@click="lockRiding" />
|
||||||
<image v-if="orderState==1" style="width: 120px;height: 40px;" :src=' imgPath+"static/userui/home/run.png"'
|
<image v-if="orderState==1" style="width: 120px;height: 40px;" :src=' imgPath+"static/userui/home/run.png"'
|
||||||
@click="continueRiding" />
|
@click="continueRiding" />
|
||||||
<image style="width: 160px;height: 40px;" :src='imgPath+"static/userui/home/end.png"' @click="endRiding" />
|
<image style="width: 160px;height: 40px;" :src='imgPath+"static/userui/home/endride.png"'
|
||||||
|
@click="endRiding" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="showMess!=1" class="divMess">
|
<div v-if="showMess!=1" class="divMess">
|
||||||
@ -131,7 +132,10 @@
|
|||||||
findIndex
|
findIndex
|
||||||
} from 'lodash';
|
} from 'lodash';
|
||||||
import config from '@/utils/config';
|
import config from '@/utils/config';
|
||||||
import {onShow} from "@dcloudio/uni-app";
|
import {
|
||||||
|
onShow,
|
||||||
|
onUnload
|
||||||
|
} from "@dcloudio/uni-app";
|
||||||
import * as map from "@/utils/usermap.js";
|
import * as map from "@/utils/usermap.js";
|
||||||
|
|
||||||
const imgPath = config.imgPath;
|
const imgPath = config.imgPath;
|
||||||
@ -145,6 +149,8 @@
|
|||||||
const polygons = ref([]); //面
|
const polygons = ref([]); //面
|
||||||
const polylines = ref([]); //线
|
const polylines = ref([]); //线
|
||||||
const circles = ref([]); //圆
|
const circles = ref([]); //圆
|
||||||
|
const pointStart=100000000000;
|
||||||
|
const pointEnd=100000000001;
|
||||||
|
|
||||||
let oMap = null;
|
let oMap = null;
|
||||||
|
|
||||||
@ -171,16 +177,14 @@
|
|||||||
const showOrderPay = ref(false);
|
const showOrderPay = ref(false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//车辆
|
//车辆
|
||||||
let arrBikeData = [];
|
let arrBikeData = [];
|
||||||
const showBikeInfo = ref(false);
|
const showBikeInfo = ref(false);
|
||||||
|
|
||||||
//加载数据
|
//加载数据
|
||||||
function getLoalcationData() {
|
function getLoalcationData() {
|
||||||
uni.getLocation({
|
map.getLoalcation(res=>{
|
||||||
type: 'gcj02',
|
|
||||||
geocode: true,
|
|
||||||
success(res) {
|
|
||||||
const {
|
const {
|
||||||
latitude,
|
latitude,
|
||||||
longitude
|
longitude
|
||||||
@ -189,6 +193,7 @@
|
|||||||
latitude,
|
latitude,
|
||||||
longitude
|
longitude
|
||||||
};
|
};
|
||||||
|
oMap.moveToLocation({})
|
||||||
const params = {
|
const params = {
|
||||||
latitude,
|
latitude,
|
||||||
longitude,
|
longitude,
|
||||||
@ -221,13 +226,23 @@
|
|||||||
true);
|
true);
|
||||||
})
|
})
|
||||||
markers.value = arrData;
|
markers.value = arrData;
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
fail(res) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
})
|
||||||
|
// uni.getLocation({
|
||||||
|
// type: 'gcj02',
|
||||||
|
// geocode: true,
|
||||||
|
// success(res) {
|
||||||
|
// location.value = {
|
||||||
|
// latitude,
|
||||||
|
// longitude
|
||||||
|
// };
|
||||||
|
|
||||||
|
|
||||||
|
// },
|
||||||
|
// fail(res) {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
function clickMess() {
|
function clickMess() {
|
||||||
@ -342,9 +357,14 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showOrder.value = true;
|
showOrder.value = true;
|
||||||
if (!orderTimer) {
|
if(tempLock==1){
|
||||||
orderTimer = setInterval(getTracking, 10000);
|
getTracking();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
getTracking();
|
||||||
|
// if (!orderTimer) {
|
||||||
|
// orderTimer = setInterval(getTracking, 100000);
|
||||||
|
// }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,10 +381,14 @@
|
|||||||
ebikeCode: bikeCode,
|
ebikeCode: bikeCode,
|
||||||
startTime: createdAt
|
startTime: createdAt
|
||||||
}
|
}
|
||||||
if(endTime) params={...params,endTime}
|
if (endTime) params = {
|
||||||
|
...params,
|
||||||
|
endTime
|
||||||
|
}
|
||||||
|
|
||||||
console.log("7777777777777", params);
|
console.log("7777777777777", params);
|
||||||
callOperateApi("ebikeTracking/query", params, "post").then(res => {
|
callOperateApi("ebikeTracking/query", params, "post").then(res => {
|
||||||
|
console.log("7777777777777", "ebikeTracking/query", res);
|
||||||
const {
|
const {
|
||||||
code,
|
code,
|
||||||
data,
|
data,
|
||||||
@ -373,7 +397,7 @@
|
|||||||
if (code != 200) {
|
if (code != 200) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const arrPoints = !data ? [] : data.map(item => {
|
const arrPoints = (!data || data.length == 0) ? [] : data.map(item => {
|
||||||
const {
|
const {
|
||||||
lngGCJ02,
|
lngGCJ02,
|
||||||
latGCJ02
|
latGCJ02
|
||||||
@ -382,11 +406,8 @@
|
|||||||
longitude: lngGCJ02,
|
longitude: lngGCJ02,
|
||||||
latitude: latGCJ02
|
latitude: latGCJ02
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
if(data){
|
|
||||||
let {lngGCJ02:endlng,latGCJ02:endlat}=data[data.length-1];
|
|
||||||
arrMakers[index+1] = map.addMarker(id, endlng, endlat, "end.png");
|
|
||||||
}
|
|
||||||
const startPoint = ridePoint.split(",");
|
const startPoint = ridePoint.split(",");
|
||||||
const lng = startPoint[0];
|
const lng = startPoint[0];
|
||||||
const lat = startPoint[1];
|
const lat = startPoint[1];
|
||||||
@ -394,15 +415,18 @@
|
|||||||
longitude: lng,
|
longitude: lng,
|
||||||
latitude: lat
|
latitude: lat
|
||||||
}
|
}
|
||||||
arrPoints.splice(0, 0, start);
|
|
||||||
|
|
||||||
const arrMakers = markers.value || [];
|
const arrMakers = markers.value || [];
|
||||||
const id = 10000000;
|
arrPoints.splice(0, 0, start);
|
||||||
let index = findIndex(arrMakers, {
|
let indexStart = findIndex(arrMakers, {pointStart});
|
||||||
id
|
indexStart = indexStart == -1 ? arrMakers.length : indexStart;
|
||||||
});
|
arrMakers[indexStart] = map.addMarker(pointStart, lng, lat, "start.png");
|
||||||
index = index == -1 ? arrMakers.length : index;
|
if (data && data.length > 0) {
|
||||||
arrMakers[index] = map.addMarker(id, lng, lat, "start.png");
|
let {
|
||||||
|
lngGCJ02: endlng,
|
||||||
|
latGCJ02: endlat
|
||||||
|
} = data[data.length - 1];
|
||||||
|
arrMakers[indexStart + 1] = map.addMarker(pointEnd, endlng, endlat, "end.png");
|
||||||
|
}
|
||||||
markers.value = arrMakers;
|
markers.value = arrMakers;
|
||||||
if (arrPoints.length > 1) {
|
if (arrPoints.length > 1) {
|
||||||
polylines.value = [map.addLine("#168DED", arrPoints)];
|
polylines.value = [map.addLine("#168DED", arrPoints)];
|
||||||
@ -428,25 +452,35 @@
|
|||||||
|
|
||||||
//临时锁车
|
//临时锁车
|
||||||
function lockRiding() {
|
function lockRiding() {
|
||||||
showModelMessage("该功能暂未实现!");
|
|
||||||
const {
|
const {
|
||||||
userId
|
userId
|
||||||
} = oUser;
|
} = oUser;
|
||||||
const{bikeCode}=orderData;
|
const {
|
||||||
|
bikeCode
|
||||||
|
} = orderData;
|
||||||
const params = {
|
const params = {
|
||||||
userId,
|
userId,
|
||||||
bikeCode
|
bikeCode
|
||||||
}
|
}
|
||||||
callOrdereApi("userOrders/tempLock", params, "post").then(res => {
|
callOrdereApi("userOrders/tempLock", params, "post").then(res => {
|
||||||
const{code,message,data}=res;
|
const {
|
||||||
console.log("6666666666666666","lockRiding",res);
|
code,
|
||||||
});
|
message,
|
||||||
|
data
|
||||||
|
} = res;
|
||||||
|
showModelMessage(message)
|
||||||
|
if(code==200){
|
||||||
|
if(orderTimer) {
|
||||||
|
clearInterval(orderTimer);
|
||||||
|
orderTimer=null;
|
||||||
|
}
|
||||||
orderState.value = 1;
|
orderState.value = 1;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//结束用车
|
//结束用车
|
||||||
function endRiding() {
|
function endRiding() {
|
||||||
showModelMessage("该功能暂未实现!");
|
|
||||||
const {
|
const {
|
||||||
userId
|
userId
|
||||||
} = oUser;
|
} = oUser;
|
||||||
@ -463,20 +497,43 @@
|
|||||||
data,
|
data,
|
||||||
message
|
message
|
||||||
} = res;
|
} = res;
|
||||||
console.log("111111111111111111111111", "endRiding", res);
|
|
||||||
if (code != 200) {
|
if (code != 200) {
|
||||||
showModelMessage(message);
|
showModelMessage(message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
completeRiding();
|
completeRiding();
|
||||||
|
openOrderPay();
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//继续骑行 需要开锁
|
//继续骑行 需要开锁
|
||||||
function continueRiding() {
|
function continueRiding() {
|
||||||
showModelMessage("该功能暂未实现!");
|
const {
|
||||||
|
userId
|
||||||
|
} = oUser;
|
||||||
|
const {
|
||||||
|
bikeCode
|
||||||
|
} = orderData;
|
||||||
|
const params = {
|
||||||
|
userId,
|
||||||
|
bikeCode
|
||||||
|
}
|
||||||
|
callOrdereApi("userOrders/continueCycling", params, "post").then(res => {
|
||||||
|
const {
|
||||||
|
code,
|
||||||
|
message,
|
||||||
|
data
|
||||||
|
} = res;
|
||||||
|
showModelMessage(message)
|
||||||
|
if(code==200){
|
||||||
|
if(orderTimer) {
|
||||||
|
clearInterval(orderTimer);
|
||||||
|
orderTimer=null;
|
||||||
|
}
|
||||||
orderState.value = 0;
|
orderState.value = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
//getOrder();
|
//getOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,15 +555,17 @@
|
|||||||
showTools.value = true;
|
showTools.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getLoalcationData();
|
onMounted(()=>{
|
||||||
|
|
||||||
onShow(() => {
|
|
||||||
oUser=uni.getStorageSync("wechat_user");
|
|
||||||
console.log("7777777777777777777777",oUser)
|
|
||||||
const instance = getCurrentInstance();
|
const instance = getCurrentInstance();
|
||||||
oMap = uni.createMapContext("mapRef", {
|
oMap = uni.createMapContext("mapRef", {
|
||||||
this: instance.proxy
|
this: instance.proxy
|
||||||
});
|
});
|
||||||
|
})
|
||||||
|
onShow(() => {
|
||||||
|
oUser = uni.getStorageSync("wechat_user");
|
||||||
|
console.log("7777777777777777777777","oUser", oUser)
|
||||||
|
getLoalcationData();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
userId
|
userId
|
||||||
} = oUser;
|
} = oUser;
|
||||||
@ -515,6 +574,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUnload(() => {
|
||||||
|
console.log("9999999999999999999", "onUnload",orderTimer);
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@ -53,7 +53,9 @@
|
|||||||
callOrdereApi
|
callOrdereApi
|
||||||
} from "@/utils/api.js";
|
} from "@/utils/api.js";
|
||||||
import config from '@/utils/config';
|
import config from '@/utils/config';
|
||||||
import {addOrder} from "@/utils/usermap.js";
|
import {
|
||||||
|
addOrder
|
||||||
|
} from "@/utils/usermap.js";
|
||||||
|
|
||||||
const imgPath = config.imgPath;
|
const imgPath = config.imgPath;
|
||||||
|
|
||||||
@ -86,13 +88,13 @@
|
|||||||
bikeCode = options["number"];
|
bikeCode = options["number"];
|
||||||
if (type == "ride") {
|
if (type == "ride") {
|
||||||
addOrder(bikeCode, (res) => {
|
addOrder(bikeCode, (res) => {
|
||||||
|
console.log("00000000000000000000", res);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
bikeCode = null;
|
bikeCode = null;
|
||||||
}, 1000);
|
}, 1000);
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
showWorn.value = true;
|
showWorn.value = true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -72,7 +72,7 @@ export function addLine(scolor, arrPoints) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//创建订单
|
//创建订单
|
||||||
export function addOrder(bikeCode, icnt, callback) {
|
export function addOrder(bikeCode, callback) {
|
||||||
const oUser = uni.getStorageSync("wechat_user");
|
const oUser = uni.getStorageSync("wechat_user");
|
||||||
if (!oUser) {
|
if (!oUser) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -102,14 +102,15 @@ function saveRide(params, icnt, callback) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showModelMessage(message);
|
showModelMessage(message);
|
||||||
callback(false);
|
if(callback) callback(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
callback(true);
|
if(callback)callback(true);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateTo({
|
uni.switchTab({
|
||||||
url: "/pages/user/home/home"
|
url: "/pages/user/home/home"
|
||||||
})
|
})
|
||||||
}, 1000);
|
}, 1000)
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -2,7 +2,7 @@ export function getCache(name) {
|
|||||||
if (name == undefined || name == "") {
|
if (name == undefined || name == "") {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
let result = localStorage.getItem(name);
|
let result = sessionStorage.getItem(name);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
if ((result.startsWith("{") && result.endsWith("}")) || (result.startsWith("[") && result.endsWith("]"))) {
|
if ((result.startsWith("{") && result.endsWith("}")) || (result.startsWith("[") && result.endsWith("]"))) {
|
||||||
result = JSON.parse(result);
|
result = JSON.parse(result);
|
||||||
@ -18,9 +18,9 @@ export function getCache(name) {
|
|||||||
if (typeof value === 'object') {
|
if (typeof value === 'object') {
|
||||||
value = JSON.stringify(value);
|
value = JSON.stringify(value);
|
||||||
}
|
}
|
||||||
let result = localStorage.setItem(name, value);
|
let result = sessionStorage.setItem(name, value);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
export function clearStorage() {
|
export function clearStorage() {
|
||||||
localStorage.clear();
|
sessionStorage.clear();
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user