Ver Fonte

feat: 添加setUrl消息处理及窗体创建功能

处理来自iframe的setUrl消息并创建对应的应用窗体,用于打开指定URL
lsc há 19 horas atrás
pai
commit
ea27a93613
1 ficheiros alterados com 14 adições e 0 exclusões
  1. 14 0
      js/Desktop/DeskTop.js

+ 14 - 0
js/Desktop/DeskTop.js

@@ -5687,6 +5687,9 @@ window.addEventListener('message', function (e) { // 監聽 message 事件
             _contentWindow = _iframe.contentWindow;
             _contentWindow.postMessage({ tools: "getLogin", type: type }, "*")
         }
+    } else if (e.data.tools && e.data.tools == "setUrl") {
+        let _data = e.data.data || {}
+        U.MD.D.I.openInApplication("setUrl", _data)
     }
 
 
@@ -6180,6 +6183,17 @@ U.MD.D.I.openInApplication = function (str, data, screenType, tType) {
                 closecallback: function () { }
             }, { "style": { "height": "36px" } }).form; //創建窗體
             break;
+        case "setUrl":
+            _formdiv = new U.UF.UI.form(
+                data.title,
+                $$("iframe", { "allow": "camera *; microphone *; display-capture; midi; encrypted-media; fullscreen; geolocation; clipboard-read; clipboard-write; accelerometer; autoplay; gyroscope; payment; picture-in-picture; usb; xr-spatial-tracking;", "webkitallowfullscreen": "", "mozallowfullscreen": "", "allowfullscreen": "", "frameborder": "no", "border": "0", "scrolling ": "no", "style": { "cssText": "border:0;width:100%;height:100%" }, "src": data.url }), {
+                "id": "setUrl" + data.id,
+                "style": { "width": "100%", "height": "100%", "overflow": 'hidden' },
+                "onresize": function () { }
+            }, {
+                closecallback: function () { }
+            }, { "style": { "height": "36px" } }).form; //创建窗体
+            break;   
     }
 }
 U.MD.D.I.openApplication = function (str, obj, info) {