|
@@ -378,7 +378,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 思维网格 电子白板 思维导图 -->
|
|
|
- <div v-if="[7,1,3].includes(toolType)" class="s_b_m_b_i_m_iframe">
|
|
|
+ <div v-if="[7,1,3,57].includes(toolType)" class="s_b_m_b_i_m_iframe">
|
|
|
<div v-if="[7].includes(toolType)">
|
|
|
<iframe
|
|
|
allow="camera *; microphone *;display-capture;midi;encrypted-media;"
|
|
@@ -402,6 +402,14 @@
|
|
|
ref="iframeMainMapRef"
|
|
|
></iframe>
|
|
|
</div>
|
|
|
+
|
|
|
+ <div v-if="[57].includes(toolType)">
|
|
|
+ <iframe id="dialogFrame"
|
|
|
+ allow="camera *; microphone *;display-capture;midi;encrypted-media;"
|
|
|
+ src="https://pi.cocorobo.cn/"
|
|
|
+ ref="iframeMainMapRef"
|
|
|
+ ></iframe>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<!-- 学生分组 -->
|
|
|
<div v-if="[49].includes(toolType)" class="s_b_m_b_i_m_evaluation">
|
|
@@ -862,12 +870,13 @@ export default {
|
|
|
worksPreview: false
|
|
|
},
|
|
|
dialogTypeList: [
|
|
|
- { label: "作业详细", value: 0,showType:[1,7,15,40,41,45,47,48,49,52,3,4], loading: false },
|
|
|
+ { label: "作业详细", value: 0,showType:[1,7,15,40,41,45,47,48,49,52,3,4,57], loading: false },
|
|
|
{ label: "题目统计", value: 1,showType:[45,15], loading: false },
|
|
|
- { label: "学生统计", value: 2,showType:[1,7,15,40,41,45,47,48,52,3,4], loading: false }
|
|
|
+ { label: "学生统计", value: 2,showType:[1,7,15,40,41,45,47,48,52,3,4,57], loading: false }
|
|
|
],
|
|
|
toolList:[
|
|
|
{label:"选择题",value:45,img:require("../../assets/icon/thirdToolList/choose.png")},
|
|
|
+ {label:"CocoPi",value:57,img:require("../../assets/icon/fourthToolList/cocopi.png")},
|
|
|
{label:"问卷调查",value:4,img:require("../../assets/icon/thirdToolList/ask.png")},
|
|
|
{label:"思维导图",value:3,img:require("../../assets/icon/secondToolList/mindMapping.png")},
|
|
|
{label:"表格",value:48,img:require("../../assets/icon/fourthToolList/table.png")},
|
|
@@ -1281,6 +1290,9 @@ export default {
|
|
|
}else if (this.toolType == 3) {//思维导图
|
|
|
str = 'mind'
|
|
|
iframeWindow = this.$refs.iframeMainMapRef.contentWindow;
|
|
|
+ }else if (this.toolType == 57) {//CocoPi
|
|
|
+ str = 'CocoPi'
|
|
|
+ iframeWindow = this.$refs.iframeMainMapRef.contentWindow;
|
|
|
}
|
|
|
console.log('iframeWindow',iframeWindow);
|
|
|
|
|
@@ -1293,6 +1305,29 @@ export default {
|
|
|
|
|
|
console.log('text',text);
|
|
|
|
|
|
+ // const script = document.createElement("script");
|
|
|
+ // script.type = "text/javascript";
|
|
|
+ // script.charset = "UTF-8";
|
|
|
+ // script.src = "https://cloud.cocorobo.cn/js/Common/html2canvas.min.js";
|
|
|
+ // script.onload = () => {
|
|
|
+ // const images = document.getElementsByTagName("img");
|
|
|
+ // for (let i = 0; i < images.length; i++) {
|
|
|
+ // images[i].crossOrigin = "anonymous";
|
|
|
+ // }
|
|
|
+ // html2canvas(document.body, {
|
|
|
+ // allowTaint: true,
|
|
|
+ // useCORS: true,
|
|
|
+ // height: document.body.scrollHeight,
|
|
|
+ // windowHeight: document.body.scrollHeight,
|
|
|
+ // }).then(canvas => {
|
|
|
+ // const base64Url = canvas.toDataURL("image/png");
|
|
|
+ // const base64 = `<img src="${base64Url}" />`;
|
|
|
+ // const file = this.dataURLtoFile_shishi(base64Url, "截图");
|
|
|
+ // this.beforeUpload_shishi(file, this.userId, this.courseId, this.courseType, this.taskCount, this.toolType, `${str}_loadLi_JieE${this.courseId}${this.courseType}${this.taskCount}${this.toolType}${this.userId}`, this.toolType, text);
|
|
|
+ // });
|
|
|
+ // };
|
|
|
+ // document.head.appendChild(script);
|
|
|
+ // iframeWindow.document.head.appendChild(_ajs);
|
|
|
|
|
|
var _ajs = iframeWindow.document.createElement("script");
|
|
|
_ajs.type = "text/javascript";
|
|
@@ -1308,8 +1343,8 @@ export default {
|
|
|
" html2canvas(document.body,{allowTaint: true,useCORS: true,height: document.body.scrollHeight,windowHeight: document.body.scrollHeight}).then(canvas => {\n" +
|
|
|
' var base64Url = canvas.toDataURL("image/png");\n' +
|
|
|
'var base64 = "<img src=" + base64Url + " />"\n' +
|
|
|
- 'var file = dataURLtoFile_shishi(base64Url, "截图")\n' +
|
|
|
- "beforeUpload_shishi(file," +
|
|
|
+ 'var file = this.dataURLtoFile_shishi(base64Url, "截图")\n' +
|
|
|
+ "this.beforeUpload_shishi(file," +
|
|
|
"'" +
|
|
|
this.userId +
|
|
|
"'" +
|
|
@@ -1362,6 +1397,72 @@ export default {
|
|
|
type: mime
|
|
|
});
|
|
|
},
|
|
|
+ // 上传截图
|
|
|
+ beforeUpload_shishi(nfile, uid, cid, stage, task, tool, loading, atool, text) {
|
|
|
+ // loading.style.display = 'flex'
|
|
|
+ // top.document.getElementById(loading);
|
|
|
+ // document.body.appendChild(_loading)
|
|
|
+ var file = nfile;
|
|
|
+ var credentials = {
|
|
|
+ accessKeyId: "AKIATLPEDU37QV5CHLMH",
|
|
|
+ secretAccessKey: "Q2SQw37HfolS7yeaR1Ndpy9Jl4E2YZKUuuy2muZR",
|
|
|
+ }; //秘钥形式的登录上传
|
|
|
+ window.AWS.config.update(credentials);
|
|
|
+ window.AWS.config.region = "cn-northwest-1"; //设置区域
|
|
|
+
|
|
|
+ var bucket = new window.AWS.S3({
|
|
|
+ params: {
|
|
|
+ Bucket: "ccrb"
|
|
|
+ }
|
|
|
+ }); //选择桶
|
|
|
+
|
|
|
+ if (file) {
|
|
|
+ var params = {
|
|
|
+ Key: file.name.split(".")[0] + new Date().getTime() + "." + "png",
|
|
|
+ ContentType: file.type,
|
|
|
+ Body: file,
|
|
|
+ "Access-Control-Allow-Credentials": "*",
|
|
|
+ ACL: "public-read",
|
|
|
+ }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
|
|
|
+ var options = {
|
|
|
+ partSize: 2048 * 1024 * 1024,
|
|
|
+ queueSize: 2,
|
|
|
+ leavePartsOnError: true,
|
|
|
+ };
|
|
|
+ bucket.upload(params, options)
|
|
|
+ .on("httpUploadProgress", function (evt) {
|
|
|
+ //这里可以写进度条
|
|
|
+ // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
|
|
|
+ }).send(function (err, data) {
|
|
|
+ if (data) {
|
|
|
+ console.log(data.Location);
|
|
|
+ var a = {
|
|
|
+ name: file.name,
|
|
|
+ url: data.Location,
|
|
|
+ uid: file.uid,
|
|
|
+ }
|
|
|
+ addSWork_shishi(uid, cid, stage, task, tool, data.Location, loading, atool, text)
|
|
|
+ } else {
|
|
|
+ var _a = document.getElementsByTagName("img")
|
|
|
+ for (var i = 0; i < _a.length; i++) {
|
|
|
+ _a[i].removeAttribute("crossorigin")
|
|
|
+ }
|
|
|
+ top.document.getElementById(loading).children[0].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)
|
|
|
+ document.body.appendChild(_div)
|
|
|
+ setTimeout(() => {
|
|
|
+ document.body.removeChild(_div)
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
// beforeUpload(event) {
|
|
|
|
|
|
// var file = event;
|
|
@@ -1949,8 +2050,40 @@ export default {
|
|
|
|
|
|
}
|
|
|
})
|
|
|
+ }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",
|
|
|
+ ];
|
|
|
+ scripts.forEach(src => {
|
|
|
+ const script = document.createElement("script");
|
|
|
+ script.src = src;
|
|
|
+ _iframe.contentWindow.document.body.appendChild(script);
|
|
|
+ });
|
|
|
+ }
|
|
|
}else if([7].includes(this.toolType)){
|
|
|
console.log("思维网格")
|
|
|
+ let _iframe = this.$refs.iframeWhiteBoardRef;
|
|
|
+ _iframe.onload = () =>{
|
|
|
+ console.log("思维网格iframe加载数据👈")
|
|
|
+ // _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",
|
|
|
+ ];
|
|
|
+ scripts.forEach(src => {
|
|
|
+ const script = document.createElement("script");
|
|
|
+ script.src = src;
|
|
|
+ _iframe.contentWindow.document.body.appendChild(script);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
}
|