From e241909ac2c6e5e4d415c614049fbcb2ff0c4271 Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Wed, 23 Feb 2022 10:22:26 +0800
Subject: [PATCH] +地图画线 不能再真机使用,把数据丢到computed中去

---
 pages/grabOrders/map.vue |   64 +++++++++++++++++++------------
 1 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/pages/grabOrders/map.vue b/pages/grabOrders/map.vue
index e609694..2e2bdb7 100644
--- a/pages/grabOrders/map.vue
+++ b/pages/grabOrders/map.vue
@@ -3,9 +3,10 @@
 		<u-top-tips ref="uTips"></u-top-tips>
 		<!-- <u-button type="info" @click="acc">测试</u-button> -->
 		<!-- <web-view :src="urls" @message="message"></web-view> -->
-		<map :scale='18' id="myMap" style="width: 100%;" :style="{height: mapHeight + 'px'}" :markers="markers"
-			:longitude="longitude" :latitude="latitude" :circles="circles" :polyline="polylines"></map>
-		<view id="Umain">
+		<map :scale='18' id="myMap" style="width: 100%;z-index: 10000;" :style="{height: mapHeight + 'px'}"
+			:markers="markersCom" :longitude="longitude" :latitude="latitude" :circles="circlesCom"
+			:polyline="mypolylinesCom"></map>
+		<cover-view id="Umain">
 			<view class="once-b">
 				任务详情
 			</view>
@@ -85,7 +86,6 @@
 					{{ourData.num==ourData.jnum?"人数已满":'我参与'}}
 				</u-button>
 			</view>
-		</view>
 		<u-popup v-model="showIn" mode="center" border-radius="14" z-index='1000001'>
 			<view class="Info2">
 				<view class="Info4">是否参加活动</view>
@@ -95,6 +95,7 @@
 				</view>
 			</view>
 		</u-popup>
+		</cover-view>
 	</view>
 </template>
 
@@ -113,21 +114,7 @@
 				longitude: 115.8995839881188,
 				circles: [], //圆
 				markers: [], //标记点
-				polylines: [{ //指定一系列坐标点,从数组第一项连线至最后一项
-					points: [{
-							latitude: 40.013305,
-							longitude: 118.685713
-						},
-						{
-							latitude: 40.013,
-							longitude: 118.685
-						},
-					],
-					color: "#FE0000", //线的颜色
-					width: 4, //线的宽度
-					dottedLine: false, //是否虚线
-					arrowLine: false, //带箭头的线 开发者工具暂不支持该属性
-				}],
+				mypolylines: [],
 				useTime: null,
 				useTimeSet: null,
 				times: 3000,
@@ -228,7 +215,7 @@
 								'&other="11111"'
 						});
 					} else if (that.ourData.butCT == "begin") {
-						that.bye = true;//点击开始 这个页面就不用了
+						that.bye = true; //点击开始 这个页面就不用了
 						// 开始任务
 						// that.setUniAppMsg("hBackMsg", {
 						// 	type: "start",
@@ -433,7 +420,16 @@
 				} else {
 					return this.$store.state.isOnTaskValue;
 				}
-			}
+			},
+			circlesCom(){
+				return this.circles.slice(0);
+			},
+			markersCom(){
+				return this.markers.slice(0);
+			},
+			mypolylinesCom(){
+				return this.mypolylines.slice(0);
+			},
 		},
 		watch: {
 			isOnTaskValue: {
@@ -453,7 +449,7 @@
 		mounted() {},
 		onReady() {
 			let that = this;
-			this.map = uni.createMapContext("myMap", this);
+
 			// window['hBackMsg'] = (val) => {
 			// 	// console.log(val)
 			// 	let d = {
@@ -489,6 +485,7 @@
 			this.bye = true;
 		},
 		onLoad: function(options) {
+			this.map = uni.createMapContext("myMap", this);
 			var datas = {},
 				data = {},
 				that = this;
@@ -697,15 +694,32 @@
 			//画线
 			console.log(data)
 			let line = data.line.split("(")[1].split(")")[0].split(",");
+			console.log(line[0].split(" ")[1])
+			console.log(line[0].split(" ")[0])
+			this.latitude = line[0].split(" ")[1];
+			this.longitude = line[0].split(" ")[0];
+			this.map.moveToLocation({
+				// latitude: line[0].split(" ")[1],
+				// longitude: line[0].split(" ")[0]
+				latitude: 40.013305,
+				longitude: 118.685713
+			});
 			let ourline = [];
 			for (let k in line) {
 				let ins = line[k].split(" ");
 				ourline.push({
-					latitude: ins[1],
-					longitude: ins[0]
+					latitude: +ins[1],
+					longitude: +ins[0]
 				})
 			}
-			this.polylines[0].points = ourline;
+			this.mypolylines[0] = { //指定一系列坐标点,从数组第一项连线至最后一项
+				points: ourline,
+				color: "#FE0000", //线的颜色
+				width: 4, //线的宽度
+				dottedLine: false, //是否虚线
+				arrowLine: false, //带箭头的线 开发者工具暂不支持该属性
+			}
+			console.log(this.mypolylines)
 			// this.getLocationInfo(data);
 			if (data.butCT == "beginUp" && data.buttype == 0) {
 				this.bye = false;

--
Gitblit v1.9.3