月球大数据地理空间分析展示平台-【前端】-月球2期前端
Surpriseplus
2023-09-05 8b8f88d7d8d713a1355d9849f467e3a2dc0c22fe
配置文件修改
已添加1个文件
已修改13个文件
已删除1个文件
154 ■■■■■ 文件已修改
public/config/config.js 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/config/config1.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/Map/config.js 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/Map/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/Map/menuTool.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/Map/olMap.js 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/Map/rightServer.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/Map/server.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/index.ts 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/request.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Map/olMap.vue 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/layer/attributeList.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/query/SpatialQuery.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/search/search.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/config/config.js
@@ -1,5 +1,26 @@
const BASE_URL = "http://192.168.20.83:8088/MoonServer/"; //后端接口地址
// const BASE_URL = "http://192.168.20.106:9000/MoonServer/"; //后端接口地址
//是否为生产环境
var isWeb = location.hostname.indexOf("103.85.165.") > -1;
//是否为生产环境
const webUrl = location.href.indexOf("/web") > -1 ? "/web" : "";
var webHost = isWeb ? "103.85.165.99" + ":28888" : '192.168.20.83' + ":8888";
//配置文件地址
const config = {
  mapMoon: webUrl + "/mapscreen/index.html",
  //椭球体初始化加载图片
  imgUrl: "Workers/image/earth.jpg",
  //license许可
  licenseServer: "http://183.162.245.49:18080",
  //SDK许可
  StaticFileBaseUrl: webUrl + "/CIMSDK/",
var isWeb = location.hostname.indexOf("103.85.165.") > -1;
  proxy: "http://" + webHost + "/MoonServer",
  BASE_URL: "http://" + webHost + "/MoonServer",
  conditions: [
    ["=", "<>", "like"],
    [">=", ">", " =", "<=", "<", "<>"],
    [">=", ">", " =", "<=", "<", "<>"],
  ],
};
export default config;
public/config/config1.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,5 @@
const BASE_URL = "http://192.168.20.83:8088/MoonServer/"; //后端接口地址
// const BASE_URL = "http://192.168.20.106:9000/MoonServer/"; //后端接口地址
var isWeb = location.hostname.indexOf("103.85.165.") > -1;
src/assets/js/Map/config.js
ÎļþÒÑɾ³ý
src/assets/js/Map/index.js
@@ -1,5 +1,5 @@
//配置文件地址
import config from "./config";
import config from "../../../../public/config/config";
//服务加载配置文件
import server from "./server";
src/assets/js/Map/menuTool.js
@@ -1,7 +1,7 @@
import * as turf from "@turf/turf";
import WKT from "terraformer-wkt-parser";
import rightServer from "./rightServer";
import config from "./config";
import config from "../../../../public/config/config";
import CryptoJS from "crypto-js";
// import { Store } from "vuex";
import store from "@/store";
src/assets/js/Map/olMap.js
@@ -1,6 +1,6 @@
import { getToken } from "@/utils/auth";
//配置文件地址
import config from "./config";
import config from "../../../../public/config/config";
import { Map, View } from "ol"; //地图,视图
import OSM from "ol/source/OSM"; //可以理解为数据源,就是一张图片
import TileLayer from "ol/layer/Tile"; //可以理解为图层
@@ -10,14 +10,16 @@
import WMTSTileGrid from "ol/tilegrid/WMTS.js";
import { get as getProjection, Projection } from "ol/proj.js";
import { register } from "ol/proj/proj4";
import MousePosition from "ol/control/MousePosition.js";
import { getTopLeft, getWidth } from "ol/extent.js";
import { format } from "ol/coordinate";
import store from "@/store";
const olMap = {
  map: null,
  Layer: null,
  projectionObj: {
    code: "ESRI:103881",
    extent: [-180, -90, 180, 90],
    code: null,
    extent: null,
  },
  initMap() {
    //google地图
@@ -31,10 +33,21 @@
    //   "+proj=laea +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +R=1737400 +units=m +no_defs +type=crs"
    // );
    // register(proj4);
    let mousePositionControl = new MousePosition({
      coordinateFormat: (coordinate) => {
        store.state.olLon = coordinate[0].toFixed(6)
        store.state.olLat = coordinate[1].toFixed(6);
        if (this.map) {
          store.state.olZoom = parseInt(this.map.getView().getZoom())
        }
      },
      projection: this.projectionObj.code,
      target: 'mouse',
    });
    const projection = new Projection({
      // code: this.projectionObj.code,
      code: "ESRI:103881",
      extent: [-180, -90, 180, 90],
      code: this.projectionObj.code,
      extent: this.projectionObj.extent,
      //   extent: this.projectionObj.extent,
    });
    this.map = new Map({
@@ -42,15 +55,15 @@
      layers: [], //AMapLayer, baiduMapLayer
      view: new View({
        projection: projection,
        center: [180, 90],
        center: [0, 0],
        zoom: 4,
      }),
      controls: [mousePositionControl]
    });
  },
  addTreeData(treeNode, obj) {
    // this.delLayerAll();
    this.projectionObj = obj;
    console.log(this.projectionObj);
    //判断是否为代理
    if (treeNode.proxy) {
      this.addProxyAddress(treeNode); //有代理
@@ -164,8 +177,13 @@
      code: this.projectionObj.code,
      // extent: this.projectionObj.extent,
      // code: "ESRI:103879",
      extent: [-180, -90, 180, 90],
      extent: this.projectionObj.extent,
    });
    if (this.map) {
      this.map.values_.view.projection_ = projection
    }
    // var projection = getProjection("ESRI:103880");
    var projectionExtent = projection.getExtent();
@@ -196,27 +214,11 @@
    });
    if (this.map) {
      this.map.addLayer(this.Layer);
      var that = this;
      window.olMap = this.map;
      window.layer = this.Layer
      setTimeout(() => {
        that.getLayersExtent();
      }, 1000)
      // this.Layer.getSource().on('addfeature', function () {
      //   this.map.getView().fit(this.Layer.getSource().getExtent());
      // });
      this.map.getView().fit(this.projectionObj.extent);
    }
  },
  getLayersExtent() {
    // ç¼©æ”¾è‡³å›¾å±‚范围
    this.map.getView().fit(this.Layer.renderer_.renderedExtent_);
  }
};
export default olMap;
src/assets/js/Map/rightServer.js
@@ -1,6 +1,6 @@
import { getToken } from "@/utils/auth";
//配置文件地址
import config from "./config";
import config from "../../../../public/config/config";
const rightServer = {
    layerList: [],
src/assets/js/Map/server.js
@@ -1,6 +1,6 @@
import { getToken } from "@/utils/auth";
//配置文件地址
import config from "./config";
import config from "../../../../public/config/config";
import store from "@/store";
const server = {
  layerList: [],
src/store/index.ts
@@ -32,6 +32,9 @@
    spatialTitle: null,
    setExportList: false,
    setLayerManager: false,
    olLon: "0.00",
    olLat: "0.00",
    olZoom: 0,
  },
  mutations: {
    //获取登录Code
src/utils/request.js
@@ -10,7 +10,7 @@
import router from "@/router/index";
import { getToken } from "@/utils/auth";
import config from "../assets/js/Map/config";
import config from "../../public/config/config";
// create an axios instance
const service = axios.create({
  baseURL: config.BASE_URL, // api的base_url
src/views/Map/olMap.vue
@@ -2,10 +2,16 @@
  <div
    id="mapView"
    class="mapView"
  ></div>
  >
    <div class="coordinate">经度:{{store.state.olLon}} çº¬åº¦ï¼š{{store.state.olLat  }} çº§åˆ«ï¼š{{store.state.olZoom  }} </div>
  </div>
</template>
<script lang="ts" setup>
import { useStore } from "vuex"; // å¼•å…¥useStore æ–¹æ³•
const store = useStore(); // è¯¥æ–¹æ³•用于返回store å®žä¾‹
import olMap from "@/assets/js/Map/olMap";
import {
  ref,
@@ -27,5 +33,18 @@
  margin: 0;
  padding: 0;
  position: absolute;
  .coordinate {
    bottom: 1%;
    left: 1%;
    padding: 10px;
    background: rgba(7, 8, 14, 0.8);
    z-index: 30;
    box-shadow: inset 0px 2px 10px 2px rgba(38, 47, 71, 1);
    position: absolute;
    font-size: 16px;
    font-family: Source Han Sans CN;
    font-weight: 400;
    color: #ffffff;
  }
}
</style>
src/views/layer/attributeList.vue
@@ -161,7 +161,7 @@
  nextTick,
  watch,
} from "vue";
import config from "@/assets/js/Map/config";
import config from "../../../public/config/config.js";
import { User, Lock, Plus, Location } from "@element-plus/icons-vue";
import { dataQuery_selectByPage, dataQuery_selectFields } from "@/api/api";
import { ElMessage } from "element-plus";
src/views/login.vue
@@ -94,7 +94,7 @@
  defineProps,
  defineEmits,
} from "vue";
import config from "@/assets/js/Map/config";
import config from "../../public/config/config.js";
//Router
import router from "@/router";
//图标
src/views/query/SpatialQuery.vue
@@ -268,7 +268,7 @@
  nextTick,
} from "vue";
import menuTool from "@/assets/js/Map/menuTool";
import config from "@/assets/js/Map/config";
import config from "../../../public/config/config.js";
import { User, Lock, Plus, Refresh, Location } from "@element-plus/icons-vue";
import {
  dataQuery_selectByPage,
src/views/search/search.vue
@@ -112,7 +112,7 @@
  ArrowRight,
  DArrowRight,
} from "@element-plus/icons-vue";
import config from "@/assets/js/Map/config";
import config from "../../../public/config/config.js";
import { dataQuery_selectByPage } from "@/api/api.js";
import { ElMessage } from "element-plus";
let searchValue = ref("");