|
@@ -1142,9 +1142,36 @@ export default {
|
|
|
iframeIh.innerHTML = this.iframeInnerHtml;
|
|
|
this.$forceUpdate();
|
|
|
console.log(iframeIh);
|
|
|
+
|
|
|
// var iframeHtml = this.$refs.whiteBoard;
|
|
|
|
|
|
- iframeHtml.contentWindow.jietu_shishi(this.userid, this.cid);
|
|
|
+ var _ajs = iframeHtml.contentWindow.document.createElement("script");
|
|
|
+ _ajs.type = "text/javascript";
|
|
|
+ _ajs.innerHTML =
|
|
|
+ 'var _js = document.createElement("script");\n' +
|
|
|
+ '_js.type="text/javascript";\n' +
|
|
|
+ '_js.src="https://html2canvas.hertzen.com/dist/html2canvas.min.js";\n' +
|
|
|
+ "_js.onload = function(){\n" +
|
|
|
+ " html2canvas(document.body).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," +
|
|
|
+ "'" +
|
|
|
+ this.userid +
|
|
|
+ "'" +
|
|
|
+ ", " +
|
|
|
+ "'" +
|
|
|
+ this.cid +
|
|
|
+ "'" +
|
|
|
+ ")\n" +
|
|
|
+ " });\n" +
|
|
|
+ "}\n" +
|
|
|
+ "document.head.appendChild(_js);\n";
|
|
|
+ iframeHtml.contentWindow.document.head.appendChild(_ajs);
|
|
|
+
|
|
|
+ // iframeHtml.contentWindow.jietu_shishi(this.userid, this.cid);
|
|
|
+
|
|
|
// 第一个参数是需要生成截图的元素,第二个是自己需要配置的参数,宽高等
|
|
|
// html2canvas(iframeBody, {
|
|
|
// allowTaint: true,
|
|
@@ -1257,74 +1284,43 @@ export default {
|
|
|
checkTools(tcount) {
|
|
|
this.isBlock = 2;
|
|
|
this.toolCount = tcount;
|
|
|
- this.$forceUpdate();
|
|
|
let _this = this;
|
|
|
_this.$nextTick(() => {
|
|
|
setTimeout(() => {
|
|
|
+ const script1 = document.createElement("script");
|
|
|
+ script1.type = "text/javascript";
|
|
|
+ script1.src =
|
|
|
+ "https://pbl.cocorobo.cn/pbl-student-table/dist/jquery-3.6.0.min.js";
|
|
|
+ const script2 = document.createElement("script");
|
|
|
+ script2.type = "text/javascript";
|
|
|
+ script2.src =
|
|
|
+ "https://pbl.cocorobo.cn/pbl-student-table/dist/aws-sdk-2.235.1.min.js";
|
|
|
+ const script3 = document.createElement("script");
|
|
|
+ script3.type = "text/javascript";
|
|
|
+ script3.src = "https://html2canvas.hertzen.com/dist/html2canvas.min.js";
|
|
|
+ const script4 = document.createElement("script");
|
|
|
+ script4.type = "text/javascript";
|
|
|
+ script4.src = "https://pbl.cocorobo.cn/pbl-student-table/dist/jietu.js";
|
|
|
+
|
|
|
if (_this.toolCount == 1) {
|
|
|
- const script1 = document.createElement("script");
|
|
|
- script1.type = "text/javascript";
|
|
|
- script1.src =
|
|
|
- "https://pbl.cocorobo.cn/pbl-student-table/dist/jquery-3.6.0.min.js";
|
|
|
- const script2 = document.createElement("script");
|
|
|
- script2.type = "text/javascript";
|
|
|
- script2.src =
|
|
|
- "https://pbl.cocorobo.cn/pbl-student-table/dist/aws-sdk-2.235.1.min.js";
|
|
|
- const script3 = document.createElement("script");
|
|
|
- script3.type = "text/javascript";
|
|
|
- script3.src =
|
|
|
- "https://pbl.cocorobo.cn/pbl-student-table/dist/html2canvas.min.js";
|
|
|
- const script4 = document.createElement("script");
|
|
|
- script4.type = "text/javascript";
|
|
|
- script4.src = "https://pbl.cocorobo.cn/pbl-student-table/dist/jietu.js";
|
|
|
_this.$refs.whiteBoard.onload = () => {
|
|
|
_this.$refs.whiteBoard.contentWindow.document.body.appendChild(script1);
|
|
|
_this.$refs.whiteBoard.contentWindow.document.body.appendChild(script2);
|
|
|
- _this.$refs.whiteBoard.contentWindow.document.body.appendChild(script3);
|
|
|
+ // _this.$refs.whiteBoard.contentWindow.document.body.appendChild(script3);
|
|
|
_this.$refs.whiteBoard.contentWindow.document.body.appendChild(script4);
|
|
|
};
|
|
|
} else if (_this.toolCount == 3) {
|
|
|
- const script1 = document.createElement("script");
|
|
|
- script1.type = "text/javascript";
|
|
|
- script1.src =
|
|
|
- "https://pbl.cocorobo.cn/pbl-student-table/dist/jquery-3.6.0.min.js";
|
|
|
- const script2 = document.createElement("script");
|
|
|
- script2.type = "text/javascript";
|
|
|
- script2.src =
|
|
|
- "https://pbl.cocorobo.cn/pbl-student-table/dist/aws-sdk-2.235.1.min.js";
|
|
|
- const script3 = document.createElement("script");
|
|
|
- script3.type = "text/javascript";
|
|
|
- script3.src =
|
|
|
- "https://pbl.cocorobo.cn/pbl-student-table/dist/html2canvas.min.js";
|
|
|
- const script4 = document.createElement("script");
|
|
|
- script4.type = "text/javascript";
|
|
|
- script4.src = "https://pbl.cocorobo.cn/pbl-student-table/dist/jietu.js";
|
|
|
_this.$refs.mind.onload = () => {
|
|
|
_this.$refs.mind.contentWindow.document.body.appendChild(script1);
|
|
|
_this.$refs.mind.contentWindow.document.body.appendChild(script2);
|
|
|
- _this.$refs.mind.contentWindow.document.body.appendChild(script3);
|
|
|
+ // _this.$refs.mind.contentWindow.document.body.appendChild(script3);
|
|
|
_this.$refs.mind.contentWindow.document.body.appendChild(script4);
|
|
|
};
|
|
|
} else if (_this.toolCount == 7) {
|
|
|
- const script1 = document.createElement("script");
|
|
|
- script1.type = "text/javascript";
|
|
|
- script1.src =
|
|
|
- "https://pbl.cocorobo.cn/pbl-student-table/dist/jquery-3.6.0.min.js";
|
|
|
- const script2 = document.createElement("script");
|
|
|
- script2.type = "text/javascript";
|
|
|
- script2.src =
|
|
|
- "https://pbl.cocorobo.cn/pbl-student-table/dist/aws-sdk-2.235.1.min.js";
|
|
|
- const script3 = document.createElement("script");
|
|
|
- script3.type = "text/javascript";
|
|
|
- script3.src =
|
|
|
- "https://pbl.cocorobo.cn/pbl-student-table/dist/html2canvas.min.js";
|
|
|
- const script4 = document.createElement("script");
|
|
|
- script4.type = "text/javascript";
|
|
|
- script4.src = "https://pbl.cocorobo.cn/pbl-student-table/dist/jietu.js";
|
|
|
_this.$refs.grid.onload = () => {
|
|
|
_this.$refs.grid.contentWindow.document.body.appendChild(script1);
|
|
|
_this.$refs.grid.contentWindow.document.body.appendChild(script2);
|
|
|
- _this.$refs.grid.contentWindow.document.body.appendChild(script3);
|
|
|
+ // _this.$refs.grid.contentWindow.document.body.appendChild(script3);
|
|
|
_this.$refs.grid.contentWindow.document.body.appendChild(script4);
|
|
|
};
|
|
|
}
|
|
@@ -1335,6 +1331,7 @@ export default {
|
|
|
beforeDestroy() {
|
|
|
clearInterval(this.timer);
|
|
|
this.timer = null;
|
|
|
+ // window.removeEventListener("message");
|
|
|
},
|
|
|
created() {
|
|
|
// this.selectSWork();
|
|
@@ -1342,6 +1339,12 @@ export default {
|
|
|
this.timer = setInterval(() => {
|
|
|
_this.setPage();
|
|
|
}, 1000);
|
|
|
+ // window.addEventListener("message", function (e) {
|
|
|
+ // // 监听 message 事件
|
|
|
+ // if (e.data.type && e.data.type == "shishi_canvas") {
|
|
|
+ // console.log(e.data.data);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
},
|
|
|
};
|
|
|
</script>
|