xzw 5 år sedan
förälder
incheckning
e1ba7dcee8
4 ändrade filer med 130 tillägg och 60 borttagningar
  1. 20 3
      edit.html
  2. 42 18
      js/edit.js
  3. 46 22
      js/main_2020_edit.js
  4. 22 17
      js/main_2020_show.js

+ 20 - 3
edit.html

@@ -1389,12 +1389,29 @@
         </div>
     </div>
 
-    <script>
-        var token = localStorage.dcj_token
+    <script> 
+        
+        //本地:
+        var token ="eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInJvbGUiOm51bGwsIm1hbmFnZXIiOm51bGwsImlkIjoxLCJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNTk2Nzk1NjczLCJpYXQiOjE1OTY3MDkyNzMsImp0aSI6IjBjOWE1OTA0LTM5NzgtNDY4Yi05ODA5LWRmMjY4NDdiMWVmZCJ9.ihux4chiWgbY1cxiwVKrI6XaPHGCgWuoj6uVF1KRfOo"
+        var ceshi = 'http://47.107.252.54:8105';
+        /*
+        //大场景: 
+        var ceshi = 'http://47.107.252.54:8105';
+        var token = window.localStorage.dcj_token 
         if (!token) {
            window.location.href = '../list/index.html'
         }
-
+        
+        
+        //军史馆:
+        var ceshi = "http://192.168.0.44:8101/"
+        var token = window.localStorage.bigscenetoken 
+        if (!token) {
+           window.location.href = "http://192.168.0.44:8101/bigscene/#/"
+        }*/
+        
+        
+        
         var log = window.location.href.substring(window.location.href.indexOf("?") + 1).indexOf('log') > -1;
         
         if (log) {

+ 42 - 18
js/edit.js

@@ -1,10 +1,9 @@
-var ceshi = '';
-// var ceshi = 'http://192.168.0.135:8105';
- var ceshi = 'http://47.107.252.54:8105';
 
-//var token ="eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsInJvbGUiOm51bGwsIm1hbmFnZXIiOm51bGwsImlkIjoxLCJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNTk2Nzk1NjczLCJpYXQiOjE1OTY3MDkyNzMsImp0aSI6IjBjOWE1OTA0LTM5NzgtNDY4Yi05ODA5LWRmMjY4NDdiMWVmZCJ9.ihux4chiWgbY1cxiwVKrI6XaPHGCgWuoj6uVF1KRfOo"
-//var token = window.localStorage.dcj_token
- var token = window.localStorage.bigscenetoken//军史馆
+
+var _musicMaxWeight = 8//M
+
+
+
 
 function reData(data,type) {
   return JSON.stringify(data) == type ? null : data
@@ -253,9 +252,9 @@ SceneInformation.prototype.init = function (data, data2) {
   let VRSwitch = $('#VRSwitch input');    // VR功能开启
   /***********************************************************************************/
 
-  $(".model-title2").text(data.model.name);
-  $('#pjtName').val(data.model.name);
-  $('#info-summary').val(data.model.summary);
+  $(".model-title2").text(data.name);
+  $('#pjtName').val(data.name);
+  $('#info-summary').val(data.summary);
   //if (data2) $('#weixin-summary').val(data2.weixinDesc);
     $('#weixin-summary').val(data.weixinDesc);
 
@@ -316,12 +315,12 @@ SceneInformation.prototype.init = function (data, data2) {
   }
 
   //特殊大场景
-  if (data.special === "true" || data.model.special) {
+  if (data.special === "true" || data.special) {
     $g_specialScene[0].checked = true
   }
 
   //启动二代的数据
-  if (data.vision_version === "1.1.562.17209" || data.model.vision_version) {
+  if (data.vision_version === "1.1.562.17209" || data.vision_version) {
     $twoData[0].checked = true
   }
 
@@ -346,12 +345,14 @@ function initColorElem(data, elem) {
   // 事件监听
   $floorMarkerColor.on('change', function (e) {
     $('#floorMarkerColorTex').attr('placeholder', e.target.value)
+     
   })
   $floorMarkerColorTex.on('blur keydown', function (e) {
     (e.type === 'blur' || e.type === 'keydown' && e.keyCode === 13) && setColor(e, $floorMarkerColor, this);
   })
   $mouseMarkerColor.on('change', function (e) {
     $('#mouseMarkerColorTex').attr('placeholder', e.target.value)
+     
   })
   $mouseMarkerColorTex.on('blur keydown', function (e) {
     (e.type === 'blur' || e.type === 'keydown' && e.keyCode === 13) && setColor(e, $mouseMarkerColor, this);
@@ -650,6 +651,7 @@ Hotpoint.prototype.addmedia = function () {
     if (ev.target.tagName.toUpperCase() === 'INPUT') {
       fileHandle.call(ev.target)
     }
+     ev.target.value = null
   })
   $('.edit-fun-images').on('click', function (ev) {
     var $tag = $(ev.target)
@@ -817,7 +819,7 @@ Hotpoint.prototype.addHot = function (that, Hot, fn) {
   }
 }
 //创建热点列表的dom
-Hotpoint.prototype.creatDom = function (data, index) {
+Hotpoint.prototype.createDom = function (data, index) {
   var _index = +index + 1;
    return "<li data-spid=" + data.name + " id=ggg_s" + index + ">" +
     "<div class=icon></div>" +
@@ -830,7 +832,7 @@ Hotpoint.prototype.creatDom = function (data, index) {
 //添加热点列表
 Hotpoint.prototype.addHotList = function (data, index) {
   if (!data) return;
-  this.spotList.children("ul").append(this.creatDom(data, index));
+  this.spotList.children("ul").append(this.createDom(data, index));
   //保存热点信息到热点dom元素中
   var spotList = $(".spotList ul").children("#ggg_s" + index);
   spotList[0].hotAttribute = g_HotMeshes[index];
@@ -1047,13 +1049,14 @@ var EditMiuse = function () {
     this.mediaUpload.find("input").val("");
   };
   var that = this;
-  $('#upload-bgm').on('change', function () {
+  $('#upload-bgm').on('change', function (e) { 
     var file = this.files[0];
     uploadMiuse(file, function (rs, file) {
       if (rs.code === 0) {
         that.success(file.name, rs.data)
       }
     })
+    e.target.value = null
   });
   //删除音乐
   this.mediaUpload.on("click", ".delete", function () {
@@ -1080,7 +1083,7 @@ var EditGuide = function () {
  * @description 新增参数data2, 表示data2.js中的数据
  */
 EditGuide.prototype.init = function (data, data2) {
-  this.creatDom(data, data2);
+  this.createDom(data, data2);
   this.addTourMusic();  // 添加导览音乐
   this.tourAudio = data2.tourAudio || {};
   var that = this;
@@ -1131,6 +1134,7 @@ EditGuide.prototype.init = function (data, data2) {
     }
   }).on("change", function (ev) {
     this.inputDone(ev)
+     ev.target.value = null
   }.bind(this))
   $('.tourList ul input').on('blur', function (ev) {
     this.inputDone(ev)
@@ -1299,7 +1303,7 @@ EditGuide.prototype.addTourMusic = function () {
  * @param {object} data someData.js中的模型数据
  * @param {object} data2 data2.js中的导览和热点数据
  */
-EditGuide.prototype.creatDom = function (data, data2) {
+EditGuide.prototype.createDom = function (data, data2) {
   var $lis = [];
   var that = this;
   var tourAudio = data2.tourAudio || {};
@@ -1442,13 +1446,16 @@ var uploadMiuse = function (file, callback) {
     return false;
   }
   //限制大小不大于8m
-  if (!restrictedSize(file, 8)) {
+  if (!restrictedSize(file, _musicMaxWeight)) {
     return false
   }
 
   uploadFile(file, 'audio', callback);
 }
 
+$(".toolRight .music .itemTitle span").text(`背景音乐 (<${_musicMaxWeight}M)`)
+
+
 
 //上传图片
 function uploadImg(urlData, callback) {
@@ -1477,7 +1484,24 @@ function uploadFile(file, type, callback) {
   formData.append('name', number)
   formData.append('dir', type)
   formData.append('random', true)
-  formData.append('file', file)
+  formData.append('file', file, getRandomSid()+".jpg")
+
+ 
+
+/* 
+var blob = dataURLtoBlob(fileObj.file);
+                form.append("file", blob, fileObj.name);
+            } else {
+                if (fileObj.isBlob) {
+                    console.log('上传的文件:' + fileObj.name)
+                    form.append("file", fileObj.file, fileObj.name);
+                } else {
+                    var file = fileObj.file;
+                    form.append("file", file, fileObj.name);
+                } */
+
+
+
 
   $.ajax({ 
     url: ceshi + '/manage/scene/upload/'+number, 

+ 46 - 22
js/main_2020_edit.js

@@ -6445,7 +6445,8 @@ function o(a, s, l) {
                         var tmp =  s.thumbUrl.replace('https://','').replace('http://','')
 
                         if (l.attr("data-index", a),
-                        Ce.highlight.visible && l.find("img").attr("src",'https://'+tmp),
+                        //Ce.highlight.visible && l.find("img").attr("src",'https://'+tmp),
+                        Ce.highlight.visible && l.find("img").attr("src", 'http://'+tmp),// xzw改 导览图片 https在某些服务器打不开
                         s.name) {
                             var c = $('<div class="overlay"></div>').text(s.name);
                             l.prepend(c)
@@ -16717,23 +16718,28 @@ function o(a, s, l) {
                     auth: this.isPublic ? null : u.authorizationHeader
                 }).done(function(e) {
                     window.data2 = e;
-                     
-                    for (var t in g_data2 = hotMatcher(e),
-                    this.hotsCount = 0,
-                    e.hots)
-                        this.hotsCount++,
-                        this.hots[t] = new M(t,e.hots[t],this);
-                        
-                        
-                        
-                    g_index = I.valueFromHash("m"),
-                    e.tourAudio && (g_tourAudio = new Audio,
-                    g_tourAudio.loop = !1,
-                    g_tourAudio.addEventListener("ended", function() {
-                        var e = document.createEvent("MouseEvent");
-                        e.initEvent("tourAudioEnded", !0, !0),
-                        window.dispatchEvent(e)
-                    }));
+                    if(!e){
+                        console.error("data2 is null") 
+                    }else{ 
+                        for (var t in g_data2 = hotMatcher(e),
+                        this.hotsCount = 0,
+                        e.hots)
+                            this.hotsCount++,
+                            this.hots[t] = new M(t,e.hots[t],this);
+                            
+                            
+                            
+                        g_index = I.valueFromHash("m"),
+                        e.tourAudio && (g_tourAudio = new Audio,
+                        g_tourAudio.loop = !1,
+                        g_tourAudio.addEventListener("ended", function() {
+                            var e = document.createEvent("MouseEvent");
+                            e.initEvent("tourAudioEnded", !0, !0),
+                            window.dispatchEvent(e)
+                        }));
+                        e.weixinDesc && (g_weixinObj.desc = e.weixinDesc) 
+                        //window.wx && manage.weixinShare(),
+                    }
                     var i = $.Deferred()
                       , n = g_Prefix + "data/" + this.sid + "/hot/js/data.js?" + randomTime().getTime();
                     a.get(n, {
@@ -16750,11 +16756,22 @@ function o(a, s, l) {
                         i.resolve()
                     }
                     .bind(this)).fail(function() {
-                        console.log("Data.js is empty"),
+                        console.log("Data.js is empty");
+                        //直接使用data2
+                        window.hotData = data2 
+                        this.createHotItem(data2, this.hots);
+                        
+                        for(let i in this.hots){
+                            data2[i] && this.hots[i].initStyleImg(e[i]);
+                        }
+                        
+                        
+                        
+                        
+                        
                         i.resolve()
                     }),
-                    e.weixinDesc && (g_weixinObj.desc = e.weixinDesc),
-                    //window.wx && manage.weixinShare(),
+                    
                     r.resolve()
                 }
                 .bind(this)).fail(function() {
@@ -28179,11 +28196,14 @@ function o(a, s, l) {
                             
                         } catch (e) {
                             h.warn(e.message)
+                            if(i.mode == "panorama" && !i.pano){
+                                i.pano = t.list[0] 
+                            }
                         }
                     }
                     if (e.outsideAllowed() || i.mode === l.PANORAMA || (i = {}),
                     i.mode === l.MESH && i.position && (i.mode = l.PANORAMA,
-                    i.pano = t.findClosest(i.position),
+                    i.pano = t.findClosest(i.position) ,
                     i.quaternion = i.pano.quaternion),
                     0 === Object.keys(i).length) {
                         var r = t.list[0];
@@ -28193,6 +28213,10 @@ function o(a, s, l) {
                         i.quaternion = r.quaternion,
                         h.info("Starting at 1st pano " + r.id))
                     }
+                    
+                    
+                    
+                    
                     return i.mode = i.mode || l.DOLLHOUSE,
                     i
                 }

+ 22 - 17
js/main_2020_show.js

@@ -17463,24 +17463,28 @@ window.Modernizr = function(n, e, t) {
                     auth: this.isPublic ? null : f.authorizationHeader
                 }).done(function(t) {
                     window.data2 = t;
-					g_data2 = hotMatcher(t);
-                    this.hotsCount = 0;
-					for(var i in t.hots){
-						this.hotsCount ++;
-                        this.hots[i] = new Hot(i, t.hots[i], this);  
-                        
-					};
-					g_index = w.valueFromHash("m");
-					if(t.tourAudio){
-						g_tourAudio = new Audio; 
-						g_tourAudio.loop = false;
-						g_tourAudio.addEventListener('ended', function () {  
-							var ev = document.createEvent("MouseEvent"); 
-							ev.initEvent("tourAudioEnded",true,true);
-							window.dispatchEvent(ev);
-						});
-                    };
                     
+                    if(!t){
+                        console.error("data2 is null") 
+                    }else{  
+                        g_data2 = hotMatcher(t);
+                        this.hotsCount = 0;
+                        for(var i in t.hots){
+                            this.hotsCount ++;
+                            this.hots[i] = new Hot(i, t.hots[i], this);  
+                            
+                        };
+                        g_index = w.valueFromHash("m");
+                        if(t.tourAudio){
+                            g_tourAudio = new Audio; 
+                            g_tourAudio.loop = false;
+                            g_tourAudio.addEventListener('ended', function () {  
+                                var ev = document.createEvent("MouseEvent"); 
+                                ev.initEvent("tourAudioEnded",true,true);
+                                window.dispatchEvent(ev);
+                            });
+                        };
+                    }
                     /***************************方奕卓 请求data.js数据, 用于初始化热点列表 ****************************/
                     var dataJsPromise = $.Deferred();
                     var dataJsUrl = g_Prefix+"data/" + this.sid + "/hot/js/data.js" +'?'+ randomTime().getTime();
@@ -29366,6 +29370,7 @@ window.Modernizr = function(n, e, t) {
                         i.mode !== h.PANORAMA && (i.floorVisibility = e.heroImage.metadata.floor_visibility))
                     } catch (e) {
                         d.warn(e.message)
+                        if(i.mode == "panorama" && !i.pano)i.pano = t.list[0]
                     }
                 }
                 if (e.outsideAllowed() || i.mode === h.PANORAMA || (i = {}),