zydx-plus 1.28.127 → 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.
|
|
3
|
+
"version": "1.28.129",
|
|
4
4
|
"description": "Vue.js",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
"@tiptap/vue-3": "^2.0.3",
|
|
34
34
|
"@tiptap/extension-text-align": "^2.0.3",
|
|
35
35
|
"@tiptap/extension-placeholder": "^2.0.3",
|
|
36
|
+
"@tiptap/extension-text-style": "^2.0.3",
|
|
37
|
+
"@tiptap/extension-color": "^2.0.3",
|
|
36
38
|
"@vue-office/docx": "^1.1.3",
|
|
37
39
|
"@vue-office/excel": "^1.1.3"
|
|
38
40
|
},
|
|
@@ -82,6 +82,8 @@ import StarterKit from '@tiptap/starter-kit'
|
|
|
82
82
|
import Image from '@tiptap/extension-image'
|
|
83
83
|
import TextAlign from '@tiptap/extension-text-align'
|
|
84
84
|
import Placeholder from '@tiptap/extension-placeholder'
|
|
85
|
+
import Color from '@tiptap/extension-color'
|
|
86
|
+
import textStyle from '@tiptap/extension-text-style'
|
|
85
87
|
export default {
|
|
86
88
|
name: 'zydx-xiao-editor',
|
|
87
89
|
components: {
|
|
@@ -213,6 +215,10 @@ export default {
|
|
|
213
215
|
editable: this.readOnly,
|
|
214
216
|
extensions: [
|
|
215
217
|
StarterKit,
|
|
218
|
+
textStyle,
|
|
219
|
+
Color.configure({
|
|
220
|
+
types: ['textStyle'],
|
|
221
|
+
}),
|
|
216
222
|
Placeholder.configure({
|
|
217
223
|
placeholder: this.placeholder,
|
|
218
224
|
}),
|
|
@@ -383,6 +389,11 @@ export default {
|
|
|
383
389
|
if(v === 'p') this.editor.chain().focus().setParagraph().run()
|
|
384
390
|
if(v === 'bold') this.editor.chain().focus().toggleBold().run()
|
|
385
391
|
if(v === 'center' || v === 'left' || v === 'right') this.editor.chain().focus().setTextAlign(v).run()
|
|
392
|
+
if(v === 'add') {
|
|
393
|
+
let html = this.editor.getHTML()
|
|
394
|
+
html += '<p style="text-align: right;"><span style="color: #999;">请填来源</span></p>'
|
|
395
|
+
this.editor.commands.setContent(html)
|
|
396
|
+
}
|
|
386
397
|
}
|
|
387
398
|
}
|
|
388
399
|
}
|
|
@@ -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: {
|
|
@@ -85,12 +93,13 @@ export default {
|
|
|
85
93
|
},
|
|
86
94
|
methods: {
|
|
87
95
|
flipLeft(e,v) {
|
|
88
|
-
if(e
|
|
96
|
+
if(e < 1) {
|
|
89
97
|
this.pageIndex = 1
|
|
90
98
|
return
|
|
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', {
|
|
@@ -115,19 +125,26 @@ export default {
|
|
|
115
125
|
}
|
|
116
126
|
},
|
|
117
127
|
readPdf() {
|
|
128
|
+
if(this.source === '' || this.source === undefined || this.source === null) return
|
|
118
129
|
let that = this
|
|
119
130
|
that.loading = true
|
|
131
|
+
that.oneShow = that.pageIndex !== 1
|
|
120
132
|
const loadingTask = PdfJs.getDocument(this.source)
|
|
121
133
|
loadingTask.promise.then((pdf) => {
|
|
122
134
|
that.pdfPages = pdf.numPages // 获取pdf文件的总页数
|
|
123
135
|
pdf.getPage(that.pageIndex).then(function (page) {
|
|
124
136
|
let canvas = document.getElementById(that.id)
|
|
125
137
|
let ctx = canvas.getContext('2d');
|
|
126
|
-
let viewport = page.getViewport({scale: 1.
|
|
138
|
+
let viewport = page.getViewport({scale: 1.35})
|
|
127
139
|
canvas.width = viewport.width * 2
|
|
128
140
|
canvas.height = viewport.height * 2
|
|
129
141
|
canvas.style.width = viewport.width + 'px'
|
|
130
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
|
+
}
|
|
131
148
|
let renderContext = {
|
|
132
149
|
canvasContext: ctx,
|
|
133
150
|
viewport: viewport,
|
|
@@ -135,6 +152,20 @@ export default {
|
|
|
135
152
|
}
|
|
136
153
|
page.render(renderContext)
|
|
137
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)
|
|
138
169
|
})
|
|
139
170
|
})
|
|
140
171
|
}
|
|
@@ -143,11 +174,64 @@ export default {
|
|
|
143
174
|
</script>
|
|
144
175
|
|
|
145
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
|
+
}
|
|
146
229
|
.wrap{
|
|
147
230
|
width: 100%;
|
|
148
231
|
height: 100%;
|
|
149
232
|
display: flex;
|
|
150
233
|
align-items: center;
|
|
234
|
+
position: relative;
|
|
151
235
|
}
|
|
152
236
|
.wrap-can{
|
|
153
237
|
display: inline-block;
|