校园-江西科技师范大学-前端
shuishen
2023-12-08 71fa6546c0ff5822bdf1e950f637a603a515f529
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({