|
|
@ -40,9 +40,6 @@ |
|
|
|
<span class="index">{{index+1}}.</span> |
|
|
|
<span class="index">{{index+1}}.</span> |
|
|
|
<div v-html="item.questionStem"></div> |
|
|
|
<div v-html="item.questionStem"></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="options"> |
|
|
|
|
|
|
|
<p v-for="(option,i) in item.options" :key="i">{{i}}.{{item.options[i]}}</p> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</li> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
</li> |
|
|
|
</li> |
|
|
@ -68,9 +65,6 @@ |
|
|
|
<span class="index">{{index+1}}.</span> |
|
|
|
<span class="index">{{index+1}}.</span> |
|
|
|
<div v-html="item.questionStem"></div> |
|
|
|
<div v-html="item.questionStem"></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="options"> |
|
|
|
|
|
|
|
<p v-for="(option,i) in item.options" :key="i">{{i}}.{{item.options[i]}}</p> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</li> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
</li> |
|
|
|
</li> |
|
|
@ -175,9 +169,9 @@ function getUrlBase64(url, ext, callback) { |
|
|
|
img.crossOrigin = 'Anonymous'; |
|
|
|
img.crossOrigin = 'Anonymous'; |
|
|
|
img.src = url; |
|
|
|
img.src = url; |
|
|
|
img.onload = function () { |
|
|
|
img.onload = function () { |
|
|
|
canvas.height = 60; //指定画板的高度,自定义 |
|
|
|
canvas.height = 300; //指定画板的高度,自定义 |
|
|
|
canvas.width = 85; //指定画板的宽度,自定义 |
|
|
|
canvas.width = 300; //指定画板的宽度,自定义 |
|
|
|
ctx.drawImage(img, 0, 0, 60, 85); //参数可自定义 |
|
|
|
ctx.drawImage(img, 0, 0, 300, 300); //参数可自定义 |
|
|
|
var dataURL = canvas.toDataURL("image/" + ext); |
|
|
|
var dataURL = canvas.toDataURL("image/" + ext); |
|
|
|
callback.call(this, dataURL); //回掉函数获取Base64编码 |
|
|
|
callback.call(this, dataURL); //回掉函数获取Base64编码 |
|
|
|
canvas = null; |
|
|
|
canvas = null; |
|
|
@ -327,8 +321,7 @@ export default { |
|
|
|
this.loading = true |
|
|
|
this.loading = true |
|
|
|
this.exportVisible = true |
|
|
|
this.exportVisible = true |
|
|
|
this.paperName = row.name |
|
|
|
this.paperName = row.name |
|
|
|
this.$post(`${this.api.previewtestPaper}?id=${row.id}`) |
|
|
|
this.$post(`${this.api.previewtestPaper}?id=${row.id}`).then(res => { |
|
|
|
.then(res => { |
|
|
|
|
|
|
|
let list = res.data |
|
|
|
let list = res.data |
|
|
|
let reg = /<img src=".*?">/gi |
|
|
|
let reg = /<img src=".*?">/gi |
|
|
|
let index = 0 |
|
|
|
let index = 0 |
|
|
@ -342,9 +335,10 @@ export default { |
|
|
|
list[i].map(n => { |
|
|
|
list[i].map(n => { |
|
|
|
let src = reg.exec(n.questionStem) |
|
|
|
let src = reg.exec(n.questionStem) |
|
|
|
if(src){ |
|
|
|
if(src){ |
|
|
|
|
|
|
|
console.log(11,src,src[0],reg.lastIndex) |
|
|
|
src = src[0].replace('<img src="','').replace('">','') |
|
|
|
src = src[0].replace('<img src="','').replace('">','') |
|
|
|
getUrlBase64(src, 'jpg', function (base64) { |
|
|
|
getUrlBase64(src, 'jpg', function (base64) { |
|
|
|
n.questionStem = n.questionStem.replace(reg,`<img src="${base64}">`) |
|
|
|
n.questionStem = n.questionStem.replace(reg,`<img width="300" src="${base64}">`) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
@ -355,7 +349,8 @@ export default { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$nextTick(() => { |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
html2Canvas(document.querySelector('#pdfDom'), { |
|
|
|
html2Canvas(document.querySelector('#pdfDom'), { |
|
|
|
allowTaint: true |
|
|
|
allowTaint: true, |
|
|
|
|
|
|
|
tainttest : true, |
|
|
|
}).then(canvas => { |
|
|
|
}).then(canvas => { |
|
|
|
let contentWidth = canvas.width |
|
|
|
let contentWidth = canvas.width |
|
|
|
let contentHeight = canvas.height |
|
|
|
let contentHeight = canvas.height |
|
|
|