|
@@ -1757,6 +1757,10 @@ window.addEventListener('message', function (e) { // 监听 message 事件
|
|
|
U.MD.D.I.openApplicationJieE("whiteboard", e.data.cid, e.data.stage, e.data.task, e.data.tool)
|
|
|
} else if (e.data.tools && e.data.tools == "3E") {
|
|
|
U.MD.D.I.openApplicationJieE("mind", e.data.cid, e.data.stage, e.data.task, e.data.tool)
|
|
|
+ } else if (e.data.tools && e.data.tools == "57u") {
|
|
|
+ U.MD.D.I.openApplicationUpload("CocoPi", e.data.cid, e.data.stage, e.data.task, e.data.tool)
|
|
|
+ } else if (e.data.tools && e.data.tools == "57u") {
|
|
|
+ U.MD.D.I.openApplicationTeacherUpload("CocoPi", e.data.cid, e.data.stage, e.data.task, e.data.tool, e.data.student)
|
|
|
}
|
|
|
|
|
|
});
|
|
@@ -6460,4 +6464,148 @@ U.MD.D.I.setContents = function (cid, s, task, t, uid, type, text, loading, span
|
|
|
// 设置请求头,表示请求体的编码格式
|
|
|
xmlhttp.send("uid=" + uid + "&cid=" + cid + "&s=" + s + "&task=" + task + "&t=" + t + "&text=" + text + "&type=" + type);
|
|
|
// 设置请求体,使用url-encoded格式的数据
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+U.MD.D.I.openApplicationUpload = function (str, cid, stage, task, tool) {
|
|
|
+ var _taskbar, //_taskbar 作为任务栏显示的元素,包含图标和名字
|
|
|
+ _formdiv, //创建任务栏时同时弹出的窗体元素。
|
|
|
+ _userinfo = US.userInfo, //登录用户信息
|
|
|
+ _userid = US.userInfo.userid //登录用户id
|
|
|
+ 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",
|
|
|
+ _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, _iframe)
|
|
|
+ })
|
|
|
+ if (onloadListener) {
|
|
|
+ _iframe.contentDocument.location.reload()
|
|
|
+ } else {
|
|
|
+ _iframe.contentDocument.location.reload()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _jie.onclick = async () => {
|
|
|
+ let text = ''
|
|
|
+ if (aTool == 57) {
|
|
|
+ text = _iframe.contentWindow.$("#U_MD_O_H_wordEditor")[0].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)
|
|
|
+ contentWindow.window.document.body.appendChild(_div)
|
|
|
+ _div.onclick = () => {
|
|
|
+ contentWindow.window.document.body.removeChild(_div)
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ contentWindow.window.document.body.removeChild(_div)
|
|
|
+ }, 1000);
|
|
|
+ }, [], { "type": "GET", "withCredentials": true });
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+U.MD.D.I.getUploadContent = function (cid, s, task, t, uid, type, iframe) {
|
|
|
+ U.A.Request(US.Config.pbl + "selectWord2?uid=" + uid + "&cid=" + cid + "&s=" + s + "&task=" + task + "&t=" + t + "&type=" + type, [], function (res) {
|
|
|
+ if (res.value[0].length > 0) {
|
|
|
+ // resolve(res.value[0][0].text);
|
|
|
+ iframe.loadingXml(res.value[0][0].text)
|
|
|
+ }
|
|
|
+ }, [], { "type": "GET", "withCredentials": true });
|
|
|
}
|