icve-urc 1.0.0
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/README.en.md +36 -0
- package/README.md +24 -0
- package/dist/demo.html +10 -0
- package/dist/icve-urc.common.js +114103 -0
- package/dist/icve-urc.common.js.map +1 -0
- package/dist/icve-urc.css +1 -0
- package/dist/icve-urc.umd.js +114113 -0
- package/dist/icve-urc.umd.js.map +1 -0
- package/dist/icve-urc.umd.min.js +75 -0
- package/dist/icve-urc.umd.min.js.map +1 -0
- package/package.json +33 -0
- package/src/App copy.vue +116 -0
- package/src/App.vue +125 -0
- package/src/api/resourceManagement/index.js +33 -0
- package/src/assets/img/error.png +0 -0
- package/src/assets/img/file.png +0 -0
- package/src/assets/img/icon-pic.png +0 -0
- package/src/assets/img/icon_audio.png +0 -0
- package/src/assets/img/icon_excel.png +0 -0
- package/src/assets/img/icon_other.png +0 -0
- package/src/assets/img/icon_pdf.png +0 -0
- package/src/assets/img/icon_ppt.png +0 -0
- package/src/assets/img/icon_txt_s.png +0 -0
- package/src/assets/img/icon_vedio.png +0 -0
- package/src/assets/img/icon_word.png +0 -0
- package/src/assets/img/icon_zip.png +0 -0
- package/src/assets/img/loading.gif +0 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/styles/btn.scss +99 -0
- package/src/assets/styles/element-ui.scss +92 -0
- package/src/assets/styles/element-variables.scss +31 -0
- package/src/assets/styles/icon/demo.css +539 -0
- package/src/assets/styles/icon/demo_index.html +556 -0
- package/src/assets/styles/icon/iconfont.css +79 -0
- package/src/assets/styles/icon/iconfont.js +1 -0
- package/src/assets/styles/icon/iconfont.json +121 -0
- package/src/assets/styles/icon/iconfont.ttf +0 -0
- package/src/assets/styles/icon/iconfont.woff +0 -0
- package/src/assets/styles/icon/iconfont.woff2 +0 -0
- package/src/assets/styles/index.scss +252 -0
- package/src/assets/styles/mixin.scss +66 -0
- package/src/assets/styles/ruoyi.scss +273 -0
- package/src/assets/styles/sidebar.scss +249 -0
- package/src/assets/styles/transition.scss +53 -0
- package/src/assets/styles/variables.scss +54 -0
- package/src/components/AliPlayer.vue +158 -0
- package/src/components/Pagination/index.vue +119 -0
- package/src/components/fileImport.vue +466 -0
- package/src/components/filePreview.vue +670 -0
- package/src/components/fileUpload.vue +752 -0
- package/src/components/treeCompontent.vue +277 -0
- package/src/main.js +26 -0
- package/src/router/index.js +22 -0
- package/src/utils/auth.js +15 -0
- package/src/utils/errorCode.js +6 -0
- package/src/utils/request.js +63 -0
- package/src/utils/scroll-to.js +58 -0
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
<!-- 文件预览 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div
|
|
4
|
+
class="FilePreview"
|
|
5
|
+
v-loading="loading"
|
|
6
|
+
element-loading-text="加载中"
|
|
7
|
+
ref="FilePreview"
|
|
8
|
+
>
|
|
9
|
+
<div class="info">
|
|
10
|
+
<!-- 文档预览 -->
|
|
11
|
+
<div
|
|
12
|
+
v-if="curType == 'office' || curType == 'pic'"
|
|
13
|
+
v-loading="photoList.length == 0"
|
|
14
|
+
element-loading-text="加载中"
|
|
15
|
+
class="office"
|
|
16
|
+
style="padding: 0 30px; height: 100%"
|
|
17
|
+
>
|
|
18
|
+
<el-carousel
|
|
19
|
+
ref="carousel"
|
|
20
|
+
:autoplay="false"
|
|
21
|
+
class="carousel"
|
|
22
|
+
:loop="false"
|
|
23
|
+
indicator-position="none"
|
|
24
|
+
@change="carouselChange"
|
|
25
|
+
>
|
|
26
|
+
<el-carousel-item v-for="(item, index) in photoList" :key="index">
|
|
27
|
+
<img
|
|
28
|
+
ref="preview"
|
|
29
|
+
class="img-preview"
|
|
30
|
+
v-lazy="item"
|
|
31
|
+
oncontextmenu="return false;"
|
|
32
|
+
title="点击放大查看"
|
|
33
|
+
@click="changeShow(item)"
|
|
34
|
+
@load="handleImageLoaded"
|
|
35
|
+
/>
|
|
36
|
+
</el-carousel-item>
|
|
37
|
+
</el-carousel>
|
|
38
|
+
<div class="page" v-if="curType == 'office'">
|
|
39
|
+
<el-button plain size="mini" type="primary" @click="prev"
|
|
40
|
+
>上一页
|
|
41
|
+
</el-button>
|
|
42
|
+
{{ carouselIndex + 1 }} / {{ photoList.length }}
|
|
43
|
+
<el-button plain size="mini" type="primary" @click="next"
|
|
44
|
+
>下一页
|
|
45
|
+
</el-button>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
<!-- 视频预览 -->
|
|
49
|
+
<div v-else-if="curType == 'video'" class="video">
|
|
50
|
+
<AliPlayer
|
|
51
|
+
:source="vodSource"
|
|
52
|
+
:options="playerOptions"
|
|
53
|
+
:savedProgress="progress"
|
|
54
|
+
:isDrag="isDrag"
|
|
55
|
+
@loadedmetadata="handleVideoMetadata1"
|
|
56
|
+
@pause="handleVideoPause1"
|
|
57
|
+
@play="handleVideoPlay1"
|
|
58
|
+
@ended="handleVideoEnd1"
|
|
59
|
+
/>
|
|
60
|
+
<!-- <video
|
|
61
|
+
ref="video"
|
|
62
|
+
:src="videoUrl"
|
|
63
|
+
@pause="handleVideoPause"
|
|
64
|
+
@play="handleVideoPlay"
|
|
65
|
+
@ended="handleVideoEnd"
|
|
66
|
+
@loadedmetadata="handleVideoMetadata"
|
|
67
|
+
controls
|
|
68
|
+
@timeupdate="handleTimeUpdate"
|
|
69
|
+
></video> -->
|
|
70
|
+
</div>
|
|
71
|
+
<!-- 音频预览 -->
|
|
72
|
+
<div v-else-if="curType == 'audio'" class="audio">
|
|
73
|
+
<audio
|
|
74
|
+
ref="audio"
|
|
75
|
+
controls="controls"
|
|
76
|
+
@pause="handleVideoPause"
|
|
77
|
+
@play="handleVideoPlay"
|
|
78
|
+
@ended="handleVideoEnd"
|
|
79
|
+
@loadedmetadata="handleVideoMetadata"
|
|
80
|
+
@timeupdate="handleTimeUpdate"
|
|
81
|
+
>
|
|
82
|
+
<source :src="audioUrl" type="audio/mpeg" />
|
|
83
|
+
<h2>我们很抱歉,您的浏览器<strong>不支持audio播放</strong></h2>
|
|
84
|
+
</audio>
|
|
85
|
+
</div>
|
|
86
|
+
<!-- 模型预览 -->
|
|
87
|
+
<div v-else-if="curType == 'model'" class="model">
|
|
88
|
+
<iframe
|
|
89
|
+
:src="modelUrl"
|
|
90
|
+
width="100%"
|
|
91
|
+
frameborder="0"
|
|
92
|
+
style="border: none"
|
|
93
|
+
height="100%"
|
|
94
|
+
></iframe>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="other" v-else>
|
|
97
|
+
{{ errMassage || "该文件不支持预览" }}
|
|
98
|
+
</div>
|
|
99
|
+
<!-- 大图预览 -->
|
|
100
|
+
<el-image-viewer
|
|
101
|
+
v-if="showViewer"
|
|
102
|
+
ref="ElImageViewer"
|
|
103
|
+
:initial-index="carouselIndex"
|
|
104
|
+
:on-close="closeViewer"
|
|
105
|
+
:onSwitch="handleImageChange"
|
|
106
|
+
:url-list="photoList"
|
|
107
|
+
:z-index="9999"
|
|
108
|
+
></el-image-viewer>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</template>
|
|
112
|
+
|
|
113
|
+
<script>
|
|
114
|
+
import { filePreview } from "@/api/resourceManagement";
|
|
115
|
+
import ElImageViewer from "element-ui/packages/image/src/image-viewer";
|
|
116
|
+
import AliPlayer from "./AliPlayer.vue";
|
|
117
|
+
export default {
|
|
118
|
+
name: "FilePreview",
|
|
119
|
+
components: {
|
|
120
|
+
ElImageViewer,
|
|
121
|
+
AliPlayer,
|
|
122
|
+
},
|
|
123
|
+
props: {
|
|
124
|
+
// 进度
|
|
125
|
+
progress: {
|
|
126
|
+
type: Number,
|
|
127
|
+
default: 0,
|
|
128
|
+
},
|
|
129
|
+
// 是否拖动
|
|
130
|
+
isDrag: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: false,
|
|
133
|
+
},
|
|
134
|
+
// 文件id
|
|
135
|
+
urlShort: {
|
|
136
|
+
type: String,
|
|
137
|
+
default: "",
|
|
138
|
+
},
|
|
139
|
+
// 用户Id
|
|
140
|
+
userId: {
|
|
141
|
+
type: String,
|
|
142
|
+
default: "",
|
|
143
|
+
},
|
|
144
|
+
// 产品id
|
|
145
|
+
productId: {
|
|
146
|
+
type: String,
|
|
147
|
+
default: "",
|
|
148
|
+
},
|
|
149
|
+
videoHeight: {
|
|
150
|
+
type: String,
|
|
151
|
+
default: "500px",
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
watch: {
|
|
155
|
+
carouselIndex: {
|
|
156
|
+
handler(newVal) {
|
|
157
|
+
if (this.showViewer) {
|
|
158
|
+
this.$refs.carousel.setActiveItem(newVal);
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
urlShort: {
|
|
163
|
+
handler(newVal) {
|
|
164
|
+
if (newVal) {
|
|
165
|
+
this.getFilePreview(newVal, this.localUserId, this.localProductId);
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
immediate: true,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
data() {
|
|
172
|
+
return {
|
|
173
|
+
localProductId: this.productId,
|
|
174
|
+
localUserId: this.userId,
|
|
175
|
+
curType: null,
|
|
176
|
+
photoList: [],
|
|
177
|
+
carouselIndex: this.progress,
|
|
178
|
+
showViewer: false,
|
|
179
|
+
videoUrl: "",
|
|
180
|
+
audioUrl: "",
|
|
181
|
+
whetherDragAndDropIsAllowed: this.isDrag,
|
|
182
|
+
videoDuration: 0,
|
|
183
|
+
videoTime: 0,
|
|
184
|
+
watchMaxTime: 0,
|
|
185
|
+
VideoSuffix: "",
|
|
186
|
+
office: [
|
|
187
|
+
".doc",
|
|
188
|
+
".docx",
|
|
189
|
+
".pptx",
|
|
190
|
+
".ppt",
|
|
191
|
+
".pdf",
|
|
192
|
+
".txt",
|
|
193
|
+
".rtf",
|
|
194
|
+
".xls",
|
|
195
|
+
".xlsx",
|
|
196
|
+
".wps",
|
|
197
|
+
".wpt",
|
|
198
|
+
".dps",
|
|
199
|
+
"文档",
|
|
200
|
+
".c",
|
|
201
|
+
".cpp",
|
|
202
|
+
".java",
|
|
203
|
+
".php",
|
|
204
|
+
".python",
|
|
205
|
+
".JavaScript",
|
|
206
|
+
".go",
|
|
207
|
+
".net",
|
|
208
|
+
],
|
|
209
|
+
pic: [
|
|
210
|
+
".png",
|
|
211
|
+
".jpeg",
|
|
212
|
+
".jpg",
|
|
213
|
+
".gif",
|
|
214
|
+
".bmp",
|
|
215
|
+
".tif",
|
|
216
|
+
".tiff",
|
|
217
|
+
".wmf",
|
|
218
|
+
".dwg",
|
|
219
|
+
"图片",
|
|
220
|
+
".jfif",
|
|
221
|
+
],
|
|
222
|
+
video: [
|
|
223
|
+
".mp4",
|
|
224
|
+
".mpg",
|
|
225
|
+
".WebM",
|
|
226
|
+
".ogg",
|
|
227
|
+
".flv",
|
|
228
|
+
".asf",
|
|
229
|
+
".avi",
|
|
230
|
+
".wmv",
|
|
231
|
+
".mpg",
|
|
232
|
+
".rm",
|
|
233
|
+
".rmvb",
|
|
234
|
+
".mov",
|
|
235
|
+
".mts",
|
|
236
|
+
".f4v",
|
|
237
|
+
".m4v",
|
|
238
|
+
"视频",
|
|
239
|
+
],
|
|
240
|
+
audio: [".mp3", ".wav", ".m4a", ".3gp", ".wma", ".aac", ".flac", ".ape"],
|
|
241
|
+
model: [".fbx", ".glb", ".obj", ".stl"],
|
|
242
|
+
modelUrl: "",
|
|
243
|
+
loading: true,
|
|
244
|
+
errMassage: "",
|
|
245
|
+
vodSource: {
|
|
246
|
+
source: "",
|
|
247
|
+
},
|
|
248
|
+
playerOptions: {
|
|
249
|
+
width: "100%",
|
|
250
|
+
height: this.videoHeight,
|
|
251
|
+
cover: "", // 封面图
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
},
|
|
255
|
+
methods: {
|
|
256
|
+
// 获取文件预览
|
|
257
|
+
async getFilePreview(urlShort, userId, productId) {
|
|
258
|
+
await this.addHead();
|
|
259
|
+
this.curType = null;
|
|
260
|
+
this.errMassage = "";
|
|
261
|
+
this.photoList = [];
|
|
262
|
+
this.loading = true;
|
|
263
|
+
filePreview({
|
|
264
|
+
userId: userId,
|
|
265
|
+
urlShort: urlShort,
|
|
266
|
+
productId: productId,
|
|
267
|
+
}).then((res) => {
|
|
268
|
+
if (res.code == 200 && res.data.status == 2) {
|
|
269
|
+
this.typeFiltering(
|
|
270
|
+
res.data.ossOriUrl,
|
|
271
|
+
{
|
|
272
|
+
...res.data.args,
|
|
273
|
+
clarityList: res.data.clarityList || [],
|
|
274
|
+
},
|
|
275
|
+
res.data.ossGenUrl
|
|
276
|
+
);
|
|
277
|
+
} else if (res.code == 200 && res.data.status == 1) {
|
|
278
|
+
this.errMassage = "文件已经上传,等待转换中";
|
|
279
|
+
this.curType = "other";
|
|
280
|
+
this.loading = false;
|
|
281
|
+
} else if (res.code == 200 && res.data.status == -1) {
|
|
282
|
+
this.errMassage = "文件正在转换";
|
|
283
|
+
this.curType = "other";
|
|
284
|
+
this.loading = false;
|
|
285
|
+
} else if (res.code == 200 && res.data.status == -2) {
|
|
286
|
+
this.errMassage = "文件预览失败";
|
|
287
|
+
this.curType = "other";
|
|
288
|
+
this.loading = false;
|
|
289
|
+
} else if (res.code == 200 && res.data.status == -3) {
|
|
290
|
+
this.errMassage = "文件不支持转换";
|
|
291
|
+
this.curType = "other";
|
|
292
|
+
this.loading = false;
|
|
293
|
+
} else {
|
|
294
|
+
this.errMassage = "文件不存在";
|
|
295
|
+
this.curType = "other";
|
|
296
|
+
this.loading = false;
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
},
|
|
300
|
+
// 新增:图片加载完成时调整轮播高度
|
|
301
|
+
handleImageLoaded() {
|
|
302
|
+
this.$nextTick(() => {
|
|
303
|
+
this.$refs.carousel.setActiveItem(this.carouselIndex);
|
|
304
|
+
// 使用定时器等待图片加载完成
|
|
305
|
+
const timer = setInterval(() => {
|
|
306
|
+
const imgPreview = this.$refs.preview && this.$refs.preview[0];
|
|
307
|
+
const carousel = this.$refs.carousel && this.$refs.carousel.$el;
|
|
308
|
+
if (imgPreview && carousel && imgPreview.offsetHeight) {
|
|
309
|
+
carousel.style.height = `${imgPreview.offsetHeight}px`;
|
|
310
|
+
clearInterval(timer);
|
|
311
|
+
}
|
|
312
|
+
}, 500);
|
|
313
|
+
// 5秒后清除定时器,避免无限循环
|
|
314
|
+
setTimeout(() => {
|
|
315
|
+
clearInterval(timer);
|
|
316
|
+
}, 5000);
|
|
317
|
+
});
|
|
318
|
+
},
|
|
319
|
+
// 类型过滤
|
|
320
|
+
async typeFiltering(fileUrl, args, fileGenUrl) {
|
|
321
|
+
this.loading = false;
|
|
322
|
+
let curFileType = fileUrl
|
|
323
|
+
.substring(fileUrl.lastIndexOf("."))
|
|
324
|
+
.toLowerCase();
|
|
325
|
+
if (this.office.includes(curFileType)) {
|
|
326
|
+
this.curType = "office";
|
|
327
|
+
await this.getViewList(args, fileGenUrl);
|
|
328
|
+
} else if (this.pic.includes(curFileType)) {
|
|
329
|
+
this.curType = "pic";
|
|
330
|
+
this.photoList.push(fileUrl);
|
|
331
|
+
} else if (this.video.includes(curFileType)) {
|
|
332
|
+
await this.getVideoPreviewUrl(fileUrl, args, fileGenUrl);
|
|
333
|
+
this.curType = "video";
|
|
334
|
+
} else if (this.audio.includes(curFileType)) {
|
|
335
|
+
this.curType = "audio";
|
|
336
|
+
this.audioUrl = fileGenUrl + "/file.mp3";
|
|
337
|
+
this.$nextTick(() => {
|
|
338
|
+
this.$refs.audio.currentTime = this.carouselIndex;
|
|
339
|
+
});
|
|
340
|
+
} else if (this.model.includes(curFileType)) {
|
|
341
|
+
this.curType = "model";
|
|
342
|
+
this.modelUrl = `https://zyk.icve.com.cn/icve-3dveiw/index.html#model=${fileUrl}`;
|
|
343
|
+
} else {
|
|
344
|
+
this.curType = "other";
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
// 动态添加头部标签
|
|
348
|
+
addHead() {
|
|
349
|
+
// 封装一个通用函数来添加资源,减少代码重复
|
|
350
|
+
function addResource(type, url, charset = null) {
|
|
351
|
+
const selector =
|
|
352
|
+
type === "stylesheet" ? 'link[rel="stylesheet"]' : "script";
|
|
353
|
+
const existingResource = Array.from(
|
|
354
|
+
document.head.querySelectorAll(selector)
|
|
355
|
+
).find((el) => (type === "stylesheet" ? el.href : el.src) === url);
|
|
356
|
+
|
|
357
|
+
if (!existingResource) {
|
|
358
|
+
const element = document.createElement(
|
|
359
|
+
type === "stylesheet" ? "link" : "script"
|
|
360
|
+
);
|
|
361
|
+
if (type === "stylesheet") {
|
|
362
|
+
element.rel = "stylesheet";
|
|
363
|
+
element.href = url;
|
|
364
|
+
} else {
|
|
365
|
+
if (charset) element.charset = charset;
|
|
366
|
+
element.src = url;
|
|
367
|
+
}
|
|
368
|
+
// 在head的第一个子节点前插入元素,即头部位置
|
|
369
|
+
document.head.insertBefore(element, document.head.firstChild);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// 调用通用函数添加样式文件
|
|
374
|
+
addResource(
|
|
375
|
+
"stylesheet",
|
|
376
|
+
"https://g.alicdn.com/de/prismplayer/2.15.2/skins/default/aliplayer-min.css"
|
|
377
|
+
);
|
|
378
|
+
// 调用通用函数添加脚本文件
|
|
379
|
+
addResource(
|
|
380
|
+
"script",
|
|
381
|
+
"https://g.alicdn.com/de/prismplayer/2.15.2/aliplayer-min.js",
|
|
382
|
+
"utf-8"
|
|
383
|
+
);
|
|
384
|
+
},
|
|
385
|
+
// 获取预览图
|
|
386
|
+
async getViewList(args, fileGenUrl) {
|
|
387
|
+
this.photoList = [];
|
|
388
|
+
if (args && args.html5state) {
|
|
389
|
+
for (let i = 1; i < args.page_count + 1; i++) {
|
|
390
|
+
this.photoList.push(fileGenUrl + "/" + i + ".png");
|
|
391
|
+
}
|
|
392
|
+
} else {
|
|
393
|
+
for (let i = 1; i < args.page_count + 1; i++) {
|
|
394
|
+
this.photoList.push(fileGenUrl + "/" + i + ".png");
|
|
395
|
+
window.parent.postMessage(
|
|
396
|
+
{
|
|
397
|
+
// office(doc,docx,pdf,ppt,pptx,xls,xlsx) audio(mp3) video(mp4) pic(png,jpg,gif,bmp,tif,tiff,wmf,dwg,jfif)
|
|
398
|
+
type: this.curType,
|
|
399
|
+
data: {
|
|
400
|
+
//pause(暂停) play(播放) complete(完成) change(上一页/下一页) start(开始)
|
|
401
|
+
status: "start",
|
|
402
|
+
// 当前观看页数/秒数
|
|
403
|
+
statistics: this.carouselIndex,
|
|
404
|
+
// 总时长/秒数
|
|
405
|
+
total: this.photoList.length,
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
"*"
|
|
409
|
+
); // 添加目标源参数"*"允许跨域通信
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
// 获取视频预览地址
|
|
414
|
+
async getVideoPreviewUrl(fileUrl, args, fileGenUrl) {
|
|
415
|
+
this.VideoSuffix = args.type == "m3u8" ? ".m3u8" : ".mp4";
|
|
416
|
+
let resolution = {};
|
|
417
|
+
|
|
418
|
+
if (args && args.clarityList.length > 0) {
|
|
419
|
+
args.clarityList.forEach((item) => {
|
|
420
|
+
resolution[item] = fileGenUrl + "/" + item + this.VideoSuffix;
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
this.vodSource.source = JSON.stringify(resolution);
|
|
424
|
+
console.log(this.vodSource.source, "this.vodSource.source");
|
|
425
|
+
},
|
|
426
|
+
//获取素材详情
|
|
427
|
+
getMaterialDetail() {
|
|
428
|
+
console.log("getMaterialDetail");
|
|
429
|
+
},
|
|
430
|
+
handleImageChange(idx) {
|
|
431
|
+
if (idx < this.carouselIndex && idx != 0) {
|
|
432
|
+
this.prev();
|
|
433
|
+
} else if (idx > this.carouselIndex && idx != this.photoList.length - 1) {
|
|
434
|
+
this.next();
|
|
435
|
+
} else if (idx < this.carouselIndex && idx == 0) {
|
|
436
|
+
this.$refs.carousel.setActiveItem(0);
|
|
437
|
+
} else if (idx > this.carouselIndex && idx == this.photoList.length - 1) {
|
|
438
|
+
this.$refs.carousel.setActiveItem(this.photoList.length - 1);
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
// 大图预览
|
|
442
|
+
changeShow() {
|
|
443
|
+
this.showViewer = true;
|
|
444
|
+
},
|
|
445
|
+
// 关闭大图
|
|
446
|
+
closeViewer() {
|
|
447
|
+
this.showViewer = false;
|
|
448
|
+
},
|
|
449
|
+
// 上一页
|
|
450
|
+
prev() {
|
|
451
|
+
if (this.carouselIndex > 0) {
|
|
452
|
+
this.carouselIndex--;
|
|
453
|
+
this.$refs.carousel.setActiveItem(this.carouselIndex);
|
|
454
|
+
} else {
|
|
455
|
+
this.carouselIndex = this.photoList.length - 1;
|
|
456
|
+
this.$refs.carousel.setActiveItem(this.carouselIndex);
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
// 下一页
|
|
460
|
+
next() {
|
|
461
|
+
if (this.carouselIndex < this.photoList.length - 1) {
|
|
462
|
+
this.carouselIndex++;
|
|
463
|
+
this.$refs.carousel.setActiveItem(this.carouselIndex);
|
|
464
|
+
} else {
|
|
465
|
+
this.carouselIndex = 0;
|
|
466
|
+
this.$refs.carousel.setActiveItem(this.carouselIndex);
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
// 轮播图切换
|
|
470
|
+
carouselChange(index) {
|
|
471
|
+
this.carouselIndex = index;
|
|
472
|
+
const data = {
|
|
473
|
+
// office(doc,docx,pdf,ppt,pptx,xls,xlsx) audio(音频类) video(视频类) pic(png,jpg,gif,bmp,tif,tiff,wmf,dwg,jfif)
|
|
474
|
+
type: this.curType,
|
|
475
|
+
data: {
|
|
476
|
+
//pause(暂停) complete(完成) change(上一页/下一页)
|
|
477
|
+
status: "change",
|
|
478
|
+
// 当前观看页数/秒数
|
|
479
|
+
statistics: this.carouselIndex,
|
|
480
|
+
// 总页数/秒数
|
|
481
|
+
total: this.photoList.length,
|
|
482
|
+
},
|
|
483
|
+
};
|
|
484
|
+
this.$emit("liveEvents", data);
|
|
485
|
+
},
|
|
486
|
+
handleVideoMetadata(e) {
|
|
487
|
+
this.videoDuration = e.target.duration;
|
|
488
|
+
},
|
|
489
|
+
handleVideoMetadata1(e) {
|
|
490
|
+
this.videoDuration = e;
|
|
491
|
+
},
|
|
492
|
+
handleVideoPause(e) {
|
|
493
|
+
const data = {
|
|
494
|
+
// office(doc,docx,pdf,ppt,pptx,xls,xlsx) audio(音频类) video(视频类) pic(png,jpg,gif,bmp,tif,tiff,wmf,dwg,jfif)
|
|
495
|
+
type: this.curType,
|
|
496
|
+
data: {
|
|
497
|
+
//pause(暂停) complete(完成) change(上一页/下一页) play(播放)
|
|
498
|
+
status: "pause",
|
|
499
|
+
// 当前观看页数/秒数
|
|
500
|
+
statistics: e.target.currentTime,
|
|
501
|
+
// 总页数/秒数
|
|
502
|
+
total: this.videoDuration,
|
|
503
|
+
},
|
|
504
|
+
};
|
|
505
|
+
this.$emit("liveEvents", data);
|
|
506
|
+
},
|
|
507
|
+
handleVideoPause1(e) {
|
|
508
|
+
const data = {
|
|
509
|
+
// office(doc,docx,pdf,ppt,pptx,xls,xlsx) audio(音频类) video(视频类) pic(png,jpg,gif,bmp,tif,tiff,wmf,dwg,jfif)
|
|
510
|
+
type: this.curType,
|
|
511
|
+
data: {
|
|
512
|
+
//pause(暂停) complete(完成) change(上一页/下一页) play(播放)
|
|
513
|
+
status: "pause",
|
|
514
|
+
// 当前观看页数/秒数
|
|
515
|
+
statistics: e,
|
|
516
|
+
// 总页数/秒数
|
|
517
|
+
total: this.videoDuration,
|
|
518
|
+
},
|
|
519
|
+
};
|
|
520
|
+
this.$emit("liveEvents", data);
|
|
521
|
+
},
|
|
522
|
+
handleVideoPlay(e) {
|
|
523
|
+
const data = {
|
|
524
|
+
// office(doc,docx,pdf,ppt,pptx,xls,xlsx) audio(音频类) video(视频类) pic(png,jpg,gif,bmp,tif,tiff,wmf,dwg,jfif)
|
|
525
|
+
type: this.curType,
|
|
526
|
+
data: {
|
|
527
|
+
//pause(暂停) complete(完成) change(上一页/下一页) play(播放)
|
|
528
|
+
status: "play",
|
|
529
|
+
// 当前观看页数/秒数
|
|
530
|
+
statistics: e.target.currentTime,
|
|
531
|
+
// 总页数/秒数
|
|
532
|
+
total: this.videoDuration,
|
|
533
|
+
},
|
|
534
|
+
};
|
|
535
|
+
this.$emit("liveEvents", data);
|
|
536
|
+
},
|
|
537
|
+
handleVideoPlay1(e) {
|
|
538
|
+
const data = {
|
|
539
|
+
// office(doc,docx,pdf,ppt,pptx,xls,xlsx) audio(音频类) video(视频类) pic(png,jpg,gif,bmp,tif,tiff,wmf,dwg,jfif)
|
|
540
|
+
type: this.curType,
|
|
541
|
+
data: {
|
|
542
|
+
//pause(暂停) complete(完成) change(上一页/下一页) play(播放)
|
|
543
|
+
status: "play",
|
|
544
|
+
// 当前观看页数/秒数
|
|
545
|
+
statistics: e,
|
|
546
|
+
// 总页数/秒数
|
|
547
|
+
total: this.videoDuration,
|
|
548
|
+
},
|
|
549
|
+
};
|
|
550
|
+
this.$emit("liveEvents", data);
|
|
551
|
+
},
|
|
552
|
+
handleVideoEnd(e) {
|
|
553
|
+
const data = {
|
|
554
|
+
// office(doc,docx,pdf,ppt,pptx,xls,xlsx) audio(音频类) video(视频类) pic(png,jpg,gif,bmp,tif,tiff,wmf,dwg,jfif)
|
|
555
|
+
type: this.curType,
|
|
556
|
+
data: {
|
|
557
|
+
//pause(暂停) complete(完成) change(上一页/下一页) play(播放)
|
|
558
|
+
status: "complete",
|
|
559
|
+
// 当前观看页数/秒数
|
|
560
|
+
statistics: e.target.currentTime,
|
|
561
|
+
// 总页数/秒数
|
|
562
|
+
total: this.videoDuration,
|
|
563
|
+
},
|
|
564
|
+
};
|
|
565
|
+
this.$emit("liveEvents", data);
|
|
566
|
+
},
|
|
567
|
+
handleVideoEnd1(e) {
|
|
568
|
+
const data = {
|
|
569
|
+
// office(doc,docx,pdf,ppt,pptx,xls,xlsx) audio(音频类) video(视频类) pic(png,jpg,gif,bmp,tif,tiff,wmf,dwg,jfif)
|
|
570
|
+
type: this.curType,
|
|
571
|
+
data: {
|
|
572
|
+
//pause(暂停) complete(完成) change(上一页/下一页) play(播放)
|
|
573
|
+
status: "complete",
|
|
574
|
+
// 当前观看页数/秒数
|
|
575
|
+
statistics: e,
|
|
576
|
+
// 总页数/秒数
|
|
577
|
+
total: this.videoDuration,
|
|
578
|
+
},
|
|
579
|
+
};
|
|
580
|
+
this.$emit("liveEvents", data);
|
|
581
|
+
},
|
|
582
|
+
handleTimeUpdate(e) {
|
|
583
|
+
if (
|
|
584
|
+
e.target.currentTime > this.watchMaxTime &&
|
|
585
|
+
this.whetherDragAndDropIsAllowed &&
|
|
586
|
+
this.carouselIndex == 0
|
|
587
|
+
) {
|
|
588
|
+
//但如果相差1秒就证明是往后拖时间了 正常来说是每次时长更新相差0.3s
|
|
589
|
+
var num =
|
|
590
|
+
parseFloat(e.target.currentTime) - parseFloat(this.watchMaxTime);
|
|
591
|
+
if (num < 1) {
|
|
592
|
+
//正常播放时,记录当前播放时间
|
|
593
|
+
this.watchMaxTime = e.target.currentTime;
|
|
594
|
+
this.videoTime = e.target.currentTime;
|
|
595
|
+
} else if (this.curType == "audio") {
|
|
596
|
+
// 差值大于1s时,视为拖动,将上一次记录的播放时间赋值给当前播放器的播放时间
|
|
597
|
+
this.$refs.audio.currentTime = this.watchMaxTime;
|
|
598
|
+
this.videoTime = this.watchMaxTime;
|
|
599
|
+
} else {
|
|
600
|
+
// 差值大于1s时,视为拖动,将上一次记录的播放时间赋值给当前播放器的播放时间
|
|
601
|
+
this.$refs.video.currentTime = this.watchMaxTime;
|
|
602
|
+
this.videoTime = this.watchMaxTime;
|
|
603
|
+
}
|
|
604
|
+
} else {
|
|
605
|
+
this.carouselIndex = 0;
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
},
|
|
609
|
+
// 组件销毁时清除定时器
|
|
610
|
+
destroyed() {
|
|
611
|
+
// 销毁当前元素
|
|
612
|
+
this.$refs.FilePreview && this.$refs.FilePreview.remove();
|
|
613
|
+
// 销毁页面时清除视频和音频播放
|
|
614
|
+
if (this.curType === "video") {
|
|
615
|
+
this.$refs.video && this.$refs.video.pause();
|
|
616
|
+
} else if (this.curType === "audio") {
|
|
617
|
+
this.$refs.audio && this.$refs.audio.pause();
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
|
|
621
|
+
created() {},
|
|
622
|
+
};
|
|
623
|
+
</script>
|
|
624
|
+
<style lang="scss" scoped>
|
|
625
|
+
.FilePreview {
|
|
626
|
+
height: 100%;
|
|
627
|
+
overflow-y: auto;
|
|
628
|
+
.info {
|
|
629
|
+
height: 100%;
|
|
630
|
+
}
|
|
631
|
+
.model {
|
|
632
|
+
height: 100%;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
::v-deep .el-carousel {
|
|
636
|
+
// height: calc(100% - 54px);
|
|
637
|
+
height: 100%;
|
|
638
|
+
display: flex;
|
|
639
|
+
flex-direction: column;
|
|
640
|
+
}
|
|
641
|
+
::v-deep .el-carousel__container {
|
|
642
|
+
height: auto;
|
|
643
|
+
flex: 1;
|
|
644
|
+
.el-carousel__item {
|
|
645
|
+
.img-preview {
|
|
646
|
+
width: 100%;
|
|
647
|
+
cursor: pointer;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
.video {
|
|
652
|
+
height: 100%;
|
|
653
|
+
display: flex;
|
|
654
|
+
align-items: center;
|
|
655
|
+
}
|
|
656
|
+
.audio {
|
|
657
|
+
display: flex;
|
|
658
|
+
justify-content: center;
|
|
659
|
+
align-items: center;
|
|
660
|
+
height: 100%;
|
|
661
|
+
}
|
|
662
|
+
.other {
|
|
663
|
+
text-align: center;
|
|
664
|
+
margin-top: 20px;
|
|
665
|
+
}
|
|
666
|
+
.page {
|
|
667
|
+
padding-top: 10px;
|
|
668
|
+
text-align: center;
|
|
669
|
+
}
|
|
670
|
+
</style>
|