lsc преди 1 година
родител
ревизия
948fa0c700
променени са 1 файла, в които са добавени 133 реда и са изтрити 1 реда
  1. 133 1
      js/Desktop/DeskTop.js

+ 133 - 1
js/Desktop/DeskTop.js

@@ -6600,6 +6600,138 @@ U.MD.D.I.openApplicationUpload = function (str, cid, stage, task, tool) {
     }
 }
 
+U.MD.D.I.openApplicationTeacherUpload = function (str, cid, stage, task, tool, student) {
+    var _taskbar, //_taskbar 作为任务栏显示的元素,包含图标和名字
+        _formdiv, //创建任务栏时同时弹出的窗体元素。
+        _userid = student.userid, //登录用户id
+        _username = student.student //用户名字
+    let _iframe;
+    let _cid = cid,
+        _stage = stage,
+        _task = task,
+        _tool = tool;
+    var _jie = $$("div", {
+        "style": {
+            "position": "absolute",
+            "bottom": "50px",
+            "right": "50px",
+            "zIndex": "9999",
+            "backgroundColor": "#2268bc",
+            "color": "#fff",
+            "padding": "12px 20px",
+            "cursor": "pointer",
+            "borderRadius": "4px",
+        },
+        "innerHTML": "提交作业"
+    })
+    let aTool = ''
+    let _loading = document.createElement('div')
+    _loading.style = "width:100%;height:100%;background:#00000000;position:absolute;top:0;left:0;z-index:99999999999999;display: none;justify-content: center;align-items: center;"
+    //  _loading.id = "";
+    let _lchild = document.createElement('div')
+    let _limg = document.createElement('img')
+    _limg.src = US.Config.bpbl + '/pbl-student-table/dist/js/loading.gif'
+    _limg.style = "width: 26px;margin-right: 10px;"
+    _lchild.appendChild(_limg)
+    let _lspan = document.createElement('span')
+    _lspan.innerHTML = "上传中..."
+    _lchild.appendChild(_lspan)
+    _lchild.style = "color: rgb(255, 255, 255);padding: 15px;background: rgba(0, 0, 0, 0.44);font-size: 18px;display: flex;align-items: center;position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);"
+    _loading.appendChild(_lchild)
+    var _box = $$('div', {
+        "style": {
+            "position": "relative",
+            "width": "100%",
+            "height": "100%",
+        },
+    })
+    _box.appendChild(_loading)
+    _box.id = str + '_loadLi'
+    switch (str) {
+        case "CocoPi":
+            aTool = 57;
+            _iframe = $$("iframe", {
+                "frameborder": "no",
+                "border": "0",
+                "scrolling ": "no",
+                "style": {
+                    "cssText": "border:0;width:100%;height:100%"
+                },
+                "src": "https://beta.v.cocorobo.cn/"
+            })
+            _box.appendChild(_iframe);
+            _box.appendChild(_jie);
+            _formdiv = new U.UF.UI.form(
+                "CocoPi" + _username,
+                _box, {
+                "id": "CocoPi" + cid + stage + task + tool,
+                "style": {
+                    "width": "90%",
+                    "height": "90%",
+                    "overflow": 'hidden'
+                },
+                "onresize": function () { }
+            }, {
+                closecallback: function () { }
+            }, {
+                "style": {
+                    "height": "36px"
+                }
+            }).form; //创建窗体
+            _taskbar = {
+                "id": str + _formdiv.id,
+                "style": {
+                    "backgroundImage": "url(/img/icon/cocopi.png)"
+                },
+                "name": "CocoPi",
+                "forms": _formdiv,
+                "click": function () {
+                    U.MD.D.I.openApplication(str, obj, info);
+                }
+            }
+            break;
+    }
+
+
+    if (_iframe) {
+        if (str == 'CocoPi') {
+            _iframe = _formdiv.querySelector('iframe')
+            let onloadListener = U.UF.DL.iframeLoad(_iframe, function () {
+                U.MD.D.I.getUploadContent(cid, stage, task, tool, _userid, aTool,'15', _iframe)
+            })
+            if (onloadListener) {
+                _iframe.contentDocument.location.reload()
+            } else {
+                _iframe.contentDocument.location.reload()
+            }
+        }
+        _jie.onclick = async () => {
+            let text = ''
+             if (aTool == 57) {
+                text = _iframe.contentWindow.getLoadXmlStr()
+            }
+
+            _loading.style.display = 'flex'
+            console.log(_loading);
+            U.A.Request(US.Config.pbl + "addCourseWorks4-u", [_userid, _cid, _stage, _task, _tool, text.replaceAll(/%/g, "%25"), 15, aTool, text], function (res) {
+                _loading.style.display = 'none'
+                let _div = document.createElement('div')
+                _div.style = "width:100%;height:100%;background:#0000008f;position:fixed;top:0;left:0;z-index:99999999999999;display: flex;justify-content: center;align-items: center;"
+                let _inner = document.createElement('div')
+                _inner.style = "color: #fff;padding: 15px;background: #00000070;border-radius: 5px;font-size: 18px;"
+                _inner.innerHTML = "截图上传成功"
+                _div.appendChild(_inner)
+                _iframe.contentWindow.window.document.body.appendChild(_div)
+                _div.onclick = () => {
+                    _iframe.contentWindow.window.document.body.removeChild(_div)
+                }
+                setTimeout(() => {
+                    _iframe.contentWindow.window.document.body.removeChild(_div)
+                }, 1000);
+            }, [], { "type": "POST", "withCredentials": true });
+        }
+    }
+}
 
 U.MD.D.I.getUploadContent = function (cid, s, task, t, uid, atool, type, iframe) {
     U.A.Request(US.Config.pbl + "selectWorksDetail2u", [uid, cid, s, task, t, type, atool], function (res) {
@@ -6609,7 +6741,7 @@ U.MD.D.I.getUploadContent = function (cid, s, task, t, uid, atool, type, iframe)
                 }
             } else {
                 if (atool == 57) {
-                    iframe.contentWindow.loadingXml()
+                    iframe.blockpy.components.editor.blockly.clear();
                 }
             }
         }, [], { "type": "POST", "withCredentials": true });