askbot-dragon 1.5.39-beta → 1.5.41-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "askbot-dragon",
3
- "version": "1.5.39-beta",
3
+ "version": "1.5.41-beta",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -1,9 +1,12 @@
1
1
  //定义缩放方法,接收一个element参数:使用export暴露该方法
2
- export function zoomElement (el) {
2
+ export function zoomElement (el,transScale) {
3
3
  let store = {
4
4
  scale: 1
5
5
  };
6
- let scale = 1;
6
+ if (!el){
7
+ return
8
+ }
9
+ let scale = transScale;
7
10
  if (el.style.transform){
8
11
  let transForm = el.style.transform;
9
12
  var values = transForm.split('(')[1].split(')')[0].split(',');
@@ -293,23 +293,23 @@ export default {
293
293
  const canvas = document.createElement('canvas');
294
294
  const context = canvas.getContext('2d');
295
295
  // canvas.getContext('2d');
296
- canvas.height = this.pageSize.height * CSS_UNITS;
297
- canvas.width = this.pageSize.width * CSS_UNITS;
296
+ canvas.height = this.pageSize.height * (this.fileName ? CSS_UNITS : 1);
297
+ canvas.width = this.pageSize.width * (this.fileName ? CSS_UNITS : 1);
298
298
  canvas.style.position = 'relative'
299
299
  canvas.style.top = -3 + 'px'
300
300
  // 创建渲染的dom
301
301
  const pageDom = document.createElement('div');
302
302
  pageDom.style.position = 'absolute';
303
- pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * CSS_UNITS) + this.PAGE_INTVERVAL}px`;
304
- pageDom.style.width = `${this.pageSize.width * CSS_UNITS}px`;
305
- pageDom.style.height = `${this.pageSize.height * CSS_UNITS}px`;
303
+ pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1)) + this.PAGE_INTVERVAL}px`;
304
+ pageDom.style.width = `${this.pageSize.width * (this.fileName ? CSS_UNITS : 1)}px`;
305
+ pageDom.style.height = `${this.pageSize.height * (this.fileName ? CSS_UNITS : 1)}px`;
306
306
  pageDom.setAttribute('data-id', 'page' + pageNo)
307
307
  // pageDom.appendChild(canvas);
308
308
  // 渲染内容
309
309
  let renderContext = {
310
310
  canvasContext: context,
311
311
  viewport: viewport,
312
- transform: [CSS_UNITS, 0, 0, CSS_UNITS, 0, 0],
312
+ transform: this.fileName ? [CSS_UNITS, 0, 0, CSS_UNITS, 0, 0] : '',
313
313
  }
314
314
  await pdfPage.render(renderContext).promise.then(() => {
315
315
  const html = canvas.toDataURL();
@@ -346,11 +346,11 @@ export default {
346
346
  let postionArr = lines[index].location
347
347
  let div = document.createElement('div')
348
348
  div.style.position = 'absolute';
349
- div.style.left = postionArr[0] * this.scale * CSS_UNITS + 'px',
349
+ div.style.left = postionArr[0] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px',
350
350
  // 后端返回的坐标有基线对齐的问题,top 值是后端算好(基线top - 文字高度),在此加上文字高度的 1/9 (大致比例)为实际展示出文字的top值
351
- div.style.top = postionArr[1] * this.scale * CSS_UNITS + 'px'
352
- div.style.height = postionArr[3] * this.scale * CSS_UNITS + 'px';
353
- div.style.width = postionArr[2] * this.scale * CSS_UNITS + 'px'
351
+ div.style.top = postionArr[1] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px'
352
+ div.style.height = postionArr[3] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px';
353
+ div.style.width = postionArr[2] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px'
354
354
  div.style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
355
355
  div.classList.add('lineHeight')
356
356
  rectdom.appendChild(div)
@@ -554,10 +554,10 @@ export default {
554
554
  return
555
555
  }
556
556
  const pageDom = document.createElement('div');
557
- pageDom.style.width = `${this.pageSize.width * CSS_UNITS}px`;
558
- pageDom.style.height = `${this.pageSize.height * CSS_UNITS}px`;
557
+ pageDom.style.width = `${this.pageSize.width * (this.fileName ? CSS_UNITS : 1)}px`;
558
+ pageDom.style.height = `${this.pageSize.height * (this.fileName ? CSS_UNITS : 1)}px`;
559
559
  pageDom.style.position = 'absolute';
560
- pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * CSS_UNITS) + this.PAGE_INTVERVAL
560
+ pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1)) + this.PAGE_INTVERVAL
561
561
  }px`;
562
562
  pageDom.style.backgroundImage = `url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif')`
563
563
  pageDom.style.backgroundPosition = 'center'
@@ -54,7 +54,7 @@
54
54
  </div>
55
55
  <div id="drawer_content_pre">
56
56
  <template v-if="tagIds && tagIds.length != 0 && drawer">
57
- <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :fileName="fileName"></pdfPosition>
57
+ <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :fileName="fileName" ref="pdfPosition"></pdfPosition>
58
58
  </template>
59
59
  <template v-else>
60
60
  <div v-if="fileType == 'VIDEO'" style="width: 100%;">
@@ -128,7 +128,10 @@ export default {
128
128
  if(value) {
129
129
  this.$nextTick(() =>{
130
130
  setTimeout(() => {
131
- zoomElement(document.getElementById('contentView'))
131
+ if (this.tagIds && this.tagIds.length != 0){
132
+ let transScale = this.$refs.pdfPosition.transformSalce
133
+ zoomElement(document.getElementById('contentView'),transScale)
134
+ }
132
135
  },1000)
133
136
  })
134
137
  }