askbot-dragon 1.5.43-beta → 1.5.46-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
package/src/assets/js/hammer.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
//定义缩放方法,接收一个element参数:使用export暴露该方法
|
|
2
|
-
export function zoomElement (el
|
|
2
|
+
export function zoomElement (el) {
|
|
3
3
|
let store = {
|
|
4
4
|
scale: 1
|
|
5
5
|
};
|
|
6
6
|
if (!el){
|
|
7
7
|
return
|
|
8
8
|
}
|
|
9
|
-
let scale =
|
|
9
|
+
let scale = 1;
|
|
10
10
|
if (el.style.transform){
|
|
11
11
|
let transForm = el.style.transform;
|
|
12
12
|
var values = transForm.split('(')[1].split(')')[0].split(',');
|
|
@@ -35,6 +35,13 @@
|
|
|
35
35
|
border-radius: 6px;
|
|
36
36
|
background-color: #bfceec !important;
|
|
37
37
|
}
|
|
38
|
+
@media screen and (max-width: 767px){
|
|
39
|
+
::-webkit-scrollbar {
|
|
40
|
+
width: 0;
|
|
41
|
+
height: 0;
|
|
42
|
+
background-color:@system_bordercolor_4;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
38
45
|
|
|
39
46
|
// 弹窗body
|
|
40
47
|
.el-dialog__body{
|
|
@@ -245,7 +245,12 @@ export default {
|
|
|
245
245
|
this.$refs.previewPdf.fileType = type
|
|
246
246
|
this.$refs.previewPdf.tagIds = item.tagIds
|
|
247
247
|
this.$refs.previewPdf.isMessageRecord = this.isMessageRecord ? true : false ;
|
|
248
|
-
let
|
|
248
|
+
let index = url.indexOf("?");
|
|
249
|
+
let newFileInOssPath = url;
|
|
250
|
+
if (index !== -1){
|
|
251
|
+
newFileInOssPath = url.substring(0, url.indexOf("?"))
|
|
252
|
+
}
|
|
253
|
+
let fileName = newFileInOssPath.substring(newFileInOssPath.lastIndexOf('.'))
|
|
249
254
|
if (fileName === '.doc' || fileName === '.docx' || fileName === '.txt'){
|
|
250
255
|
this.$refs.previewPdf.fileName = fileName;
|
|
251
256
|
} else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div id="pdf_view" class="pdf_view" :style="{
|
|
3
3
|
marginTop: isPC ? '50px' : '',
|
|
4
4
|
marginBottom: tagIds.length > 1 ? '60px' : '0px',
|
|
5
5
|
height: setHeight
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
</el-option>
|
|
18
18
|
</el-select>
|
|
19
19
|
</div>
|
|
20
|
+
<div class="pdf_container_view" id="pdf_container_view" @scroll="pdfScroll" ref="pdfView"></div>
|
|
20
21
|
<div class="btn_footer" v-if="tagIds.length > 1 && !isPC">
|
|
21
22
|
<div class="prev" @click="prev">上一段</div>
|
|
22
23
|
<div class="next" @click="next">下一段</div>
|
|
@@ -95,6 +96,7 @@ export default {
|
|
|
95
96
|
},
|
|
96
97
|
isTouchMoved: false,
|
|
97
98
|
transformSalce: null,
|
|
99
|
+
defaultTransform:0.8,
|
|
98
100
|
isPC: false,
|
|
99
101
|
handScale: 'auto',
|
|
100
102
|
scaleList: [
|
|
@@ -282,12 +284,12 @@ export default {
|
|
|
282
284
|
const { pdfPage, pageNo, dom } = page;
|
|
283
285
|
// dom 元素已存在,无须重新渲染,直接返回
|
|
284
286
|
if ((dom && dom.children.length != 0) || page.loading) {
|
|
285
|
-
|
|
287
|
+
return;
|
|
286
288
|
}
|
|
287
289
|
page.loading = true
|
|
288
290
|
const viewport = pdfPage.getViewport({
|
|
289
|
-
|
|
290
|
-
|
|
291
|
+
scale: this.scale,
|
|
292
|
+
rotation: this.rotation,
|
|
291
293
|
});
|
|
292
294
|
// 创建新的canvas
|
|
293
295
|
const canvas = document.createElement('canvas');
|
|
@@ -356,25 +358,25 @@ export default {
|
|
|
356
358
|
rectdom.appendChild(div)
|
|
357
359
|
if (index == 0 && j == 0) {
|
|
358
360
|
if (this.transformSalce !== null) {
|
|
359
|
-
rectdomTop = postionArr[1]* this.scale * this.transformSalce
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
if (rectdom.children.length > 0) {
|
|
370
|
-
pageDom.appendChild(rectdom)
|
|
371
|
-
}
|
|
361
|
+
rectdomTop = postionArr[1]* this.scale * (this.fileName ? CSS_UNITS : 1) * this.transformSalce
|
|
362
|
+
} else {
|
|
363
|
+
rectdomTop = postionArr[1] * this.scale * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform
|
|
364
|
+
}
|
|
365
|
+
// if(this.isPC) {
|
|
366
|
+
// rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
|
|
367
|
+
// }
|
|
372
368
|
}
|
|
369
|
+
}
|
|
373
370
|
}
|
|
371
|
+
if (rectdom.children.length > 0) {
|
|
372
|
+
pageDom.appendChild(rectdom)
|
|
373
|
+
}
|
|
374
|
+
}
|
|
374
375
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
376
|
+
}
|
|
377
|
+
textLayer.setTextContent(textContent);
|
|
378
|
+
textLayer.render()
|
|
379
|
+
pageDom.appendChild(textLayerDiv);
|
|
378
380
|
let backgroundDom = document.getElementById('backgroundLoad' + pageNo)
|
|
379
381
|
if (backgroundDom) {
|
|
380
382
|
this.contentView.removeChild(backgroundDom);
|
|
@@ -386,29 +388,23 @@ export default {
|
|
|
386
388
|
if (pdf_view && pdf_view[0]){
|
|
387
389
|
pdf_view[0].style.backgroundImage = 'none'
|
|
388
390
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
this.contentView.style.transform = 'scale(0.8)';
|
|
407
|
-
// this.contentView.style.left = ((postionArr[0] * this.scale) * -1)+ 'px';
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
} else if(this.transformSalce !== null){
|
|
411
|
-
this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
|
|
391
|
+
let postionArr = []
|
|
392
|
+
if (findPage){
|
|
393
|
+
let AllLines = findPage.allLines
|
|
394
|
+
if (AllLines.length){
|
|
395
|
+
postionArr = AllLines[0].lines[0].location
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
if(this.transformSalce !== null && this.fileName) {
|
|
399
|
+
this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
|
|
400
|
+
if (postionArr.length){
|
|
401
|
+
this.contentView.style.left = (postionArr[0] * this.scale * CSS_UNITS * (this.transformSalce) * -1) + 10 + 'px';
|
|
402
|
+
}
|
|
403
|
+
} else {
|
|
404
|
+
this.contentView.style.transform = `scale(${this.defaultTransform})`;
|
|
405
|
+
if (postionArr.length){
|
|
406
|
+
this.contentView.style.left = (postionArr[0] * this.scale * CSS_UNITS * (this.defaultTransform) * -1) / 2 + 'px';
|
|
407
|
+
}
|
|
412
408
|
}
|
|
413
409
|
if (this.changetoolbar) {
|
|
414
410
|
setTimeout(() => {
|
|
@@ -420,21 +416,21 @@ export default {
|
|
|
420
416
|
setTimeout(() => {
|
|
421
417
|
let pageoffsetHeight = 0
|
|
422
418
|
if (this.transformSalce !== null) {
|
|
423
|
-
pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
|
|
419
|
+
pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce * (this.fileName ? CSS_UNITS : 1)
|
|
424
420
|
} else {
|
|
425
|
-
pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL)
|
|
421
|
+
pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.defaultTransform *(this.fileName ? CSS_UNITS : 1)
|
|
426
422
|
}
|
|
427
423
|
if (this.$refs.pdfView.clientHeight - pageoffsetHeight > 0 && pageIndex == 1) {
|
|
428
424
|
const height = this.$refs.pdfView.clientHeight;
|
|
429
425
|
let startNum = 0
|
|
430
426
|
let endNum = 0
|
|
431
427
|
if (this.transformSalce !== null) {
|
|
432
|
-
startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
|
|
433
|
-
endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
endNum = startNum + Math.ceil(height / (this.pageSize.height + this.PAGE_INTVERVAL))
|
|
437
|
-
|
|
428
|
+
startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce* (this.fileName ? CSS_UNITS : 1)))
|
|
429
|
+
endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce* (this.fileName ? CSS_UNITS : 1)))
|
|
430
|
+
} else {
|
|
431
|
+
startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))
|
|
432
|
+
endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))}
|
|
433
|
+
console.log(this.$refs.pdfView.scrollTop, startNum, endNum, 'endNumendNum');
|
|
438
434
|
for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
|
|
439
435
|
if (pageIndex > 0 && pageIndex <= this.pages.length) {
|
|
440
436
|
this.loadPdfData(pageIndex)
|
|
@@ -466,11 +462,11 @@ export default {
|
|
|
466
462
|
let startNum = 0
|
|
467
463
|
let endNum = 0
|
|
468
464
|
if (this.transformSalce !== null) {
|
|
469
|
-
startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
|
|
470
|
-
endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
|
|
465
|
+
startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce * (this.fileName ? CSS_UNITS : 1)))
|
|
466
|
+
endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce * (this.fileName ? CSS_UNITS : 1)))
|
|
471
467
|
} else {
|
|
472
|
-
startNum = Math.ceil(scrollTop / (that.pageSize.height + that.PAGE_INTVERVAL))
|
|
473
|
-
endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
|
|
468
|
+
startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))
|
|
469
|
+
endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))
|
|
474
470
|
}
|
|
475
471
|
for (let pageIndex = startNum; pageIndex < endNum; pageIndex++) {
|
|
476
472
|
if (pageIndex > 0 && pageIndex <= that.pages.length) {
|
|
@@ -638,7 +634,7 @@ export default {
|
|
|
638
634
|
if (this.transformSalce !== null) {
|
|
639
635
|
this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
|
|
640
636
|
} else {
|
|
641
|
-
this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + (this.identifyTextPostion.top * this.scale)}`
|
|
637
|
+
this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + (this.identifyTextPostion.top * this.scale * this.defaultTransform)}`
|
|
642
638
|
}
|
|
643
639
|
},
|
|
644
640
|
scrollToExcalTop (currentPage) {
|
|
@@ -1331,6 +1327,12 @@ export default {
|
|
|
1331
1327
|
background: rgba(221, 222, 223, 1);
|
|
1332
1328
|
}
|
|
1333
1329
|
}
|
|
1330
|
+
.pdf_container_view{
|
|
1331
|
+
height: 100%;
|
|
1332
|
+
width: 100%;
|
|
1333
|
+
position: relative;
|
|
1334
|
+
overflow: auto;
|
|
1335
|
+
}
|
|
1334
1336
|
}
|
|
1335
1337
|
</style>
|
|
1336
1338
|
<style lang="less">
|
|
@@ -127,12 +127,9 @@ export default {
|
|
|
127
127
|
drawer(value) {
|
|
128
128
|
if(value) {
|
|
129
129
|
this.$nextTick(() =>{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
zoomElement(document.getElementById('contentView'),transScale)
|
|
134
|
-
}
|
|
135
|
-
},1000)
|
|
130
|
+
if (this.tagIds && this.tagIds.length != 0){
|
|
131
|
+
zoomElement(document.getElementById('pdf_container_view'))
|
|
132
|
+
}
|
|
136
133
|
})
|
|
137
134
|
}
|
|
138
135
|
setTimeout(() => {
|
|
@@ -297,10 +294,6 @@ export default {
|
|
|
297
294
|
overflow: auto;
|
|
298
295
|
height: calc(100% - 50px);
|
|
299
296
|
background: #FFF;
|
|
300
|
-
background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
|
|
301
|
-
background-position: center;
|
|
302
|
-
background-size: 50px;
|
|
303
|
-
background-repeat: no-repeat;
|
|
304
297
|
}
|
|
305
298
|
}
|
|
306
299
|
@media screen and (min-width: 768px) {
|