0525bugFixed

This commit is contained in:
shijing 2022-05-25 16:40:48 +08:00
parent 274503442f
commit be095ce94f
1 changed files with 263 additions and 250 deletions

View File

@ -133,7 +133,7 @@
<el-row v-show="hasPicture">
<el-form-item label="图表">
<div>
<img id="canvasImg" :src="img" style="width:500px;height: 300px;position: absolute;top: -1000px;">
<img id="canvasImg" :src="img" alt="tupian">
<div style="position: relative;display: flex;flex-direction: column;
border: 1px solid #DCDFE6;">
<canvas id="canvas" width="500" height="300">
@ -170,6 +170,7 @@
<script>
import {upFile} from "@/api/file";
let preDrawAry = [];
export default {
name: "index",
@ -178,7 +179,8 @@
type: Array,
default: () => {
return []
}} ,
}
},
formID: {
type: Number,
default: 0
@ -244,11 +246,11 @@
if (imag.length > 0) {
that.img = new Image();
that.img.crossOrigin = 'anonymous';
let value = imag[0].field_value?imag[0].field_value:imag[0].draw_template;
that.img = value;
let value = imag[0].field_value!==null ? imag[0].field_value : imag[0].draw_template;
that.img =process.env.VUE_APP_BASE_API.replace('/api','')+ value;
setTimeout(function () {
that.canvasInit();
},500);
}, 1000);
}
},
data() {
@ -434,10 +436,10 @@
},
//画布添加背景模板图
draw() {
debugger;
this.ctx = document.getElementById('canvas').getContext('2d');
let canvasImg = document.getElementById("canvasImg");
canvasImg.setAttribute("crossOrigin",'anonymous');
// canvasImg.style.width = '500px';
// canvasImg.style.height = '300px';
// canvasImg.setAttribute("crossOrigin", 'anonymous');
this.ctx.drawImage(canvasImg, 0, 0, 500, 300);
},
// 叉号
@ -757,6 +759,7 @@
margin-right: 10px;
margin-bottom: 10px;
}
.hide {
display: none;
}
@ -795,11 +798,13 @@
#res {
display: inline-block;
}
.helpText {
position: absolute;
top: 40px;
left: 100px;
}
.adoptTip {
position: absolute;
top: 38px;
@ -807,6 +812,7 @@
font-size: 12px;
color: #46ce7a;
}
.failTip {
position: absolute;
top: 38px;
@ -814,4 +820,11 @@
font-size: 12px;
color: #ff0000;
}
#canvasImg{
width:500px;
height: 300px;
position: absolute;
left: 50%;
transform: translateX(-50%)
}
</style>