tianyabing 2 rokov pred
rodič
commit
7b8e30dc7b

+ 19 - 2
src/components/dataManage/dataDetail/ModelDataDetail.vue

@@ -177,8 +177,25 @@ export default {
       if (flag) {
         if (this.formData.url && this.formData.url !== '') {
           let token = this.$store.state.token;
-          let url = this.formData.url.split('?')[0]
-          this.formData.modelUrl = url+'?&servertype='+this.formData.title+'&token='+token;
+          let split = this.formData.url.split('?');
+          let url = split[0]
+          let queryParams = {};
+          if (split.length>1) {
+            let queryString = split[1].split('&');
+            for (let i = 0; i < queryString.length; i++) {
+              let param = queryString[i].split('=')
+              queryParams[param[0]] = param[1];
+            }
+          }
+          if (!queryParams['servertype'] || queryParams['servertype']==='') {
+            queryParams['servertype'] = this.formData.title
+          }
+          queryParams['token'] = token;
+          url = url+'?';
+          for (const queryParamsKey in queryParams) {
+            url = url+'&'+queryParamsKey+'='+queryParams[queryParamsKey];
+          }
+          this.formData.modelUrl = url;
           if (this.formData.modelType == '水面-json') {
             this.mapType = 4;
           }

+ 49 - 17
src/components/map/CesiumMap.vue

@@ -101,7 +101,14 @@ export default {
       )
       window.viewer = viewer
       // 加载模型
-      app.loadingEntities(app.type);
+      let type = app.type;
+      if (app.item) {
+        let url = app.item.split('?');
+        if (url[0].indexOf('.gltf')===(url[0].length-5)) {
+          type = 3;
+        }
+      }
+      app.loadingEntities(type);
     },
     loadingEntities(type) {
       let app = this;
@@ -175,33 +182,58 @@ export default {
     addGltf(url) {
       let app= this;
       let height = 1;
-      if (this.extraParams.elevation && this.extraParams.elevation!=='') {
+      let lon = 120.90685004033816;
+      let lat = 27.918254593203912;
+      let heading = 0;
+      let pitch = 0;
+      let roll = 0;
+      let title = 'gltf';
+      if (this.extraParams && this.extraParams.elevation && this.extraParams.elevation!=='') {
         height = Number(this.extraParams.elevation)
       }
+      if (this.extraParams && this.extraParams.lon && this.extraParams.lon!=='') {
+        lon = Number(this.extraParams.lon)
+      }
+      if (this.extraParams && this.extraParams.lat && this.extraParams.lat!=='') {
+        lat = Number(this.extraParams.lat)
+      }
+      if (this.extraParams && this.extraParams.heading && this.extraParams.heading!=='') {
+        heading = Number(this.extraParams.heading)
+      }
+      if (this.extraParams && this.extraParams.pitch && this.extraParams.pitch!=='') {
+        pitch = Number(this.extraParams.pitch)
+      }
+      if (this.extraParams && this.extraParams.roll && this.extraParams.roll!=='') {
+        roll = Number(this.extraParams.roll)
+      }
+      if (this.extraParams && this.extraParams.title && this.extraParams.title!=='') {
+        title = this.extraParams.title;
+      }
+
       var modelObj = new SkyScenery.singleModelBindClick(viewer, {
         url: url,
-        lon: this.extraParams.lon,
-        lat: this.extraParams.lat,
+        lon: lon,
+        lat: lat,
         height: height,
-        heading: this.extraParams.heading,
-        pitch: this.extraParams.pitch,
-        roll: this.extraParams.roll,
+        heading: heading,
+        pitch: pitch,
+        roll: roll,
         info: {
-          log: this.extraParams.lon,
-          lat: this.extraParams.lat,
-          elevation: this.extraParams.elevation,
-          heading: this.extraParams.heading,
-          pitch: this.extraParams.pitch,
-          roll: this.extraParams.roll,
-          title: this.extraParams.title
+          log: lon,
+          lat: lat,
+          elevation: height,
+          heading: heading,
+          pitch: pitch,
+          roll: roll,
+          title: title
         }
       })
-      let origin = SkyScenery.Cartesian3.fromDegrees(this.extraParams.lon, this.extraParams.lat, 2);
+      let origin = SkyScenery.Cartesian3.fromDegrees(lon, lat, 2);
       viewer.camera.flyTo({
         destination: origin,
         orientation: {
-          heading: SkyScenery.Math.toRadians(0), // 方向
-          pitch: SkyScenery.Math.toRadians(-90), // 倾斜角度
+          heading: SkyScenery.Math.toRadians(-30), // 方向
+          pitch: SkyScenery.Math.toRadians(-10), // 倾斜角度
           roll: SkyScenery.Math.toRadians(0),
         },
       });

+ 1 - 1
vue.config.js

@@ -23,7 +23,7 @@ module.exports = defineConfig({
         port: 8080,
         proxy: {
             '/proxy_dtbserver/': {
-                target: 'http://121.43.55.7:10091/dtbservice',
+                target: 'http://122.228.28.40:10091/dtb',
                 changeOrigin: true,
                 pathRewrite: {
                     '^/proxy_dtbserver': ''