|
|
@@ -1,14 +1,14 @@
|
|
|
<!-- eslint-disable vue/no-v-html -->
|
|
|
<template>
|
|
|
- <div class="imageText-preview" :style="getAreaStyle()">
|
|
|
+ <div class="drawimg-preview" :style="getAreaStyle()">
|
|
|
<SerialNumberPosition v-if="isEnable(data.property.sn_display_mode)" :property="data.property" />
|
|
|
|
|
|
<div
|
|
|
class="img-box"
|
|
|
:style="{
|
|
|
background: image_url ? '' : '#DCDFE6',
|
|
|
- width: data.image_width + 'px',
|
|
|
- height: data.image_height + 'px',
|
|
|
+ width: isMobile ? '100%' : data.image_width + 'px',
|
|
|
+ height: isMobile ? mobileHeight + 'px' : data.image_height + 'px',
|
|
|
border: '1px dotted #DCDFE6',
|
|
|
}"
|
|
|
>
|
|
|
@@ -21,7 +21,10 @@
|
|
|
:src="image_url"
|
|
|
draggable="false"
|
|
|
alt="背景图"
|
|
|
- :style="{ width: `${data.imgData.width}px`, height: `${data.imgData.height}px` }"
|
|
|
+ :style="{
|
|
|
+ width: isMobile ? '100%' : `${data.imgData.width}px`,
|
|
|
+ height: isMobile ? mobileHeight + 'px' : `${data.imgData.height}px`,
|
|
|
+ }"
|
|
|
/>
|
|
|
</div>
|
|
|
<!-- 如果是查看答案模式 v-if 下面画画的vue-esign不显示 -->
|
|
|
@@ -37,8 +40,8 @@
|
|
|
/> -->
|
|
|
<VueSignaturePad
|
|
|
class="esign-canvas"
|
|
|
- :width="data.image_width + 'px'"
|
|
|
- :height="data.image_height + 'px'"
|
|
|
+ :width="isMobile ? '100%' : data.image_width + 'px'"
|
|
|
+ :height="isMobile ? mobileHeight + 'px' : data.image_height + 'px'"
|
|
|
ref="signaturePad"
|
|
|
:options="options"
|
|
|
/>
|
|
|
@@ -67,7 +70,12 @@ import { GetFileURLMap } from '@/api/app';
|
|
|
import vueEsign from 'vue-esign';
|
|
|
export default {
|
|
|
name: 'DrawingPreview',
|
|
|
-
|
|
|
+ props: {
|
|
|
+ isMobile: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
components: { vueEsign },
|
|
|
mixins: [PreviewMixin],
|
|
|
data() {
|
|
|
@@ -99,6 +107,7 @@ export default {
|
|
|
isActive3: false,
|
|
|
imgSrc: '',
|
|
|
signData: null,
|
|
|
+ mobileHeight: 0,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
@@ -168,6 +177,12 @@ export default {
|
|
|
// this.image_url = url_map[item.file_id];
|
|
|
// });
|
|
|
});
|
|
|
+ if (this.isMobile) {
|
|
|
+ setTimeout(() => {
|
|
|
+ let totalWidth = document.querySelector('.drawimg-preview').offsetWidth;
|
|
|
+ this.mobileHeight = (totalWidth / this.data.image_width) * this.data.image_height;
|
|
|
+ }, 50);
|
|
|
+ }
|
|
|
},
|
|
|
// 保存图片
|
|
|
handleGenerate() {
|