zydx-plus 1.28.128 → 1.28.129

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": "zydx-plus",
3
- "version": "1.28.128",
3
+ "version": "1.28.129",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -4,6 +4,9 @@
4
4
  <div class="book">
5
5
  <div class="pages">
6
6
  <div class="wrap">
7
+ <div class="wrap-one" :class="{'flip-animation-start': flipRights, 'flip-animation-end': flipLefts}" v-if="oneShow" :style="canvasStyle">
8
+ <img :src="imgArr[(oneIndex === 'right')? pageIndex-1: pageIndex]" alt="" />
9
+ </div>
7
10
  <div class="wrap-can">
8
11
  <canvas :id="id"></canvas>
9
12
  </div>
@@ -43,7 +46,12 @@ export default {
43
46
  pagesData: [],
44
47
  opacity: 1,
45
48
  id: null,
46
- loading: false
49
+ loading: false,
50
+ canvasStyle: {},
51
+ oneShow: false,
52
+ flipRights: false,
53
+ flipLefts: false,
54
+ oneIndex: 'right'
47
55
  }
48
56
  },
49
57
  props: {
@@ -91,6 +99,7 @@ export default {
91
99
  }else {
92
100
  this.pageIndex = e
93
101
  }
102
+ this.oneIndex = 'left'
94
103
  this.readPdf()
95
104
  if(!v) {
96
105
  this.$emit('flip', {
@@ -106,6 +115,7 @@ export default {
106
115
  }else {
107
116
  this.pageIndex = e
108
117
  }
118
+ this.oneIndex = 'right'
109
119
  this.readPdf()
110
120
  if(!v) {
111
121
  this.$emit('flip', {
@@ -118,17 +128,23 @@ export default {
118
128
  if(this.source === '' || this.source === undefined || this.source === null) return
119
129
  let that = this
120
130
  that.loading = true
131
+ that.oneShow = that.pageIndex !== 1
121
132
  const loadingTask = PdfJs.getDocument(this.source)
122
133
  loadingTask.promise.then((pdf) => {
123
134
  that.pdfPages = pdf.numPages // 获取pdf文件的总页数
124
135
  pdf.getPage(that.pageIndex).then(function (page) {
125
136
  let canvas = document.getElementById(that.id)
126
137
  let ctx = canvas.getContext('2d');
127
- let viewport = page.getViewport({scale: 1.4})
138
+ let viewport = page.getViewport({scale: 1.35})
128
139
  canvas.width = viewport.width * 2
129
140
  canvas.height = viewport.height * 2
130
141
  canvas.style.width = viewport.width + 'px'
131
142
  canvas.style.height = viewport.height + 'px'
143
+ that.canvasStyle = {
144
+ width: viewport.width + 'px',
145
+ height: viewport.height + 'px',
146
+ marginLeft: -(viewport.width/2) + 'px'
147
+ }
132
148
  let renderContext = {
133
149
  canvasContext: ctx,
134
150
  viewport: viewport,
@@ -136,6 +152,20 @@ export default {
136
152
  }
137
153
  page.render(renderContext)
138
154
  that.loading = false
155
+ if(that.oneIndex === 'right') {
156
+ that.flipRights = true
157
+ that.flipLefts = false
158
+ }else {
159
+ that.flipRights = false
160
+ that.flipLefts = true
161
+ }
162
+ // 获取canvas的base64数据
163
+ setTimeout(() => {
164
+ that.flipRights = false
165
+ that.flipLefts = false
166
+ that.oneShow = false
167
+ that.imgArr[that.pageIndex] = canvas.toDataURL('image/jpeg', 1)
168
+ }, 1000)
139
169
  })
140
170
  })
141
171
  }
@@ -144,11 +174,64 @@ export default {
144
174
  </script>
145
175
 
146
176
  <style scoped>
177
+ /*动画部分*/
178
+ /*I'm the home page动画*/
179
+ .flip-animation-start {
180
+ transform-origin: left center;
181
+ animation: flipBook1 1s forwards;
182
+ }
183
+ .flip-animation-end {
184
+ transform-origin: left center;
185
+ animation: flipBook2 1s forwards;
186
+ }
187
+ @keyframes flipBook1 {
188
+ 0% {
189
+ transform: perspective(3000px) rotateY(0deg);
190
+ opacity: 1;
191
+ }
192
+ 60%{
193
+ opacity: 1;
194
+ }
195
+ 100% {
196
+ transform: perspective(3000px) rotateY(-160deg);
197
+ opacity: 0;
198
+ }
199
+ }
200
+ /*关闭书页*/
201
+ @keyframes flipBook2 {
202
+ 0% {
203
+ transform: perspective(3000px) rotateY(-160deg);
204
+ opacity: 0;
205
+ }
206
+ 30%{
207
+ opacity: 1;
208
+ }
209
+ 70%{
210
+ opacity: 1;
211
+ }
212
+ 100% {
213
+ transform: perspective(3000px) rotateY(0deg);
214
+ opacity: 0;
215
+ }
216
+ }
217
+ .wrap-one{
218
+ position: absolute;
219
+ top: 0;
220
+ left: 50%;
221
+ right: 0;
222
+ bottom: 0;
223
+ z-index: 1;
224
+ }
225
+ .wrap-one img{
226
+ width: 100%;
227
+ height: 100%;
228
+ }
147
229
  .wrap{
148
230
  width: 100%;
149
231
  height: 100%;
150
232
  display: flex;
151
233
  align-items: center;
234
+ position: relative;
152
235
  }
153
236
  .wrap-can{
154
237
  display: inline-block;
package/src/index.js CHANGED
@@ -67,7 +67,7 @@ function install(app) {
67
67
  }
68
68
 
69
69
  export default {
70
- version: '1.28.128',
70
+ version: '1.28.129',
71
71
  install,
72
72
  Calendar,
73
73
  Message,