vue2-client 1.6.18 → 1.6.19
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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue2-client",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.19",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
@@ -38,7 +38,9 @@
|
|
|
38
38
|
"vue-i18n": "^8.27.2",
|
|
39
39
|
"vue-router": "^3.5.4",
|
|
40
40
|
"vuedraggable": "^2.24.3",
|
|
41
|
-
"vuex": "^3.6.2"
|
|
41
|
+
"vuex": "^3.6.2",
|
|
42
|
+
"vue-video-player": "5.0.2",
|
|
43
|
+
"videojs-contrib-hls": "5.14.1"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
46
|
"script-loader": "^0.7.2",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="!pathError">
|
|
3
3
|
<!-- 文件 -->
|
|
4
|
-
<div v-if="
|
|
4
|
+
<div v-if="showImagePreview == 1" class="preview-doc-container">
|
|
5
5
|
<a-spin size="large" :spinning="previewDocLoading" />
|
|
6
6
|
<iframe
|
|
7
7
|
v-show="!previewDocLoading"
|
|
@@ -12,18 +12,33 @@
|
|
|
12
12
|
@load="previewDocLoading = false" />
|
|
13
13
|
</div>
|
|
14
14
|
<!-- 图片 -->
|
|
15
|
-
<div v-
|
|
15
|
+
<div v-if="showImagePreview == 2" style="text-align: center">
|
|
16
16
|
<img :src="previewImageSrc" alt="image" class="preview-image">
|
|
17
17
|
</div>
|
|
18
|
+
<!-- 视频 -->
|
|
19
|
+
<div v-if="showImagePreview == 3" style="text-align: center">
|
|
20
|
+
<video-player
|
|
21
|
+
class="video-player vjs-custom-skin"
|
|
22
|
+
ref="videoPlayer"
|
|
23
|
+
:playsinline="true"
|
|
24
|
+
:options="playerOptions">
|
|
25
|
+
</video-player>
|
|
26
|
+
</div>
|
|
18
27
|
</div>
|
|
19
28
|
<a-empty v-else description="文件路径为空" />
|
|
20
29
|
</template>
|
|
21
30
|
|
|
22
31
|
<script>
|
|
23
32
|
import { Base64 } from 'js-base64'
|
|
33
|
+
import 'video.js/dist/video-js.css'
|
|
34
|
+
import 'videojs-contrib-hls'
|
|
35
|
+
import { videoPlayer } from 'vue-video-player'
|
|
24
36
|
|
|
25
37
|
export default {
|
|
26
38
|
name: 'FilePreview',
|
|
39
|
+
components: {
|
|
40
|
+
videoPlayer
|
|
41
|
+
},
|
|
27
42
|
props: {
|
|
28
43
|
path: {
|
|
29
44
|
type: String,
|
|
@@ -46,10 +61,34 @@ export default {
|
|
|
46
61
|
previewDocLoading: true,
|
|
47
62
|
previewDocUrl: '',
|
|
48
63
|
// 图片预览
|
|
49
|
-
showImagePreview:
|
|
64
|
+
showImagePreview: 1,
|
|
50
65
|
previewImageSrc: '',
|
|
66
|
+
// 视频
|
|
67
|
+
previewVideoSrc: '',
|
|
51
68
|
// 路径是否为空
|
|
52
|
-
pathError: false
|
|
69
|
+
pathError: false,
|
|
70
|
+
playerOptions: {
|
|
71
|
+
playbackRates: [0.5, 1.0, 1.5, 2.0],
|
|
72
|
+
autoplay: false,
|
|
73
|
+
muted: false,
|
|
74
|
+
loop: false,
|
|
75
|
+
preload: 'auto',
|
|
76
|
+
language: 'zh-CN',
|
|
77
|
+
aspectRatio: '16:9',
|
|
78
|
+
fluid: true,
|
|
79
|
+
sources: [{
|
|
80
|
+
type: '',
|
|
81
|
+
src: ''
|
|
82
|
+
}],
|
|
83
|
+
poster: '',
|
|
84
|
+
notSupportedMessage: '此视频暂无法播放,请稍后再试',
|
|
85
|
+
controlBar: {
|
|
86
|
+
timeDivider: true,
|
|
87
|
+
durationDisplay: true,
|
|
88
|
+
remainingTimeDisplay: false,
|
|
89
|
+
fullscreenToggle: true
|
|
90
|
+
}
|
|
91
|
+
}
|
|
53
92
|
}
|
|
54
93
|
},
|
|
55
94
|
watch: {
|
|
@@ -70,14 +109,18 @@ export default {
|
|
|
70
109
|
this.pathError = false
|
|
71
110
|
if (this.isImage()) {
|
|
72
111
|
this.previewImageSrc = this.path
|
|
73
|
-
this.showImagePreview =
|
|
112
|
+
this.showImagePreview = 2
|
|
113
|
+
} else if (this.isVideo()) {
|
|
114
|
+
this.playerOptions['sources'][0]['type'] = 'video/' + this.path.substring(this.path.lastIndexOf('.') + 1)
|
|
115
|
+
this.playerOptions['sources'][0]['src'] = this.path
|
|
116
|
+
this.showImagePreview = 3
|
|
74
117
|
} else {
|
|
75
118
|
const previewDocUrl = this.previewDocService + encodeURIComponent(Base64.encode(this.fileServer + this.path))
|
|
76
119
|
if (this.previewDocUrl !== previewDocUrl) {
|
|
77
120
|
this.previewDocLoading = true
|
|
78
121
|
this.previewDocUrl = previewDocUrl
|
|
79
122
|
}
|
|
80
|
-
this.showImagePreview =
|
|
123
|
+
this.showImagePreview = 1
|
|
81
124
|
}
|
|
82
125
|
},
|
|
83
126
|
// 判断是否为图片
|
|
@@ -91,12 +134,24 @@ export default {
|
|
|
91
134
|
return false
|
|
92
135
|
}
|
|
93
136
|
return true
|
|
137
|
+
},
|
|
138
|
+
// 判断是否为视频
|
|
139
|
+
isVideo () {
|
|
140
|
+
const index = this.path.lastIndexOf('.')
|
|
141
|
+
if (index === -1) {
|
|
142
|
+
return false
|
|
143
|
+
}
|
|
144
|
+
const suffix = this.path.substr(index + 1)
|
|
145
|
+
if (!suffix || !VIDEO_SUFFIX_ARRAY.includes(suffix)) {
|
|
146
|
+
return false
|
|
147
|
+
}
|
|
148
|
+
return true
|
|
94
149
|
}
|
|
95
150
|
}
|
|
96
151
|
}
|
|
97
152
|
// 图片后缀
|
|
98
|
-
const IMAGE_SUFFIX_ARRAY = ['xbm', 'tif', 'pjp', 'svgz', 'jpg', 'jpeg', 'ico', 'tiff', 'gif', 'svg', 'jfif', 'webp', 'png', 'bmp', 'pjpeg', 'avif'
|
|
99
|
-
|
|
153
|
+
const IMAGE_SUFFIX_ARRAY = ['xbm', 'tif', 'pjp', 'svgz', 'jpg', 'jpeg', 'ico', 'tiff', 'gif', 'svg', 'jfif', 'webp', 'png', 'bmp', 'pjpeg', 'avif']
|
|
154
|
+
const VIDEO_SUFFIX_ARRAY = ['avi', 'wmv', 'mpeg', 'mp4', 'm4v', 'mov', 'asf', 'flv', 'f4v', 'rmvb', 'rm', '3gp', 'vob']
|
|
100
155
|
</script>
|
|
101
156
|
|
|
102
157
|
<style>
|