lsc 2 年之前
父节点
当前提交
7ae7f21a79
共有 2 个文件被更改,包括 18 次插入10 次删除
  1. 14 10
      js/jietu2.js
  2. 4 0
      js/jietu4.js

+ 14 - 10
js/jietu2.js

@@ -12,7 +12,7 @@
 //  _loading.appendChild(_lchild)
 //  document.body.appendChild(_loading)
 $jq = $
-var $180 = $.noConflict(); 
+var $180 = $.noConflict();
 function jietu_shishi(uid, cid, stage, task, tool) {
   html2canvas($jq("body")[0]).then(function (canvas) {
     //获取截取图片路径
@@ -78,7 +78,7 @@ function beforeUpload_shishi(nfile, uid, cid, stage, task, tool, loading, atool,
         //这里可以写进度条
         // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
       }).send(function (err, data) {
-        if(data){
+        if (data) {
           console.log(data.Location);
           var a = {
             name: file.name,
@@ -86,7 +86,7 @@ function beforeUpload_shishi(nfile, uid, cid, stage, task, tool, loading, atool,
             uid: file.uid,
           }
           addSWork_shishi(uid, cid, stage, task, tool, data.Location, loading, atool, text)
-        }else{
+        } else {
           var _a = document.getElementsByTagName("img")
           for (var i = 0; i < _a.length; i++) {
             _a[i].removeAttribute("crossorigin")
@@ -101,14 +101,14 @@ function beforeUpload_shishi(nfile, uid, cid, stage, task, tool, loading, atool,
           document.body.appendChild(_div)
           setTimeout(() => {
             document.body.removeChild(_div)
-          }, 1000);    
+          }, 1000);
         }
-        
+
       });
   }
 }
 
-function addSWork_shishi(uid, cid, stage, task, tool, a, loading,atool, text) {
+function addSWork_shishi(uid, cid, stage, task, tool, a, loading, atool, text) {
   let params = {
     uid: uid,
     cid: cid,
@@ -117,10 +117,14 @@ function addSWork_shishi(uid, cid, stage, task, tool, a, loading,atool, text) {
     tool: tool,
     content: a,
     type: 1,
-    atool:atool,
-    text:text
+    atool: atool,
+    text: text
     // upload: JSON.stringify(this.imgFileUp),
   };
+  if (!$jq) {
+    $jq = $
+    var $180 = $.noConflict();
+  }
   $jq.ajax({
     type: 'POST',
     url: 'https://pbl.cocorobo.cn/api/pbl/addCourseWorks4',
@@ -144,7 +148,7 @@ function addSWork_shishi(uid, cid, stage, task, tool, a, loading,atool, text) {
       }, 1000);
     },
     success: (data) => {
-      setTimeout(() =>{
+      setTimeout(() => {
         var _a = document.getElementsByTagName("img")
         for (var i = 0; i < _a.length; i++) {
           _a[i].removeAttribute("crossorigin")
@@ -162,7 +166,7 @@ function addSWork_shishi(uid, cid, stage, task, tool, a, loading,atool, text) {
           document.body.removeChild(_div)
         }, 1000);
         console.log("截图上传成功");
-      },3000)
+      }, 3000)
     }
   })
 }

+ 4 - 0
js/jietu4.js

@@ -108,6 +108,10 @@ function addSWork_shishi(uid, cid, stage, task, tool, a, loading, atool, text) {
     text: text
     // upload: JSON.stringify(this.imgFileUp),
   };
+  if (!$jq) {
+    $jq = $
+    var $180 = $.noConflict();
+  }
   $jq.ajax({
     type: 'POST',
     url: 'https://pbl.cocorobo.cn/api/pbl/addCourseWorks4s',