xzw 10 uur geleden
bovenliggende
commit
151748bae0
3 gewijzigde bestanden met toevoegingen van 22 en 6 verwijderingen
  1. 19 3
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map
  3. 2 2
      src/sdk/cover/index.js

+ 19 - 3
public/lib/potree/potree.js

@@ -4631,6 +4631,22 @@
 	      return str.replace(reg, e);        //str.split(f).join(e); */
 	    }
 	  },
+	  cleanUrl(url) {
+	    //斜杠处理   协议aaa://保留双斜杠,其余单斜杠
+	    //分离协议和路径部分
+	    var protocolMatch = url.match(/^(\w+:)\/{2,}/);
+	    if (protocolMatch) {
+	      var protocol = protocolMatch[1];
+	      var path = url.slice(protocolMatch[0].length);
+	      return protocol + '//' + path.replace(/\/+/g, '/');
+	    } else {
+	      return url.replace(/\/+/g, '/');
+	    }
+	  },
+	  joinUrl() {
+	    //拼接地址。总是出现前后多个/造成双斜杠或者缺斜杠的问题,处理一下
+	    return this.cleanUrl(Array.from(arguments).join('/'));
+	  },
 	  dealURL() {
 	    var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
 	    var urlNew = this.replaceAll(url, "+", "%2B"); //this.replaceAll(url, "\\+", "%2B");// 浏览器似乎不支持访问带+的地址
@@ -23038,7 +23054,7 @@
 	          Potree.settings.cloudAddMapping && (prefix2 += '/' + originDataset.mapping);
 	          var timeStamp = originDataset.updateTime ? originDataset.updateTime.replace(/[^0-9]/ig, '') : ''; //每重算一次后缀随updateTime更新一次 
 	          //let cloudPath = `${Potree.settings.urls.prefix1}/${Potree.settings.webSite}/${sceneCode}/data/${sceneCode}/webcloud/cloud.js` 
-	          var cloudPath = "".concat(prefix2, "/").concat(originDataset.webBin); //webBin添加原因:每次裁剪之类的操作会换路径,因为oss文件缓存太严重,更新慢
+	          var cloudPath = Potree.Common.joinUrl(prefix2, originDataset.webBin); //`${prefix2}/${originDataset.webBin}`  //webBin添加原因:每次裁剪之类的操作会换路径,因为oss文件缓存太严重,更新慢
 	          dataset = originDataset;
 	          loadCloud({
 	            cloudPath,
@@ -91529,9 +91545,9 @@
 
 	    //path = `${prefix}/swkk/${sceneCode}/wwwroot/scene_view_data/${sceneCode}/images/vision.txt`
 	    if (Potree.settings.urls.templates.vision) {
-	      path = prefix + Potree.Common.replaceAll(Potree.settings.urls.templates.vision, '{sceneCode}', sceneCode);
+	      path = Potree.Common.joinUrl(prefix, Potree.Common.replaceAll(Potree.settings.urls.templates.vision, '{sceneCode}', sceneCode));
 	    } else {
-	      path = "".concat(prefix, "/scene_view_data/").concat(sceneCode, "/images/vision.txt");
+	      path = Potree.Common.joinUrl(prefix, "/scene_view_data/".concat(sceneCode, "/images/vision.txt"));
 	    }
 	  }
 	  model.sceneCode = sceneCode;

File diff suppressed because it is too large
+ 1 - 1
public/lib/potree/potree.js.map


+ 2 - 2
src/sdk/cover/index.js

@@ -2675,14 +2675,14 @@ function load4dkkMedias(model){//加载四维看看的一些媒体物品
     console.log(sceneJsonPath,surveillancePath)
     if(sceneJsonPath){//box图片视频                         /oss/scene_view_data/SG-jm-Xwq0FwSkFy4/data/scene.json
         
-        sceneJsonPath = `${Potree.settings.urls.getPrefix(8,{})}/${sceneJsonPath}`
+        sceneJsonPath = Potree.Common.joinUrl(Potree.settings.urls.getPrefix(8,{}), sceneJsonPath ) 
         
         Potree.loadFile(sceneJsonPath+ '?m='+Date.now(),null,(json)=>{
             //console.log(model.name,  'sceneJson', json,  json.surveillances)
             
             if(json.surveillances){//监控 
             
-                surveillancePath = `${Potree.settings.urls.getPrefix(8,{})}/${surveillancePath}`
+                surveillancePath = Potree.Common.joinUrl(Potree.settings.urls.getPrefix(8,{}), surveillancePath ) 
             
                 Potree.loadFile(surveillancePath + '?m='+Date.now(),null,(monitorJson)=>{ 
                     //console.log(model.name, 'surveillance', monitorJson)