centaline-data-driven 1.2.98 → 1.2.99
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 +2 -2
- package/src/centaline/dynamicViewerFile/index.js +11 -0
- package/src/centaline/dynamicViewerFile/src/dynamicViewerFile.vue +373 -0
- package/src/centaline/dynamicViewerFile/src/dynamicViewerImage.vue +147 -0
- package/src/centaline/dynamicViewerFile/src/dynamicViewerPDF.vue +73 -0
- package/src/centaline/dynamicViewerFile/src/dynamicViewerVR.vue +76 -0
- package/wwwroot/static/centaline/6032ad6e6e5a3ca138d5.worker.js +8 -0
- package/wwwroot/static/centaline/6032ad6e6e5a3ca138d5.worker.js.map +1 -0
- package/wwwroot/static/centaline/centaline-data-driven.js +9 -3
- package/wwwroot/static/centaline/centaline-data-driven.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "centaline-data-driven",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.99",
|
|
4
4
|
"description": "ccai",
|
|
5
5
|
"author": "hjc <3226136347@qq.com>",
|
|
6
6
|
"private": false,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"save": "^2.4.0",
|
|
22
22
|
"v-viewer": "^1.6.4",
|
|
23
23
|
"vue": "2.5.17",
|
|
24
|
-
"vue-pdf": "^4.0
|
|
24
|
+
"vue-pdf": "^4.3.0",
|
|
25
25
|
"vue-ueditor-wrap": "^2.5.6",
|
|
26
26
|
"vuedraggable": "^2.24.3"
|
|
27
27
|
},
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import dynamicViewerFile from './src/dynamicViewerFile'
|
|
2
|
+
|
|
3
|
+
dynamicViewerFile.install = function (Vue) {
|
|
4
|
+
Vue.component(dynamicViewerFile.name, dynamicViewerFile);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
if (typeof window !== 'undefined' && window.Vue) {
|
|
8
|
+
window.Vue.use(dynamicViewerFile);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default dynamicViewerFile;
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="height: 100%" id="viewer-file">
|
|
3
|
+
<el-container style="height: 100%; border: 1px solid #eee">
|
|
4
|
+
<el-aside style="background-color: rgb(238, 241, 246)"
|
|
5
|
+
><div>
|
|
6
|
+
<el-menu :default-openeds="openeds" :default-active="activeitem">
|
|
7
|
+
<el-submenu
|
|
8
|
+
:key="groupIndex"
|
|
9
|
+
:index="groupIndex.toString()"
|
|
10
|
+
v-for="(group, groupIndex) in MediaAlbum"
|
|
11
|
+
>
|
|
12
|
+
<template slot="title"> <i></i>{{ group.albumName }} </template>
|
|
13
|
+
<el-menu-item-group>
|
|
14
|
+
<el-menu-item
|
|
15
|
+
@click="handleClick(item, groupIndex, index)"
|
|
16
|
+
:key="index"
|
|
17
|
+
:index="groupIndex.toString() + '-' + index.toString()"
|
|
18
|
+
v-for="(item, index) in group.medias"
|
|
19
|
+
>{{ item.mediaLabelName || item.fileName }}</el-menu-item
|
|
20
|
+
>
|
|
21
|
+
</el-menu-item-group>
|
|
22
|
+
</el-submenu>
|
|
23
|
+
</el-menu>
|
|
24
|
+
</div>
|
|
25
|
+
</el-aside>
|
|
26
|
+
<el-main>
|
|
27
|
+
<div
|
|
28
|
+
style="position: relative; width: 100%; height: 100%"
|
|
29
|
+
v-if="resultObject"
|
|
30
|
+
>
|
|
31
|
+
<!--VR-->
|
|
32
|
+
<template v-if="itemFile.mediaTypeID == '1'">
|
|
33
|
+
<div
|
|
34
|
+
class="viewerContent"
|
|
35
|
+
style="height: 100%; width: 800px; text-align: center"
|
|
36
|
+
>
|
|
37
|
+
暂不支持VR
|
|
38
|
+
<!-- <ct-viewerVR :VRUrl="resultObject"> </ct-viewerVR> -->
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
<!--Photo-->
|
|
42
|
+
<template v-else-if="itemFile.mediaTypeID == '2'">
|
|
43
|
+
<ct-viewerImage
|
|
44
|
+
ref="viewerImage"
|
|
45
|
+
:imgUrl="resultObject"
|
|
46
|
+
:rotate="rotate"
|
|
47
|
+
></ct-viewerImage>
|
|
48
|
+
</template>
|
|
49
|
+
<!--ThreeDimensional-->
|
|
50
|
+
<template v-else-if="itemFile.mediaTypeID == '3'"
|
|
51
|
+
>暂不支持ThreeDimensional
|
|
52
|
+
</template>
|
|
53
|
+
<!--Video-->
|
|
54
|
+
<template v-else-if="itemFile.mediaTypeID == '4'">
|
|
55
|
+
<div class="viewerContent">
|
|
56
|
+
<video
|
|
57
|
+
preload="none"
|
|
58
|
+
:src="resultObject"
|
|
59
|
+
controls="controls"
|
|
60
|
+
class="viewerContent"
|
|
61
|
+
controlslist="nodownload"
|
|
62
|
+
:height="500"
|
|
63
|
+
:width="800"
|
|
64
|
+
>
|
|
65
|
+
您的浏览器不支持 video 标签。
|
|
66
|
+
</video>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
<!--Audio-->
|
|
70
|
+
<template v-else-if="itemFile.mediaTypeID == '5'">
|
|
71
|
+
<div class="viewerContent">
|
|
72
|
+
<audio
|
|
73
|
+
preload="none"
|
|
74
|
+
:src="resultObject"
|
|
75
|
+
controls="controls"
|
|
76
|
+
class="viewerContent"
|
|
77
|
+
controlslist="nodownload"
|
|
78
|
+
style="width: 50%"
|
|
79
|
+
>
|
|
80
|
+
您的浏览器不支持 audio 标签。
|
|
81
|
+
</audio>
|
|
82
|
+
</div>
|
|
83
|
+
</template>
|
|
84
|
+
<!--File-->
|
|
85
|
+
<template v-else-if="itemFile.mediaTypeID == '6'">
|
|
86
|
+
<template
|
|
87
|
+
v-if="'doc,docx,xlsx'.search(FileExtension(itemFile)) > -1"
|
|
88
|
+
>
|
|
89
|
+
<div
|
|
90
|
+
class="viewerContent"
|
|
91
|
+
style="height: 100px; text-align: center"
|
|
92
|
+
>
|
|
93
|
+
<a :href="resultObject">
|
|
94
|
+
<img :src="itemFile.thumbnailUrl" /><br />{{
|
|
95
|
+
itemFile.mediaLabelName || itemFile.fileName
|
|
96
|
+
}}</a
|
|
97
|
+
>
|
|
98
|
+
</div>
|
|
99
|
+
</template>
|
|
100
|
+
<template v-else-if="'pdf'.search(FileExtension(itemFile)) > -1">
|
|
101
|
+
<div
|
|
102
|
+
class="viewerContent"
|
|
103
|
+
style="height: 100%; width: 800px; text-align: center"
|
|
104
|
+
>
|
|
105
|
+
<ct-viewerPDF :pdfUrl="resultObject"> </ct-viewerPDF>
|
|
106
|
+
</div>
|
|
107
|
+
</template>
|
|
108
|
+
</template>
|
|
109
|
+
<template v-else> 不支持此类型:{{ itemFile.mediaTypeID }} </template>
|
|
110
|
+
|
|
111
|
+
<template v-if="resultObject != ''">
|
|
112
|
+
<div class="magnify-footer">
|
|
113
|
+
<div class="magnify-toolbar">
|
|
114
|
+
<a
|
|
115
|
+
href="javascript:void(0)"
|
|
116
|
+
class="magnify-btn el-icon-back"
|
|
117
|
+
title="上一张"
|
|
118
|
+
@click="jump(-1)"
|
|
119
|
+
></a
|
|
120
|
+
><a
|
|
121
|
+
href="javascript:void(0)"
|
|
122
|
+
class="magnify-btn el-icon-right"
|
|
123
|
+
title="下一张"
|
|
124
|
+
@click="jump(1)"
|
|
125
|
+
></a>
|
|
126
|
+
<template v-if="itemFile.mediaTypeID == '2'">
|
|
127
|
+
<a
|
|
128
|
+
href="javascript:void(0)"
|
|
129
|
+
class="magnify-btn el-icon-refresh-left"
|
|
130
|
+
title="左旋转"
|
|
131
|
+
@click="rotateImg('L')"
|
|
132
|
+
></a
|
|
133
|
+
><a
|
|
134
|
+
href="javascript:void(0)"
|
|
135
|
+
class="magnify-btn el-icon-refresh-right"
|
|
136
|
+
title="右旋转"
|
|
137
|
+
@click="rotateImg('R')"
|
|
138
|
+
></a
|
|
139
|
+
><a
|
|
140
|
+
href="javascript:void(0)"
|
|
141
|
+
class="magnify-btn el-icon-zoom-in"
|
|
142
|
+
title="放大"
|
|
143
|
+
@click="zoom(0.2)"
|
|
144
|
+
></a
|
|
145
|
+
><a
|
|
146
|
+
href="javascript:void(0)"
|
|
147
|
+
class="magnify-btn el-icon-refresh"
|
|
148
|
+
title="实际尺寸"
|
|
149
|
+
@click="actualSize()"
|
|
150
|
+
></a
|
|
151
|
+
><a
|
|
152
|
+
href="javascript:void(0)"
|
|
153
|
+
class="magnify-btn el-icon-zoom-out"
|
|
154
|
+
title="缩小"
|
|
155
|
+
@click="zoom(-0.2)"
|
|
156
|
+
>
|
|
157
|
+
</a> </template
|
|
158
|
+
><a
|
|
159
|
+
href="javascript:void(0)"
|
|
160
|
+
class="magnify-btn el-icon-download"
|
|
161
|
+
title="下载"
|
|
162
|
+
></a>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
</template>
|
|
166
|
+
</div>
|
|
167
|
+
</el-main>
|
|
168
|
+
</el-container>
|
|
169
|
+
</div>
|
|
170
|
+
</template>
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
<script>
|
|
174
|
+
import dynamicElement from "../../mixins/dynamicElement";
|
|
175
|
+
import dynamicViewerImage from "./dynamicViewerImage.vue";
|
|
176
|
+
import dynamicViewerPDF from "./dynamicViewerPDF.vue";
|
|
177
|
+
//import dynamicViewerVR from "./dynamicViewerVR.vue";
|
|
178
|
+
export default {
|
|
179
|
+
name: "ct-viewerfile",
|
|
180
|
+
mixins: [dynamicElement],
|
|
181
|
+
components: {
|
|
182
|
+
"ct-viewerImage": dynamicViewerImage,
|
|
183
|
+
"ct-viewerPDF": dynamicViewerPDF,
|
|
184
|
+
// "ct-viewerVR": dynamicViewerVR,
|
|
185
|
+
},
|
|
186
|
+
props: {
|
|
187
|
+
MediaAlbum: Array,
|
|
188
|
+
groupIndex: Number,
|
|
189
|
+
index: Number,
|
|
190
|
+
},
|
|
191
|
+
data() {
|
|
192
|
+
return {
|
|
193
|
+
rotate: 0,
|
|
194
|
+
activeIndex: -1,
|
|
195
|
+
activeGroup: -1,
|
|
196
|
+
resultObject: "",
|
|
197
|
+
itemFile: {},
|
|
198
|
+
groupCountLen: 0,
|
|
199
|
+
activeitem: "",
|
|
200
|
+
openeds: [],
|
|
201
|
+
};
|
|
202
|
+
},
|
|
203
|
+
created() {
|
|
204
|
+
var self = this;
|
|
205
|
+
this.groupCountLen = 0;
|
|
206
|
+
this.MediaAlbum.forEach((item, n) => {
|
|
207
|
+
self.openeds.push(n.toString());
|
|
208
|
+
item.medias.forEach((v) => {
|
|
209
|
+
this.groupCountLen++;
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
mounted() {
|
|
214
|
+
|
|
215
|
+
if (
|
|
216
|
+
this.groupIndex != undefined &&
|
|
217
|
+
this.index != undefined &&
|
|
218
|
+
this.groupIndex > -1 &&
|
|
219
|
+
this.index > -1
|
|
220
|
+
) {
|
|
221
|
+
var item = this.MediaAlbum[this.groupIndex].medias[this.index];
|
|
222
|
+
this.handleClick(item, this.groupIndex, this.index);
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
methods: {
|
|
226
|
+
FileExtension(item) {
|
|
227
|
+
return item.savedFileName.replace(/.+\./, "").toLowerCase();
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
handleClick(item, groupIndex, index) {
|
|
231
|
+
if (index == this.activeIndex && groupIndex == this.activeGroup) return;
|
|
232
|
+
this.activeIndex = index;
|
|
233
|
+
this.activeGroup = groupIndex;
|
|
234
|
+
this.itemFile = item;
|
|
235
|
+
|
|
236
|
+
this.activeitem = groupIndex + "-" + index;
|
|
237
|
+
|
|
238
|
+
this.resultObject = this.itemFile.mediaUrl;
|
|
239
|
+
|
|
240
|
+
this.$forceUpdate();
|
|
241
|
+
},
|
|
242
|
+
jump(n) {
|
|
243
|
+
var item = {};
|
|
244
|
+
var groupIndex = this.activeGroup;
|
|
245
|
+
var index = -1;
|
|
246
|
+
if (n > 0) {
|
|
247
|
+
if (
|
|
248
|
+
this.activeGroup * 1 + this.activeIndex + 1 + n >=
|
|
249
|
+
this.groupCountLen
|
|
250
|
+
) {
|
|
251
|
+
groupIndex = 0;
|
|
252
|
+
index = 0;
|
|
253
|
+
} else {
|
|
254
|
+
if (this.MediaAlbum[this.activeGroup].medias[this.activeIndex + n]) {
|
|
255
|
+
index = this.activeIndex + n;
|
|
256
|
+
} else {
|
|
257
|
+
if (
|
|
258
|
+
this.MediaAlbum[this.activeGroup + n] &&
|
|
259
|
+
this.MediaAlbum[this.activeGroup + n].medias[0]
|
|
260
|
+
) {
|
|
261
|
+
index = 0;
|
|
262
|
+
groupIndex = this.activeGroup + n;
|
|
263
|
+
} else {
|
|
264
|
+
groupIndex = 0;
|
|
265
|
+
index = 0;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
} else if (n < 0) {
|
|
270
|
+
if (this.activeGroup * 1 + this.activeIndex + n < 0) {
|
|
271
|
+
groupIndex = this.MediaAlbum.length - 1;
|
|
272
|
+
index = this.MediaAlbum[groupIndex].medias.length - 1;
|
|
273
|
+
} else {
|
|
274
|
+
if (this.MediaAlbum[this.activeGroup].medias[this.activeIndex + n]) {
|
|
275
|
+
index = this.activeIndex + n;
|
|
276
|
+
} else {
|
|
277
|
+
if (
|
|
278
|
+
this.MediaAlbum[this.activeGroup + n].medias[
|
|
279
|
+
this.MediaAlbum[this.activeGroup + n].medias.length - 1
|
|
280
|
+
]
|
|
281
|
+
) {
|
|
282
|
+
index = this.MediaAlbum[this.activeGroup + n].medias.length - 1;
|
|
283
|
+
groupIndex = this.activeGroup + n;
|
|
284
|
+
} else {
|
|
285
|
+
groupIndex = this.MediaAlbum.length - 1;
|
|
286
|
+
index = this.MediaAlbum[groupIndex].medias.length - 1;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
item = this.MediaAlbum[groupIndex].medias[index];
|
|
292
|
+
this.handleClick(item, groupIndex, index);
|
|
293
|
+
},
|
|
294
|
+
|
|
295
|
+
//旋转图片
|
|
296
|
+
rotateImg(type) {
|
|
297
|
+
var currentDeg = this.rotate || 0;
|
|
298
|
+
|
|
299
|
+
if (type == "L") {
|
|
300
|
+
currentDeg = currentDeg - 90;
|
|
301
|
+
} else if (type == "R") {
|
|
302
|
+
currentDeg = currentDeg + 90;
|
|
303
|
+
}
|
|
304
|
+
if (Math.abs(currentDeg) >= 360) {
|
|
305
|
+
currentDeg = currentDeg % 360;
|
|
306
|
+
}
|
|
307
|
+
this.rotate = currentDeg;
|
|
308
|
+
this.$forceUpdate();
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
actualSize() {
|
|
312
|
+
this.rotate = 0;
|
|
313
|
+
this.$refs.viewerImage.actualSize();
|
|
314
|
+
},
|
|
315
|
+
zoom(n) {
|
|
316
|
+
this.$refs.viewerImage.zoom(n);
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
};
|
|
320
|
+
// 禁止右键菜单
|
|
321
|
+
document.oncontextmenu = function () {
|
|
322
|
+
return false;
|
|
323
|
+
};
|
|
324
|
+
</script>
|
|
325
|
+
|
|
326
|
+
<style>
|
|
327
|
+
body,
|
|
328
|
+
html {
|
|
329
|
+
height: 100%;
|
|
330
|
+
}
|
|
331
|
+
#viewer-file .el-container {
|
|
332
|
+
margin-bottom: 40px;
|
|
333
|
+
height: 100%;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.viewerContent {
|
|
337
|
+
cursor: move;
|
|
338
|
+
position: absolute !important;
|
|
339
|
+
top: 0;
|
|
340
|
+
bottom: 0;
|
|
341
|
+
left: 0;
|
|
342
|
+
right: 0;
|
|
343
|
+
margin: auto;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.magnify-footer {
|
|
347
|
+
width: calc(100vw - 340px);
|
|
348
|
+
position: fixed;
|
|
349
|
+
height: 50px;
|
|
350
|
+
bottom: 20px;
|
|
351
|
+
text-align: center;
|
|
352
|
+
color: #fff;
|
|
353
|
+
z-index: 9;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.magnify-toolbar {
|
|
357
|
+
display: inline-block;
|
|
358
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
359
|
+
-webkit-border-radius: 5px 5px 0 0;
|
|
360
|
+
-moz-border-radius: 5px 5px 0 0;
|
|
361
|
+
border-radius: 5px 5px 0 0;
|
|
362
|
+
}
|
|
363
|
+
.magnify-toolbar .magnify-btn {
|
|
364
|
+
margin: 15px 20px;
|
|
365
|
+
color: #999;
|
|
366
|
+
font-size: 25px;
|
|
367
|
+
font-weight: 800;
|
|
368
|
+
}
|
|
369
|
+
.magnify-toolbar .magnify-btn:hover,
|
|
370
|
+
.magnify-btn-close:hover {
|
|
371
|
+
color: #fff;
|
|
372
|
+
}
|
|
373
|
+
</style>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<div class="Imagebox" @mousewheel="bagimg($event)">
|
|
4
|
+
<img
|
|
5
|
+
id="ViewerImage"
|
|
6
|
+
class="scaleimg"
|
|
7
|
+
border="0"
|
|
8
|
+
v-bind:style="{
|
|
9
|
+
transform:
|
|
10
|
+
'scale(' +
|
|
11
|
+
(params.zoomVal || 1) +
|
|
12
|
+
') rotate(' +
|
|
13
|
+
(rotate || 0) +
|
|
14
|
+
'deg)',
|
|
15
|
+
}"
|
|
16
|
+
:src="imgUrl"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
<script>
|
|
21
|
+
export default {
|
|
22
|
+
props: {
|
|
23
|
+
imgUrl: String,
|
|
24
|
+
rotate: Number,
|
|
25
|
+
},
|
|
26
|
+
data() {
|
|
27
|
+
return {
|
|
28
|
+
params: {
|
|
29
|
+
zoomVal: 1,
|
|
30
|
+
left: 0,
|
|
31
|
+
top: 0,
|
|
32
|
+
currentX: 0,
|
|
33
|
+
currentY: 0,
|
|
34
|
+
flag: false,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
mounted() {
|
|
39
|
+
this.startDrag(
|
|
40
|
+
document.getElementById("ViewerImage"),
|
|
41
|
+
document.getElementById("ViewerImage")
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
methods: {
|
|
45
|
+
zoom(n) {
|
|
46
|
+
this.params.zoomVal += n;
|
|
47
|
+
},
|
|
48
|
+
actualSize() {
|
|
49
|
+
this.params = {
|
|
50
|
+
zoomVal: 1,
|
|
51
|
+
left: 0,
|
|
52
|
+
top: 0,
|
|
53
|
+
currentX: 0,
|
|
54
|
+
currentY: 0,
|
|
55
|
+
flag: false,
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
bagimg(e) {
|
|
60
|
+
var e = document.getElementById("ViewerImage");
|
|
61
|
+
this.params.zoomVal += event.wheelDelta / 1200;
|
|
62
|
+
if (this.params.zoomVal >= 0.2) {
|
|
63
|
+
} else {
|
|
64
|
+
this.params.zoomVal = 0.2;
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
getImgCss(e, key) {
|
|
69
|
+
return e.currentStyle
|
|
70
|
+
? e.currentStyle[key]
|
|
71
|
+
: document.defaultView.getComputedStyle(e, false)[key];
|
|
72
|
+
},
|
|
73
|
+
startDrag(bar, target, callback) {
|
|
74
|
+
let that = this;
|
|
75
|
+
if (that.getImgCss(target, "left") !== "auto") {
|
|
76
|
+
that.params.left = that.getImgCss(target, "left");
|
|
77
|
+
}
|
|
78
|
+
if (that.getImgCss(target, "top") !== "auto") {
|
|
79
|
+
that.params.top = that.getImgCss(target, "top");
|
|
80
|
+
}
|
|
81
|
+
bar.onmousedown = function (event) {
|
|
82
|
+
that.params.flag = true;
|
|
83
|
+
if (!event) {
|
|
84
|
+
event = window.event;
|
|
85
|
+
bar.onselectstart = function () {
|
|
86
|
+
return false;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
let e = event;
|
|
90
|
+
that.params.currentX = e.clientX;
|
|
91
|
+
that.params.currentY = e.clientY;
|
|
92
|
+
};
|
|
93
|
+
document.onmouseup = function () {
|
|
94
|
+
that.params.flag = false;
|
|
95
|
+
if (that.getImgCss(target, "left") !== "auto") {
|
|
96
|
+
that.params.left = that.getImgCss(target, "left");
|
|
97
|
+
}
|
|
98
|
+
if (that.getImgCss(target, "top") !== "auto") {
|
|
99
|
+
that.params.top = that.getImgCss(target, "top");
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
document.onmousemove = function (event) {
|
|
103
|
+
let e = event ? event : window.event;
|
|
104
|
+
if (that.params.flag) {
|
|
105
|
+
let nowX = e.clientX,
|
|
106
|
+
nowY = e.clientY;
|
|
107
|
+
let disX = nowX - that.params.currentX,
|
|
108
|
+
disY = nowY - that.params.currentY;
|
|
109
|
+
target.style.left = parseInt(that.params.left) + disX + "px";
|
|
110
|
+
target.style.top = parseInt(that.params.top) + disY + "px";
|
|
111
|
+
if (typeof callback == "function") {
|
|
112
|
+
callback(
|
|
113
|
+
(parseInt(that.params.left) || 0) + disX,
|
|
114
|
+
(parseInt(that.params.top) || 0) + disY
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
if (event.preventDefault) {
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
}
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<style>
|
|
129
|
+
.Imagebox {
|
|
130
|
+
position: relative;
|
|
131
|
+
width: 100%;
|
|
132
|
+
height: 100%;
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.scaleimg {
|
|
137
|
+
max-height: 100%;
|
|
138
|
+
max-width: 100%;
|
|
139
|
+
cursor: move;
|
|
140
|
+
position: absolute;
|
|
141
|
+
top: 0;
|
|
142
|
+
bottom: 0;
|
|
143
|
+
left: 0;
|
|
144
|
+
right: 0;
|
|
145
|
+
margin: auto;
|
|
146
|
+
}
|
|
147
|
+
</style>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<div>
|
|
4
|
+
<pdf
|
|
5
|
+
v-for="i in numPages"
|
|
6
|
+
:key="i"
|
|
7
|
+
:src="fileUrl"
|
|
8
|
+
:page="i"
|
|
9
|
+
style="width: 100%"
|
|
10
|
+
>
|
|
11
|
+
</pdf>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<script>
|
|
15
|
+
import pdf from "vue-pdf";
|
|
16
|
+
export default {
|
|
17
|
+
components: {
|
|
18
|
+
pdf,
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
pdfUrl: String,
|
|
22
|
+
},
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
numPages: 1,
|
|
26
|
+
fileUrl: "",
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
mounted() {
|
|
30
|
+
this.init(this.pdfUrl);
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
init(pdfUrl) {
|
|
34
|
+
var self = this;
|
|
35
|
+
var loadingTask = pdf.createLoadingTask(pdfUrl);
|
|
36
|
+
loadingTask
|
|
37
|
+
.then((pdf) => {
|
|
38
|
+
self.fileUrl = loadingTask;
|
|
39
|
+
self.numPages = pdf.numPages;
|
|
40
|
+
})
|
|
41
|
+
.catch((err) => {
|
|
42
|
+
console.error("pdf加载失败");
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
watch: {
|
|
47
|
+
pdfUrl(newValue, oldValue) {
|
|
48
|
+
this.init(newValue);
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<style>
|
|
55
|
+
.Imagebox {
|
|
56
|
+
position: relative;
|
|
57
|
+
width: 100%;
|
|
58
|
+
height: 100%;
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.scaleimg {
|
|
63
|
+
max-height: 100%;
|
|
64
|
+
max-width: 100%;
|
|
65
|
+
cursor: move;
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: 0;
|
|
68
|
+
bottom: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
right: 0;
|
|
71
|
+
margin: auto;
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="viewer"></div>
|
|
3
|
+
</template>
|
|
4
|
+
<script>
|
|
5
|
+
import { Viewer } from "photo-sphere-viewer";
|
|
6
|
+
import "photo-sphere-viewer/dist/photo-sphere-viewer.css";
|
|
7
|
+
// import MarkersPlugin from "photo-sphere-viewer/dist/plugins/markers";
|
|
8
|
+
// import "photo-sphere-viewer/dist/plugins/markers.css";
|
|
9
|
+
export default {
|
|
10
|
+
props: {
|
|
11
|
+
VRUrl: String,
|
|
12
|
+
},
|
|
13
|
+
data() {
|
|
14
|
+
return {
|
|
15
|
+
viewer: "",
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
mounted() {
|
|
19
|
+
this.init(this.VRUrl);
|
|
20
|
+
},
|
|
21
|
+
methods: {
|
|
22
|
+
init(VRUrl) {
|
|
23
|
+
this.viewer = new Viewer({
|
|
24
|
+
// navbar: [
|
|
25
|
+
// "autorotate",
|
|
26
|
+
// "zoomOut",
|
|
27
|
+
// "zoomIn",
|
|
28
|
+
// "zoom",
|
|
29
|
+
// "move",
|
|
30
|
+
// //'download',
|
|
31
|
+
// "fullscreen",
|
|
32
|
+
// ],
|
|
33
|
+
container: document.querySelector("#viewer"),
|
|
34
|
+
panorama: this.VRUrl,
|
|
35
|
+
size: {
|
|
36
|
+
width: "80%",
|
|
37
|
+
height: "80%",
|
|
38
|
+
},
|
|
39
|
+
// plugins: [
|
|
40
|
+
// [
|
|
41
|
+
// MarkersPlugin,
|
|
42
|
+
// {
|
|
43
|
+
// markers: [
|
|
44
|
+
// {
|
|
45
|
+
// id: "circle",
|
|
46
|
+
// tooltip: "A circle of radius 30",
|
|
47
|
+
// circle: 30,
|
|
48
|
+
// svgStyle: {
|
|
49
|
+
// fill: "rgba(255,255,0,0.3)",
|
|
50
|
+
// stroke: "yellow",
|
|
51
|
+
// strokeWidth: "2px",
|
|
52
|
+
// },
|
|
53
|
+
// longitude: -1.5,
|
|
54
|
+
// latitude: -0.28,
|
|
55
|
+
// anchor: "center right",
|
|
56
|
+
// },
|
|
57
|
+
// ],
|
|
58
|
+
// },
|
|
59
|
+
// ],
|
|
60
|
+
// ],
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
watch: {
|
|
65
|
+
VRUrl(newValue, oldValue) {
|
|
66
|
+
this.init(newValue);
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<style scoped>
|
|
73
|
+
#container {
|
|
74
|
+
height: 400px;
|
|
75
|
+
}
|
|
76
|
+
</style>
|