tianyi 3 weeks ago
parent
commit
83c1121f1f
  1. 40
      pages/index/index.vue

40
pages/index/index.vue

@ -805,8 +805,6 @@
// //
// this.getUserLocation(); // this.getUserLocation();
this.getUserOrders(); this.getUserOrders();
// WebSocket
this.getDeliveryLocation();
if (!uni.getStorageSync('area')) { if (!uni.getStorageSync('area')) {
this.checkArea() this.checkArea()
} else { } else {
@ -1300,44 +1298,6 @@
phoneNumber: phone phoneNumber: phone
}); });
}, },
// 使WebSocket
getDeliveryLocation() {
// WebSocket
// uni.connectSocket({
// url: "wss://www.example.com/socket",
// header: {
// "content-type": "application/json",
// },
// protocols: ["protocol1"],
// method: "GET",
// });
// WebSocketsetInterval
// this.deliveryTimer = setInterval(() => {
// WebSocketAPI
//
const deliveryLat = this.latitude;
const deliveryLng = this.longitude;
//
// id1
this.markers = this.markers.filter(marker => marker.id !== 1);
//
this.markers.push({
id: 1,
latitude: deliveryLat,
longitude: deliveryLng,
title: '张三',
iconPath: '/static/images/tabbar/fabu1.png', //
width: 30,
height: 30
});
//
this.latitude = deliveryLat;
this.longitude = deliveryLng;
// }, 5000);
},
// //
onUnload() { onUnload() {
if (this.deliveryTimer) { if (this.deliveryTimer) {

Loading…
Cancel
Save