Ver código fonte

3dModeling buildingCreate.js 张婷 commit at 2021-02-07

张婷 4 anos atrás
pai
commit
e17e57d432
1 arquivos alterados com 43 adições e 0 exclusões
  1. 43 0
      3dModeling/sgec111/buildingCreate.js

+ 43 - 0
3dModeling/sgec111/buildingCreate.js

@@ -529,3 +529,46 @@ function updateData(obj) {
         webSocket.onmessage = function (evt) {
             queryDeviceStatus(evt);
         };
+        webSocket.onclose = function (evt) {
+
+            webSocket = null;
+        }
+    }
+}
+
+//接收父级页面数据
+function userListener(data) {
+    
+    buildingStore = data.data;
+}
+
+// 监听用户页面传回的数据 并调用 ThingJS 页面方法
+window.addEventListener('message', function (e) {
+    var _this=this;
+    var array;
+    var data = e.data;
+    var funcName = data.funcName;
+    var param = data.param;
+    var company_code = e.data.param.company_code
+    // 调用 ThingJS 页面方法
+    window[funcName](param);
+    
+    //请求场景url的json文件
+    $.ajax({
+        type: "GET",
+        url:'/uploads/wechat/163607/file/杨浦16/park.json',
+        dataType: "json",
+        success: function (data) {
+            for(let i = 0; i < data.array.length; i++){
+                if(company_code === data.array[i].id){
+                    campusUrl = data.array[i]
+                    _this.changeScene(campusUrl);
+                    _this.createWidgets();
+                }
+            }
+        }
+    });
+});
+
+//父级页面数据处理
+function cleanObj(arr, key) {