11wqe1 5 月之前
父節點
當前提交
e26b367f2b
共有 1 個文件被更改,包括 75 次插入38 次删除
  1. 75 38
      src/components/components/choseWorksDetailDialog.vue

+ 75 - 38
src/components/components/choseWorksDetailDialog.vue

@@ -46,6 +46,11 @@
                     v-if="[7,1,3,49,57].indexOf(toolType) == -1" 
                     @click="submitWork">作业提交</el-button>
 
+                    <el-button type="primary" 
+                      size="small" 
+                      v-if="[57].includes(toolType)" 
+                    @click="upLoadCocoPi">作业提交</el-button>
+
                   </div>
                  
                   <span v-if="testData.toolDetail">{{ testData.toolDetail }}</span>
@@ -421,7 +426,7 @@
                   </div>
 
                   <div v-if="[57].includes(toolType)">
-										<iframe id="dialogFrame"
+										<iframe id="dialogFrame1"
     								  allow="camera *; microphone *;display-capture;midi;encrypted-media;"
     								  src="https://pi.cocorobo.cn/"
     								  ref="iframePiRef"
@@ -916,6 +921,7 @@ export default {
 			optionTypeList:['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
     };
   },
+
   computed: {
     tableData() {
       let _result = [];
@@ -1296,10 +1302,37 @@ export default {
       console.log('分组设置');
       
     },
+    // 提交Cocopi作业
+    upLoadCocoPi(){
+
+      let _iframe = this.$refs.iframePiRef;
+      let text = _iframe.contentWindow.getLoadXmlStr()
+      document.getElementById('loadLi_JieE').children[0].style.display = "block"
+      // addCourseWorks4-u2
+
+      let params = [{
+          uid:this.userId,
+          cid:this.courseId,
+          s:this.courseType,
+          task:this.taskCount,
+          t:this.toolIndex,
+          text:text.replaceAll(/%/g, "%25"),
+          type:15,
+          aTool: this.toolType,
+          text:text
+        }]
+
+        this.ajax.post(this.$store.state.api+"addCourseWorks4-u2",params).then(res=>{
+          this.$message.success('上传成功')
+        })
 
+
+    },
     // 截图类提交作业
     async captureScreenshot(){
       // this.$refs.iframeWhiteBoardRef.contentWindow;
+      document.getElementById('loadLi_JieE').children[0].style.display = "block"
+      
       let iframeWindow = ''
       let text = ''
       let str = ''
@@ -1575,7 +1608,7 @@ export default {
 				this.changeShowType(this.dialogTypeList.findIndex(i=>i.showType.includes(this.toolType)))
 			}
       this.setData();
-			if([3,1,7].includes(this.toolType)){ 
+			if([3,1,7,57].includes(this.toolType)){ 
         this.$nextTick(() => {
           this.getIframeWorksData();
         }); 
@@ -1678,8 +1711,8 @@ export default {
             ? this.testData.testJson.testJson
             : null;
 
-            console.log('this.testData',this.testData);
-            console.log('this.testJsonCopy',this.testJsonCopy);
+            // console.log('this.testData',this.testData);
+            // console.log('this.testJsonCopy',this.testJsonCopy);
           if (this.toolType == 45 ) { //选择题
             this.testJson.forEach(e=>{
               if (e.type == '2') {
@@ -1835,14 +1868,17 @@ export default {
 
         this.ajax.get(this.$store.state.api+"selectWord2",params).then(res=>{
           let _data = res.data[0]
-          console.log('_data',_data);
+          // console.log('_data',_data);
+          console.log('_data[0].text',_data[0].text)
+          console.log('JSON.parse(_data[0].text',JSON.parse(_data[0].text))
           
             // this.$nextTick(()=>{
-              // _iframe.onload = () =>{
+              let onloadListener = _iframe.onload = () =>{
                 console.log("思维导图iframe加载数据👈")
                 // iframe.contentWindow.editor.minder.importData('json', JSON.parse(xmlhttp.response)[0][0].text)
+                
                 if(_data[0]){
-                  _iframe.contentWindow.editor.minder.importData('json',JSON.parse(_data[0].text) )
+                  _iframe.contentWindow.editor.minder.importData('json',_data[0].text)
                 }
 
                 const scripts = [
@@ -1856,11 +1892,16 @@ export default {
                   script.src = src;
                   _iframe.contentWindow.document.body.appendChild(script);
                 });
-              // }
-            // })
+              }
+              if (onloadListener) {
+                  _iframe.contentDocument.location.reload()
+              } else {
+                  _iframe.contentDocument.location.reload()
+              }
+            // }) 
 
         })
-			}else if([1].includes(this.toolType)){ //电子白板
+			}else if([1].includes(this.toolType)){ //电子白板ok
         let params = {
           uid:this.userId,
           cid:this.courseId,
@@ -1876,9 +1917,8 @@ export default {
           let _data = res.data[0]
           console.log('_data',_data);
           
-            // this.$nextTick(()=>{
-              
-              // _iframe.onload = () =>{
+            // this.$nextTick(()=>{              
+              let onloadListener =  _iframe.onload = () =>{
                 console.log("电子白板iframe加载数据👈")
                 if(_data[0]){
                   _iframe.contentWindow.h.app.updateScene({elements:JSON.parse(_data[0].text)})
@@ -1897,36 +1937,33 @@ export default {
                   script.src = src;
                   _iframe.contentWindow.document.body.appendChild(script);
                 });
-
-                // if (scripts) {
-                //   _iframe.contentDocument.location.reload()
-                // } else {
-                //     _iframe.contentDocument.location.reload()
-                // }
-              // }
-              
+              }
+              if (onloadListener) {
+                _iframe.contentDocument.location.reload()
+              } else {
+                  _iframe.contentDocument.location.reload()
+              }
             // })
 
         })
 			}else if([57].includes(this.toolType)){
 
-        // let _iframe = this.$refs.iframeWhiteBoardRef;
-        // _iframe.onload = () =>{
-          console.log("CocoPiiframe加载数据👈")
-        //   // _iframe.contentWindow.h.app.updateScene({elements:JSON.parse(_data[0].text)})
-        //   const scripts = [
-        //     "https://cloud.cocorobo.cn/js/Common/jquery-3.6.0.min.js",
-        //     "https://cloud.cocorobo.cn/js/Common/aws-sdk-2.235.1.min.js",
-        //     "https://cloud.cocorobo.cn/js/Common/html2canvas.min.js",
-        //     "https://cloud.cocorobo.cn/js/Common/jietu2.js"
-        //   ];
-        //   scripts.forEach(src => {
-        //     const script = document.createElement("script");
-        //     script.src = src;
-        //     _iframe.contentWindow.document.body.appendChild(script);
-        //   });
-        // }
-			}else if([7].includes(this.toolType)){
+        let params = {
+          uid:this.userId,
+          cid:this.courseId,
+          s:this.courseType,
+          task:this.taskCount,
+          t:this.toolIndex,
+          type:"4"
+        }
+        let _iframe = this.$refs.iframePiRef;
+
+        this.ajax.get(this.$store.state.api+"selectWordsY",params).then(res=>{
+          let _data = res.data[0]
+          _iframe.contentWindow.loadingXml(JSON.parse(_data[0].text))
+
+        })
+			}else if([7].includes(this.toolType)){ //思维网格ok
         console.log("思维网格")
         let _iframe = this.$refs.iframeThoughtGridRef;
         _iframe.onload = () =>{