zydx-plus 1.35.465 → 1.35.467
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
|
@@ -101,6 +101,7 @@
|
|
|
101
101
|
<script>
|
|
102
102
|
import * as PdfJs from 'pdfjs-dist/legacy/build/pdf.js'
|
|
103
103
|
import Mess from '../../tipBox/index'
|
|
104
|
+
import {debounce} from '../../utils'
|
|
104
105
|
|
|
105
106
|
PdfJs.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker.entry')
|
|
106
107
|
|
|
@@ -1176,9 +1177,9 @@ export default {
|
|
|
1176
1177
|
})
|
|
1177
1178
|
})
|
|
1178
1179
|
},
|
|
1179
|
-
readPdf()
|
|
1180
|
+
readPdf:debounce(function (){
|
|
1180
1181
|
let that = this
|
|
1181
|
-
|
|
1182
|
+
that.mouse()
|
|
1182
1183
|
pdfs.getPage(that.pageIndex).then(function (page) {
|
|
1183
1184
|
let canvas = document.getElementById(that.id)
|
|
1184
1185
|
let canvas2 = document.getElementById(`${that.id}2`)
|
|
@@ -1228,12 +1229,12 @@ export default {
|
|
|
1228
1229
|
that.processing()
|
|
1229
1230
|
}, 1000)
|
|
1230
1231
|
})
|
|
1231
|
-
},
|
|
1232
|
-
readDoublePdf()
|
|
1232
|
+
},200),
|
|
1233
|
+
readDoublePdf:debounce(function (){
|
|
1233
1234
|
let that = this
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1235
|
+
that.mouse()
|
|
1236
|
+
that.$nextTick(()=>{
|
|
1237
|
+
that.pageInfoArr.forEach((item,index)=>{
|
|
1237
1238
|
pdfs.getPage(index+1).then(function (page) {
|
|
1238
1239
|
let canvas = document.getElementById(item.id)
|
|
1239
1240
|
let canvas2 = document.getElementById(`${item.id}2`)
|
|
@@ -1286,7 +1287,7 @@ export default {
|
|
|
1286
1287
|
})
|
|
1287
1288
|
})
|
|
1288
1289
|
})
|
|
1289
|
-
},
|
|
1290
|
+
},200),
|
|
1290
1291
|
generateUniqueKey (){
|
|
1291
1292
|
// Math.random().toString(36).substr(2)
|
|
1292
1293
|
return `${new Date().getTime()}${Math.random().toString(36).substr(2)}`;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<div v-if="isShowsLeft" class="left" ref="leftRef">
|
|
5
5
|
<slot name="left"></slot>
|
|
6
6
|
</div>
|
|
7
|
-
<div v-if="isShowsRight
|
|
7
|
+
<div v-if="isShowsRight && isShowsLeft" class="resize" ref="resizeRef"></div>
|
|
8
8
|
<div v-if="isShowsRight" class="right" ref="rightRef">
|
|
9
9
|
<!-- 右侧内容,默认展示30%,默认最小宽度310px-->
|
|
10
10
|
<slot name="right"></slot>
|
|
@@ -16,38 +16,38 @@
|
|
|
16
16
|
export default {
|
|
17
17
|
name: "zydx-variable-box",
|
|
18
18
|
props: {
|
|
19
|
-
isShowsRight:{
|
|
19
|
+
isShowsRight: {
|
|
20
20
|
type: Boolean,
|
|
21
21
|
default: true
|
|
22
22
|
},
|
|
23
|
-
isShowsLeft:{
|
|
23
|
+
isShowsLeft: {
|
|
24
24
|
type: Boolean,
|
|
25
25
|
default: true
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
watch: {
|
|
29
|
-
isShowsRight:{
|
|
29
|
+
isShowsRight: {
|
|
30
30
|
handler: function (v) {
|
|
31
31
|
setTimeout(() => {
|
|
32
|
-
if(
|
|
32
|
+
if (this.isShowsRight) {
|
|
33
33
|
this.handleResize()
|
|
34
34
|
} else {
|
|
35
35
|
this.$refs.leftRef.style.width = '100%'
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}, 200)
|
|
38
38
|
},
|
|
39
39
|
immediate: true,
|
|
40
40
|
deep: true
|
|
41
41
|
},
|
|
42
|
-
isShowsLeft:{
|
|
42
|
+
isShowsLeft: {
|
|
43
43
|
handler: function (v) {
|
|
44
44
|
setTimeout(() => {
|
|
45
|
-
if(
|
|
45
|
+
if (this.isShowsLeft) {
|
|
46
46
|
this.handleResize()
|
|
47
47
|
} else {
|
|
48
48
|
this.$refs.rightRef.style.width = '100%'
|
|
49
49
|
}
|
|
50
|
-
}
|
|
50
|
+
}, 200)
|
|
51
51
|
},
|
|
52
52
|
immediate: true,
|
|
53
53
|
deep: true
|
|
@@ -65,32 +65,36 @@ export default {
|
|
|
65
65
|
leftDom = this.$refs.leftRef,
|
|
66
66
|
resizeDom = this.$refs.resizeRef,
|
|
67
67
|
rightDom = this.$refs.rightRef;
|
|
68
|
-
resizeDom
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
68
|
+
if (resizeDom) {
|
|
69
|
+
leftDom.style.width = '50%'
|
|
70
|
+
rightDom.style.width = '50%'
|
|
71
|
+
resizeDom.onmousedown = e => {
|
|
72
|
+
const startX = e.clientX; // 记录坐标起始位置
|
|
73
|
+
leftDom.left = leftDom.offsetWidth; // 左边元素起始宽度
|
|
74
|
+
document.onmousemove = e => {
|
|
75
|
+
const endX = e.clientX; // 鼠标拖动的终止位置
|
|
76
|
+
let moveLen = leftDom.left + (endX - startX); // 移动的距离 = endX - startX,左边区域最后的宽度 = resizeDom.left + 移动的距离
|
|
77
|
+
const maxWidth = boxDom.clientWidth - resizeDom.offsetWidth; // 左右两边区域的总宽度 = 外层容器宽度 - 中间区域拖拉框的宽度
|
|
78
|
+
// 限制左边区域的最小宽度为 leftMinWidth
|
|
79
|
+
if (moveLen < leftMinWidth) {
|
|
80
|
+
moveLen = leftMinWidth;
|
|
81
|
+
}
|
|
82
|
+
// 右边区域最小宽度为 rightMinWidth
|
|
83
|
+
if (moveLen > maxWidth - rightMinWidth) {
|
|
84
|
+
moveLen = maxWidth - rightMinWidth;
|
|
85
|
+
}
|
|
86
|
+
leftDom.style.width = (moveLen / maxWidth) * 100 + "%"; // 设置左边区域的宽度,通过换算为百分比的形式,实现窗体放大缩小自适应
|
|
87
|
+
rightDom.style.width = ((maxWidth - moveLen) / maxWidth) * 100 + "%"; // 右边区域 = 总大小 - 左边宽度 - 拖动条宽度
|
|
88
|
+
};
|
|
89
|
+
document.onmouseup = () => {
|
|
90
|
+
document.onmousemove = null;
|
|
91
|
+
document.onmouseup = null;
|
|
92
|
+
resizeDom.releaseCapture && resizeDom.releaseCapture(); // 鼠标捕获释放
|
|
93
|
+
};
|
|
94
|
+
resizeDom.setCapture && resizeDom.setCapture(); // 启用鼠标捕获
|
|
95
|
+
return false;
|
|
85
96
|
};
|
|
86
|
-
|
|
87
|
-
document.onmousemove = null;
|
|
88
|
-
document.onmouseup = null;
|
|
89
|
-
resizeDom.releaseCapture && resizeDom.releaseCapture(); // 鼠标捕获释放
|
|
90
|
-
};
|
|
91
|
-
resizeDom.setCapture && resizeDom.setCapture(); // 启用鼠标捕获
|
|
92
|
-
return false;
|
|
93
|
-
};
|
|
97
|
+
}
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
100
|
};
|
|
@@ -104,10 +108,7 @@ export default {
|
|
|
104
108
|
box-sizing: border-box;
|
|
105
109
|
}
|
|
106
110
|
.left {
|
|
107
|
-
width:
|
|
108
|
-
background-color: #f1eab3;
|
|
109
|
-
border-right: 2px solid #dcdfe6;
|
|
110
|
-
overflow: hidden;
|
|
111
|
+
width: 50%;
|
|
111
112
|
}
|
|
112
113
|
.resize {
|
|
113
114
|
position: relative;
|
|
@@ -115,15 +116,13 @@ export default {
|
|
|
115
116
|
cursor: col-resize;
|
|
116
117
|
background-size: cover;
|
|
117
118
|
background-position: center;
|
|
119
|
+
border-right: 2px solid #dcdfe6;
|
|
120
|
+
border-left: 2px solid #dcdfe6;
|
|
118
121
|
}
|
|
119
122
|
.resize:hover {
|
|
120
|
-
/*background-color: #45a3ff;*/
|
|
121
123
|
background-color: white;
|
|
122
124
|
}
|
|
123
125
|
.right {
|
|
124
|
-
width:
|
|
125
|
-
background-color: #b5ef8f;
|
|
126
|
-
border-left: 2px solid #dcdfe6;
|
|
127
|
-
overflow: hidden;
|
|
126
|
+
width: 50%;
|
|
128
127
|
}
|
|
129
128
|
</style>
|