zydx-plus 1.19.92 → 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
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<p v-if="editorShow">附件列表:</p>
|
|
25
25
|
<div class="enclosure-list" v-for="(item,index) in uploadAttData">
|
|
26
26
|
<div class="enclosure-item">
|
|
27
|
-
<span>{{ index + 1 }}. {{ (item.name)? item.name : item.
|
|
27
|
+
<span>{{ index + 1 }}. {{ (item.name)? item.name : item.annexName }}</span>
|
|
28
28
|
</div>
|
|
29
29
|
<div class="enclosure-item en-but">
|
|
30
30
|
<div style="display: inline-block; height: 21px;">
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
</div>
|
|
74
74
|
</template>
|
|
75
75
|
<script>
|
|
76
|
+
|
|
76
77
|
import { html2json, json2html } from 'html2json'
|
|
77
78
|
import { Editor, EditorContent } from '@tiptap/vue-3'
|
|
78
79
|
import StarterKit from '@tiptap/starter-kit'
|
|
@@ -191,8 +192,16 @@ export default {
|
|
|
191
192
|
del(index) {
|
|
192
193
|
if(this.uploadAttData[index].name === undefined) {
|
|
193
194
|
this.uploadAttData[index].active = false
|
|
194
|
-
this.$emit('del', this.uploadAttData[index], () => {
|
|
195
|
-
|
|
195
|
+
this.$emit('del', this.uploadAttData[index], (e) => {
|
|
196
|
+
if(e === undefined) {
|
|
197
|
+
this.uploadAttData.splice(index, 1)
|
|
198
|
+
}else {
|
|
199
|
+
if(e) {
|
|
200
|
+
this.uploadAttData.splice(index, 1)
|
|
201
|
+
}else {
|
|
202
|
+
this.uploadAttData[index].active = true
|
|
203
|
+
}
|
|
204
|
+
}
|
|
196
205
|
})
|
|
197
206
|
}else {
|
|
198
207
|
this.uploadAttData.splice(index, 1)
|
|
@@ -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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="read">
|
|
3
|
-
<vue-office-docx v-if="fileType === 'docx'" :src="url" style="height: 100%;" />
|
|
4
|
-
<vue-office-excel v-if="fileType === 'xlsx'
|
|
3
|
+
<vue-office-docx v-if="fileType === 'docx'" :src="url" style="height: 100%;" @rendered="renderedHandler" />
|
|
4
|
+
<vue-office-excel v-if="fileType === 'xlsx'" :src="url" style="height: 100%;" @rendered="renderedHandler" />
|
|
5
5
|
<div class="view-pdf" v-if="fileType === 'pdf'" id="canvas-wrap"></div>
|
|
6
6
|
<div class="mp4" v-if="fileType === 'mp4'">
|
|
7
7
|
<video :src="url" controls></video>
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
<div class="mp3" v-if="fileType === 'mp3'">
|
|
10
10
|
<audio :src="url" controls></audio>
|
|
11
11
|
</div>
|
|
12
|
+
<div v-if="loading" class="loading-back">
|
|
13
|
+
<div class="loading-cont">
|
|
14
|
+
<div class="loading">Loading</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
12
17
|
</div>
|
|
13
18
|
</template>
|
|
14
19
|
|
|
@@ -32,7 +37,9 @@ export default {
|
|
|
32
37
|
PdfJs: null,
|
|
33
38
|
svgArr: [],
|
|
34
39
|
container: null,
|
|
35
|
-
pdfPages: 0
|
|
40
|
+
pdfPages: 0,
|
|
41
|
+
loading: true,
|
|
42
|
+
repeat: false,
|
|
36
43
|
}
|
|
37
44
|
},
|
|
38
45
|
props: {
|
|
@@ -44,17 +51,28 @@ export default {
|
|
|
44
51
|
watch: {
|
|
45
52
|
url: {
|
|
46
53
|
handler: function (val, oldVal) {
|
|
47
|
-
this.
|
|
48
|
-
if(this.fileType === 'pdf') this.init()
|
|
54
|
+
this.repeatInit()
|
|
49
55
|
},
|
|
50
56
|
immediate: true
|
|
51
57
|
}
|
|
52
58
|
},
|
|
53
59
|
mounted() {
|
|
54
|
-
this.
|
|
55
|
-
if(this.fileType === 'pdf') this.init()
|
|
60
|
+
this.repeatInit()
|
|
56
61
|
},
|
|
57
62
|
methods: {
|
|
63
|
+
repeatInit() {
|
|
64
|
+
if(this.repeat) return // 防止重复加载
|
|
65
|
+
this.repeat = true
|
|
66
|
+
this.loading = true
|
|
67
|
+
this.fileType = this.url.split('.').pop()
|
|
68
|
+
if(this.fileType === 'pdf') this.init()
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
this.repeat = false
|
|
71
|
+
},1000)
|
|
72
|
+
},
|
|
73
|
+
renderedHandler() {
|
|
74
|
+
this.loading = false
|
|
75
|
+
},
|
|
58
76
|
init() {
|
|
59
77
|
let that = this
|
|
60
78
|
const loadingTask = PdfJs.getDocument(this.url)
|
|
@@ -106,6 +124,7 @@ export default {
|
|
|
106
124
|
document.getElementById('canvas-wrap').appendChild(container)
|
|
107
125
|
container.appendChild(x.data)
|
|
108
126
|
})
|
|
127
|
+
this.renderedHandler()
|
|
109
128
|
},
|
|
110
129
|
}
|
|
111
130
|
}
|
|
@@ -130,6 +149,7 @@ export default {
|
|
|
130
149
|
.read{
|
|
131
150
|
width: 100%;
|
|
132
151
|
height: 100%;
|
|
152
|
+
position: relative;
|
|
133
153
|
}
|
|
134
154
|
:deep(.vue-office-docx)::-webkit-scrollbar {
|
|
135
155
|
width: 0
|
|
@@ -137,4 +157,50 @@ export default {
|
|
|
137
157
|
:deep(.docx-wrapper) {
|
|
138
158
|
background-color: #fff;
|
|
139
159
|
}
|
|
160
|
+
.loading-back{
|
|
161
|
+
position: absolute;
|
|
162
|
+
top: 0;
|
|
163
|
+
left: 0;
|
|
164
|
+
right: 0;
|
|
165
|
+
bottom: 0;
|
|
166
|
+
z-index: 100;
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
}
|
|
170
|
+
.loading-cont{
|
|
171
|
+
display: inline-block;
|
|
172
|
+
margin: 0 auto;
|
|
173
|
+
}
|
|
174
|
+
.loading {
|
|
175
|
+
display: inline-block;
|
|
176
|
+
font-size: 28px;
|
|
177
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
178
|
+
font-weight: bold;
|
|
179
|
+
color: #fff;
|
|
180
|
+
text-shadow: 0 0 2px #ff3d00, 0 0 1px #ff3d00, 0 0 1px #ff3d00;
|
|
181
|
+
letter-spacing: 2px;
|
|
182
|
+
position: relative;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.loading::after {
|
|
186
|
+
content: "Loading";
|
|
187
|
+
position: absolute;
|
|
188
|
+
left: 0;
|
|
189
|
+
top: 0;
|
|
190
|
+
color: #ff3d00;
|
|
191
|
+
width: 0%;
|
|
192
|
+
height: 100%;
|
|
193
|
+
overflow: hidden;
|
|
194
|
+
animation: loading-animation 6s linear infinite;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
@keyframes loading-animation {
|
|
198
|
+
0% {
|
|
199
|
+
width: 0%;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
100% {
|
|
203
|
+
width: 100%;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
140
206
|
</style>
|
|
@@ -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) => {
|