zhongtianhaoyuan 2 jaren geleden
bovenliggende
commit
d7de41f1ba
3 gewijzigde bestanden met toevoegingen van 26 en 25 verwijderingen
  1. 2 2
      config/index.js
  2. 1 1
      pages/order/index.vue
  3. 23 22
      pages/order/map.nvue

+ 2 - 2
config/index.js

@@ -1,7 +1,7 @@
 const dev = {
-	baseUrlNew: 'https://api.changyuntong56.com',
+	// baseUrlNew: 'https://api.changyuntong56.com',
 	// baseUrlNew: 'https://apitest.changyuntong56.com',
-	// baseUrlNew: 'http://192.168.110.9:8099',
+	baseUrlNew: 'http://192.168.110.9:8099',
 	// baseUrlNew: 'https://apitest.eliangeyun.com',
 	// baseUrlNew: 'http://192.168.110.67:8999/',
 	h5Appid: 'wxb66b599f7f61b46f',

+ 1 - 1
pages/order/index.vue

@@ -395,7 +395,7 @@
 
 		},
 		onShow() {
-			let that = this
+			let that = this 
 			if (this.scrollTop > 1200) {
 				uni.setTabBarItem({
 					index: 0,

+ 23 - 22
pages/order/map.nvue

@@ -17,7 +17,6 @@
 	export default {
 		data() {
 			return {
-
 				scaleNum: 10,
 				mapContext: null, //地图对象
 				startMove: false, //是否开始回放
@@ -54,25 +53,35 @@
 		methods: {
 			//模拟获取远程数据
 			getTrack() {
-				
 				uni.request({
 					url: baseUrl + '/hyOrderTravelPath/getInfo',
 					data: {
-						orderId: this.id
+						orderId: this.id,
+						currentPage: 1,
+						pageSize: 9999
 					},
 					method: 'get',
 					header: {
 						'content-type': 'application/json' //'application/x-www-form-urlencoded; charset=UTF-8',
 					},
 					success: (res) => {
-						// console.log(res.data,11111111)
-						if(res.data.code==200){
-							if(res.data.data){
-								if(res.data.data.longitudeLatitude){
-									// console.log(JSON.parse(res.data.data.longitudeLatitude));
-									this.polyline[0].points =JSON.parse(res.data.data.longitudeLatitude)
+						if (res.data.code == 200) {
+							if (res.data.data) {
+								var patharr = []
+								for (let num = 0; num < res.data.data.records.length; num++) {
+									if(res.data.data.records[num].longitudeLatitude){
+										patharr.push(JSON.parse(res.data.data.records[num].longitudeLatitude));
+									}
+									// for (let i = 0; i < patharr.length; i++) {
+									//   that.path2.push([patharr[i].longitude, patharr[i].latitude]);
+									// }
 								}
-							}else{
+								this.polyline[0].points = patharr
+								// if (res.data.data.longitudeLatitude) {
+								// 	// console.log(JSON.parse(res.data.data.longitudeLatitude));
+								// 	this.polyline[0].points = JSON.parse(res.data.data.longitudeLatitude)
+								// }
+							} else {
 								uni.showToast({
 									title: '暂无运输轨迹',
 									icon: 'none',
@@ -110,11 +119,11 @@
 				// 	// 	this.polyline[0].points.push({latitude,longitude})
 				// 	// }
 				var that = this
-				setTimeout(()=>{
-					that.durationTime = Math.ceil(30000 / that.polyline[0].points.length)	//默认播放全程使用30秒,计算相连两点动画时长
+				setTimeout(() => {
+					that.durationTime = Math.ceil(30000 / that.polyline[0].points.length) //默认播放全程使用30秒,计算相连两点动画时长
 					that.initMapData()
-				},1000)
-					
+				}, 1000)
+
 				// 	})
 				// 	.catch(res => {
 				// 		uni.hideLoading()
@@ -124,18 +133,13 @@
 				// 			duration: 2000
 				// 		})
 				// 	});
-
-
-
 			},
 			//设置地图
 			initMapData() {
 				this.initMarkers()
 				this.mapContext = uni.createMapContext('myMap', this)
-
 			},
 			test() {
-				// console.log("1111111111111111")
 				this.mapContext.includePoints({
 					points: this.polyline[0].points,
 					padding: [100, 100, 1000, 100]
@@ -149,8 +153,6 @@
 			},
 			//开始移动
 			handleStartMove() {
-
-				console.log("222222")
 				this.startMove = true
 				this.movePoint()
 			},
@@ -169,7 +171,6 @@
 				})
 				return
 				*/
-			   console.log(this.mapContext)
 				this.mapContext.moveAlong({
 					duration: 10000,
 					markerId: this.markers[0].id,