|
@@ -35,15 +35,17 @@
|
|
|
<img :src="toolList.find(item=>item.value===toolType).img" alt/>
|
|
|
<span>{{ toolList.find(item=>item.value===toolType).label }}</span>
|
|
|
</div>
|
|
|
+
|
|
|
<el-button type="primary"
|
|
|
size="small"
|
|
|
- v-if="[7,1,3,57].includes(toolType)"
|
|
|
+ v-if="[7,1,3].includes(toolType)"
|
|
|
@click="captureScreenshot">作业提交</el-button>
|
|
|
-
|
|
|
+
|
|
|
<el-button type="primary"
|
|
|
size="small"
|
|
|
v-if="[7,1,3,49,57].indexOf(toolType) == -1"
|
|
|
@click="submitWork">作业提交</el-button>
|
|
|
+
|
|
|
</div>
|
|
|
|
|
|
<span v-if="testData.toolDetail">{{ testData.toolDetail }}</span>
|
|
@@ -378,7 +380,22 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 思维网格 电子白板 思维导图 -->
|
|
|
- <div v-if="[7,1,3,57].includes(toolType)" class="s_b_m_b_i_m_iframe">
|
|
|
+ <div id="loadLi_JieE" v-if="[7,1,3,57].includes(toolType)" style="position: relative; " class="s_b_m_b_i_m_iframe">
|
|
|
+ <div style="display: none;">
|
|
|
+ <div 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%;
|
|
|
+ justify-content: center;
|
|
|
+ transform: translate(-50%, -50%);">
|
|
|
+ <img src="//beta.pbl.cocorobo.cn/pbl-student-table/dist/js/loading.gif"
|
|
|
+ style="width: 26px; margin-right: 10px;">
|
|
|
+ <span>上传中...</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
<div v-if="[7].includes(toolType)">
|
|
|
<iframe
|
|
|
allow="camera *; microphone *;display-capture;midi;encrypted-media;"
|
|
@@ -1279,33 +1296,35 @@ export default {
|
|
|
console.log('分组设置');
|
|
|
|
|
|
},
|
|
|
+
|
|
|
// 截图类提交作业
|
|
|
async captureScreenshot(){
|
|
|
// this.$refs.iframeWhiteBoardRef.contentWindow;
|
|
|
let iframeWindow = ''
|
|
|
+ let text = ''
|
|
|
let str = ''
|
|
|
+
|
|
|
if (this.toolType == 7) { //思维网格
|
|
|
- // str = 'mindNetwork'
|
|
|
+ str = 'mindNetwork'
|
|
|
iframeWindow = this.$refs.iframeThoughtGridRef.contentWindow;
|
|
|
}else if (this.toolType == 1) {//电子白板
|
|
|
- // str = 'whiteboard'
|
|
|
+ str = 'whiteboard'
|
|
|
iframeWindow = this.$refs.iframeWhiteBoardRef.contentWindow;
|
|
|
}else if (this.toolType == 3) {//思维导图
|
|
|
- // str = 'mind'
|
|
|
+ str = 'mind'
|
|
|
iframeWindow = this.$refs.iframeMainMapRef.contentWindow;
|
|
|
}else if (this.toolType == 57) {//CocoPi
|
|
|
- // str = 'CocoPi'
|
|
|
+ str = 'CocoPi'
|
|
|
iframeWindow = this.$refs.iframePiRef.contentWindow;
|
|
|
}
|
|
|
console.log('iframeWindow',iframeWindow);
|
|
|
|
|
|
- let text = ''
|
|
|
+
|
|
|
if (this.toolType == 1) {
|
|
|
text = JSON.stringify(iframeWindow.h.app.scene.elements)
|
|
|
} else if (this.toolType == 3) {
|
|
|
- text = iframeWindow.$("#U_MD_O_H_wordEditor")[0].innerHTML.escapeQuotes()
|
|
|
- }
|
|
|
-
|
|
|
+ text = await this.getEditorContent(iframeWindow);
|
|
|
+ }
|
|
|
console.log('text',text);
|
|
|
|
|
|
// const script = document.createElement("script");
|
|
@@ -1337,10 +1356,12 @@ export default {
|
|
|
_ajs.innerHTML =
|
|
|
// 'console.log(' + _loading + ');\n' +
|
|
|
'var _js = document.createElement("script");\n' +
|
|
|
+ 'console.log(_js);\n' +
|
|
|
'_js.type="text/javascript";\n' +
|
|
|
'_js.charset="UTF-8";\n' +
|
|
|
'_js.src="https://cloud.cocorobo.cn/js/Common/html2canvas.min.js";\n' +
|
|
|
"_js.onload = function(){\n" +
|
|
|
+ 'console.log(_js);\n' +
|
|
|
' var a = document.getElementsByTagName("img")\n' +
|
|
|
' for(var i = 0;i<a.length;i++){a[i].crossOrigin="anonymous"}\n' +
|
|
|
" html2canvas(document.body,{allowTaint: true,useCORS: true,height: document.body.scrollHeight,windowHeight: document.body.scrollHeight}).then(canvas => {\n" +
|
|
@@ -1369,7 +1390,7 @@ export default {
|
|
|
"'" +
|
|
|
", " +
|
|
|
"'" +
|
|
|
- (str + '_loadLi_JieE' + this.courseId + this.courseType + this.taskCount + this.toolIndex + this.userId) +
|
|
|
+ ('loadLi_JieE') +
|
|
|
"'" +
|
|
|
", " +
|
|
|
"'" +
|
|
@@ -1382,11 +1403,18 @@ export default {
|
|
|
")\n" +
|
|
|
" });\n" +
|
|
|
"}\n" +
|
|
|
+ 'console.log(_js);\n' +
|
|
|
"document.head.appendChild(_js);\n";
|
|
|
iframeWindow.document.head.appendChild(_ajs);
|
|
|
- console.log('66666');
|
|
|
},
|
|
|
-
|
|
|
+ getEditorContent(iframe) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ iframe.editor.minder.exportData('json').then(function (content) {
|
|
|
+ console.log(content);
|
|
|
+ resolve(content)
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
// 提交作业
|
|
|
submitWork(){
|
|
|
// 选择题提交
|
|
@@ -1815,7 +1843,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
getIframeWorksData(){
|
|
|
- if([3].includes(this.toolType)){
|
|
|
+ if([3].includes(this.toolType)){ //思维导图
|
|
|
let params = {
|
|
|
uid:this.userId,
|
|
|
cid:this.courseId,
|
|
@@ -1831,7 +1859,9 @@ export default {
|
|
|
let _iframe = this.$refs.iframeMainMapRef;
|
|
|
_iframe.onload = () =>{
|
|
|
console.log("思维导图iframe加载数据👈")
|
|
|
- _iframe.contentWindow.editor.minder.importData("json",_data[0].text)
|
|
|
+ // iframe.contentWindow.editor.minder.importData('json', JSON.parse(xmlhttp.response)[0][0].text)
|
|
|
+
|
|
|
+ _iframe.contentWindow.editor.minder.importData("json", 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",
|
|
@@ -1848,7 +1878,7 @@ export default {
|
|
|
|
|
|
}
|
|
|
})
|
|
|
- }else if([1].includes(this.toolType)){
|
|
|
+ }else if([1].includes(this.toolType)){ //电子白板
|
|
|
let params = {
|
|
|
uid:this.userId,
|
|
|
cid:this.courseId,
|
|
@@ -1857,14 +1887,20 @@ export default {
|
|
|
t:this.toolIndex,
|
|
|
type:"3"
|
|
|
}
|
|
|
+ console.log('电子白板params',params);
|
|
|
+
|
|
|
|
|
|
this.ajax.get(this.$store.state.api+"selectWord2",params).then(res=>{
|
|
|
let _data = res.data[0]
|
|
|
+ console.log('_data',_data);
|
|
|
+
|
|
|
if(_data[0]){
|
|
|
this.$nextTick(()=>{
|
|
|
let _iframe = this.$refs.iframeWhiteBoardRef;
|
|
|
_iframe.onload = () =>{
|
|
|
console.log("电子白板iframe加载数据👈")
|
|
|
+ // iframe.contentWindow.h.app.updateScene({ elements: JSON.parse(JSON.parse(xmlhttp.response)[0][0].text) })
|
|
|
+
|
|
|
_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",
|
|
@@ -1902,7 +1938,7 @@ export default {
|
|
|
// }
|
|
|
}else if([7].includes(this.toolType)){
|
|
|
console.log("思维网格")
|
|
|
- let _iframe = this.$refs.iframeWhiteBoardRef;
|
|
|
+ let _iframe = this.$refs.iframeThoughtGridRef;
|
|
|
_iframe.onload = () =>{
|
|
|
console.log("思维网格iframe加载数据👈")
|
|
|
// _iframe.contentWindow.h.app.updateScene({elements:JSON.parse(_data[0].text)})
|