From 71fa6546c0ff5822bdf1e950f637a603a515f529 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 08 Dec 2023 15:50:59 +0800
Subject: [PATCH] 移动端路网

---
 src/components/mobileWindow/index.vue |   26 ++++++------
 src/components/mobilemap/index.vue    |    4 +
 src/store/modules/mobile.js           |   38 +++++++++++-------
 3 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/src/components/mobileWindow/index.vue b/src/components/mobileWindow/index.vue
index c41f6f0..3558a19 100644
--- a/src/components/mobileWindow/index.vue
+++ b/src/components/mobileWindow/index.vue
@@ -390,11 +390,11 @@
                         name: '显示活动'
                     })
                     // 暂时关闭去这的功能
-                    // if (queryData.notAddGoOn == 'notAddGoOn') {
-                    //     this.seebut.push({
-                    //         name: '去这'
-                    //     })
-                    // }
+                    if (queryData.notAddGoOn == 'notAddGoOn') {
+                        this.seebut.push({
+                            name: '去这'
+                        })
+                    }
                 }
                 for (const k in this.seebut) {
                     if (this.seebut[k].name == '定位') {
@@ -402,11 +402,11 @@
                     }
                 }
                 // 暂时关闭去这的功能
-                // if (queryData.notAddGoOn != 'notAddGoOn') {
-                //     this.seebut.push({
-                //         name: '去这'
-                //     })
-                // }
+                if (queryData.notAddGoOn != 'notAddGoOn') {
+                    this.seebut.push({
+                        name: '去这'
+                    })
+                }
             } else {
                 this.seebut = [
                     // {
@@ -415,9 +415,9 @@
                     {
                         name: '图集'
                     },
-                    // {
-                    //     name: '去这'
-                    // }
+                    {
+                        name: '去这'
+                    }
                 ]
             }
 
diff --git a/src/components/mobilemap/index.vue b/src/components/mobilemap/index.vue
index ded6f1f..e16e69d 100644
--- a/src/components/mobilemap/index.vue
+++ b/src/components/mobilemap/index.vue
@@ -42,7 +42,7 @@
         <!-- 实景窗口 -->
         <mobilePanorama></mobilePanorama>
         <!-- 退出导航 -->
-        <mobileCloseRouter></mobileCloseRouter>
+        <mobileCloseRouter ref="MobileCloseRouter"></mobileCloseRouter>
         <!-- 退出活动 -->
         <mobileCloseRouterMany></mobileCloseRouterMany>
         <!-- 活动窗口 -->
@@ -173,6 +173,8 @@
         campusValue: {
             handler (newData) {
                 this.$nextTick(() => {
+                    this.$refs.MobileCloseRouter.mobileRouterClose()
+
                     this.campusCut(newData)
 
                     this.$refs.mobileLeftNav.initialize(newData)
diff --git a/src/store/modules/mobile.js b/src/store/modules/mobile.js
index 27b8595..b7a1cef 100644
--- a/src/store/modules/mobile.js
+++ b/src/store/modules/mobile.js
@@ -17,6 +17,7 @@
 import { Icon, Style, Fill, Text, Stroke } from "ol/style.js";
 
 import openlayerData from "./openlayerData";
+import mobilePosition from "./mobilePosition";
 
 window.popupsDom = null; // mobileDivForms的实体类
 window.flytoPosition = null; // mobileDivForms的实体类
@@ -57,6 +58,17 @@
 
 // window.newLayer = null;
 // window.usetowpointfive = null;
+
+let pathUrl = [
+  {
+    key: 1,
+    url: "https://fkxt.jxstnu.edu.cn/changjing/arcgis155/rest/services/hjzlw/NAServer/%E8%B7%AF%E5%BE%84/solve",
+  },
+  {
+    key: 2,
+    url: "https://fkxt.jxstnu.edu.cn/changjing/arcgis155/rest/services/fllw/NAServer/%E8%B7%AF%E5%BE%84/solve",
+  },
+];
 
 const mobile = {
   state: {
@@ -893,10 +905,10 @@
         Number(val.end[1]).toFixed(6),
       ]; // 导航终点
 
-      // 获取路径
-      const url =
-        "https://dev.jxpskj.com:8023/arcgis/rest/services/jglw/NAServer/%E8%B7%AF%E5%BE%84/solve"; // 默认api步行
-      // const url = 'https://dev.jxpskj.com:8023/arcgis/rest/services/testroad/NAServer/%E8%B7%AF%E5%BE%84/solve' // 默认api步行
+      let curPath = pathUrl.find(
+        (item) => item.key == mobilePosition.state.currentCampus
+      );
+
       const data = {
         stops: {
           features: [
@@ -919,7 +931,7 @@
         f: "json",
       };
       axios
-        .get(url, {
+        .get(curPath.url, {
           params: {
             ...data,
           },
@@ -927,11 +939,11 @@
         .then((res) => {
           // 回调
 
-          let Str = ""; // 加入起点
-          res.data.routes.features[0].geometry.paths[0].forEach((item) => {
-            Str += `${item[0]},${item[1]};`;
-          });
-          // Str += state.navigationEndLngLat.join(',') // 加入终点
+          let Str = res.data.routes.features[0].geometry.paths[0].map(
+            (item) => {
+              return [item[0], item[1]];
+            }
+          );
 
           if (val.fn) {
             const dataS = {
@@ -959,11 +971,7 @@
       });
       openlayerData.state.openlayers.map2D.addLayer(window.drawALineLayer);
 
-      const lineCoordinates = value
-        .split(";")
-        .map((item) => item.split(",").map((i) => Number(i)));
-
-      const line = new LineString(lineCoordinates);
+      const line = new LineString(value);
 
       const style = new Style({
         stroke: new Stroke({

--
Gitblit v1.9.3