zydx-plus 1.19.93 → 1.19.94
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
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
<div style="height: 100%;">
|
|
4
4
|
<div class="book">
|
|
5
5
|
<div class="pages">
|
|
6
|
-
<div class="wrap" id="canvas-wrap"
|
|
6
|
+
<div class="wrap" id="canvas-wrap">
|
|
7
|
+
<div class="wrap-can">
|
|
8
|
+
<canvas id="the-canvas"></canvas>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
7
11
|
<div class="page-but-left" :style="{cursor: pageIndex === 1?'default':'pointer'}" @click="flipLeft(pageIndex-=1,false)"></div>
|
|
8
12
|
<div class="page-but-right" :style="{cursor: pageIndex === pdfPages?'default':'pointer'}" @click="flipRight(pageIndex+=1,false)"></div>
|
|
9
13
|
<!-- <div class="paper z-in" :class="{'data-right': pages}">-->
|
|
@@ -26,6 +30,7 @@
|
|
|
26
30
|
|
|
27
31
|
<script>
|
|
28
32
|
import * as PdfJs from 'pdfjs-dist/legacy/build/pdf.js' // 注意导入的写法
|
|
33
|
+
import { TextLayerBuilder } from 'pdfjs-dist/web/pdf_viewer'
|
|
29
34
|
PdfJs.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker.entry')
|
|
30
35
|
export default {
|
|
31
36
|
name: "zydx-flip",
|
|
@@ -108,19 +113,19 @@ export default {
|
|
|
108
113
|
loadingTask.promise.then((pdf) => {
|
|
109
114
|
that.pdfPages = pdf.numPages // 获取pdf文件的总页数
|
|
110
115
|
pdf.getPage(that.pageIndex).then(function (page) {
|
|
116
|
+
let canvas = document.getElementById('the-canvas')
|
|
117
|
+
let ctx = canvas.getContext('2d');
|
|
111
118
|
let viewport = page.getViewport({scale: 1})
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
})
|
|
123
|
-
})
|
|
119
|
+
canvas.width = viewport.width * 2
|
|
120
|
+
canvas.height = viewport.height * 2
|
|
121
|
+
canvas.style.width = viewport.width + 'px'
|
|
122
|
+
canvas.style.height = viewport.height + 'px'
|
|
123
|
+
let renderContext = {
|
|
124
|
+
canvasContext: ctx,
|
|
125
|
+
viewport: viewport,
|
|
126
|
+
transform: [2, 0, 0, 2, 0, 0]//这里会进行放大,解决模糊问题
|
|
127
|
+
}
|
|
128
|
+
page.render(renderContext)
|
|
124
129
|
})
|
|
125
130
|
})
|
|
126
131
|
}
|
|
@@ -132,64 +137,21 @@ export default {
|
|
|
132
137
|
.wrap{
|
|
133
138
|
width: 100%;
|
|
134
139
|
height: 100%;
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
}
|
|
143
|
+
.wrap-can{
|
|
144
|
+
display: inline-block;
|
|
145
|
+
margin: 0 auto;
|
|
135
146
|
}
|
|
136
147
|
.but-wrap{
|
|
137
148
|
text-align: center;
|
|
138
149
|
}
|
|
139
|
-
.z-in{
|
|
140
|
-
z-index: 2;
|
|
141
|
-
}
|
|
142
|
-
.z-in-ac{
|
|
143
|
-
z-index: 1;
|
|
144
|
-
}
|
|
145
150
|
.pages{
|
|
146
151
|
width: 100%;
|
|
147
152
|
height: 100%;
|
|
148
153
|
position: relative;
|
|
149
154
|
}
|
|
150
|
-
.paper{
|
|
151
|
-
position: absolute;
|
|
152
|
-
right: 0;
|
|
153
|
-
transform-style: preserve-3d;
|
|
154
|
-
width: 100%;
|
|
155
|
-
}
|
|
156
|
-
.page{
|
|
157
|
-
position: absolute;
|
|
158
|
-
text-align: center;
|
|
159
|
-
}
|
|
160
|
-
.page img{
|
|
161
|
-
width: 100%;
|
|
162
|
-
height: 100%;
|
|
163
|
-
}
|
|
164
|
-
.data-right {
|
|
165
|
-
opacity: 1;
|
|
166
|
-
transform-origin: left center;
|
|
167
|
-
animation: flip-to-left 1.5s ease-in-out forwards;
|
|
168
|
-
}
|
|
169
|
-
.data-left{
|
|
170
|
-
right: auto;
|
|
171
|
-
left: 0;
|
|
172
|
-
}
|
|
173
|
-
@keyframes flip-to-left {
|
|
174
|
-
0% {
|
|
175
|
-
transform: perspective(3000px) rotateY(0);
|
|
176
|
-
}
|
|
177
|
-
95% {
|
|
178
|
-
transform: perspective(3000px) rotateY(-180deg);
|
|
179
|
-
}
|
|
180
|
-
100% {
|
|
181
|
-
transform: perspective(3000px) rotateY(-180deg);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
.page-1-back, .page-2-back {
|
|
185
|
-
transform: scale(-1, 1);
|
|
186
|
-
}
|
|
187
|
-
.page-1, .page-2 {
|
|
188
|
-
transform: translateZ(1px);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
155
|
|
|
194
156
|
.page-but-left{
|
|
195
157
|
position: absolute;
|
|
@@ -35,6 +35,15 @@ export default {
|
|
|
35
35
|
default: () => ['name']
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
|
+
watch: {
|
|
39
|
+
active(val) {
|
|
40
|
+
this.list.forEach((item, index) => {
|
|
41
|
+
if (item[this.activeId] === val) {
|
|
42
|
+
this.actives = index
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
},
|
|
38
47
|
mounted() {
|
|
39
48
|
if (this.activeId) {
|
|
40
49
|
this.list.forEach((item, index) => {
|