yks-element 1.0.0 → 1.0.315
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/LICENSE +21 -0
- package/README.md +49 -4
- package/{dist → lib}/fonts/element-icons.535877f5.woff +0 -0
- package/{dist → lib}/fonts/element-icons.732389de.ttf +0 -0
- package/lib/fonts/iconfont.19124b0d.ttf +0 -0
- package/lib/fonts/iconfont.3ae3dd4e.woff +0 -0
- package/lib/yks.css +1 -0
- package/package.json +74 -51
- package/packages/Button/index.js +8 -0
- package/packages/Button/src/index.vue +67 -0
- package/packages/Dialog/index.js +8 -0
- package/packages/Dialog/src/index.vue +103 -0
- package/packages/Multimedia/index.js +8 -0
- package/packages/Multimedia/src/index.vue +167 -0
- package/packages/Pagination/index.js +8 -0
- package/packages/Pagination/src/index.vue +149 -0
- package/packages/Scrollbar/index.js +8 -0
- package/packages/Scrollbar/src/index.vue +27 -0
- package/packages/Select/index.js +8 -0
- package/packages/Select/src/index.vue +350 -0
- package/packages/Select/src/option.vue +29 -0
- package/packages/Table/index.js +8 -0
- package/packages/Table/src/index.vue +141 -0
- package/packages/Tinymce/index.js +8 -0
- package/packages/Tinymce/src/config.js +25 -0
- package/packages/Tinymce/src/index.vue +500 -0
- package/packages/UploadFile/index.js +8 -0
- package/packages/UploadFile/src/index.vue +388 -0
- package/packages/Video/index.js +8 -0
- package/packages/Video/src/index.vue +352 -0
- package/packages/assets/utils/index.js +83 -0
- package/packages/icon/default/icons.js +182 -0
- package/packages/icon/default/icons.min.js +1 -0
- package/packages/icon/default/index.js +7 -0
- package/packages/icon/ks-pdf.png +0 -0
- package/packages/icon/ks-ppt.png +0 -0
- package/packages/icon/ks-word.png +0 -0
- package/packages/icon/ks-xslx.png +0 -0
- package/packages/icon/music-bg.png +0 -0
- package/packages/icon/video-bg.png +0 -0
- package/packages/index.js +221 -0
- package/packages/option/index.js +6 -0
- package/packages/styles/_mixin.scss +93 -0
- package/packages/styles/_variables.scss +40 -0
- package/packages/styles/common.scss +167 -0
- package/packages/styles/element-ui.scss +135 -0
- package/packages/styles/element-variables.scss +794 -0
- package/packages/styles/fonts/element-icons.ttf +0 -0
- package/packages/styles/fonts/element-icons.woff +0 -0
- package/packages/styles/fonts/iconfont.ttf +0 -0
- package/packages/styles/fonts/iconfont.woff +0 -0
- package/packages/styles/icon.scss +69 -0
- package/packages/styles/index.scss +10 -0
- package/packages/styles/select.scss +98 -0
- package/packages/styles/table.scss +45 -0
- package/types/index.d.ts +4 -0
- package/dist/demo.html +0 -10
- package/dist/yks.common.js +0 -64801
- package/dist/yks.css +0 -1
- package/dist/yks.umd.js +0 -64811
- package/dist/yks.umd.min.js +0 -15
- package/packages/button/index.vue +0 -16
- package/packages/index.ts +0 -12
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="multimedia__video">
|
|
3
|
+
<div
|
|
4
|
+
class="ks-stem__videos yks-flex h-center v-center"
|
|
5
|
+
:class="{ 'dialog-pause': playing }"
|
|
6
|
+
>
|
|
7
|
+
<video
|
|
8
|
+
:ref="videoId"
|
|
9
|
+
:width="width"
|
|
10
|
+
:height="height"
|
|
11
|
+
:src="src"
|
|
12
|
+
:poster="musicBgs"
|
|
13
|
+
playsinline
|
|
14
|
+
webkit-playsinline
|
|
15
|
+
preload="auto"
|
|
16
|
+
class="file__videos"
|
|
17
|
+
@timeupdate="durationUpdate"
|
|
18
|
+
@canplay="getDuration"
|
|
19
|
+
></video>
|
|
20
|
+
<div v-if="!isInfinity" class="slider-video">
|
|
21
|
+
<i class="el-icon-video-pause video-icon_mini" @click.stop="handlePause"></i>
|
|
22
|
+
<Slider
|
|
23
|
+
v-model="musicDuration"
|
|
24
|
+
:max="musicAllDuration"
|
|
25
|
+
height="2px"
|
|
26
|
+
:show-tooltip="false"
|
|
27
|
+
class="slider__value"
|
|
28
|
+
@change="changeMusicDuration"
|
|
29
|
+
@mousedown.native="isChange = true"
|
|
30
|
+
@mouseup.native="isChange = false"
|
|
31
|
+
></Slider>
|
|
32
|
+
<span class="slider__text video-icon_mini">{{ formatTime(musicAllDuration) }}</span>
|
|
33
|
+
<i
|
|
34
|
+
v-if="fileType === '3'"
|
|
35
|
+
class="el-icon-full-screen video-icon_mini"
|
|
36
|
+
@click.stop="handleFullScreen"
|
|
37
|
+
></i>
|
|
38
|
+
</div>
|
|
39
|
+
<div
|
|
40
|
+
v-if="!playing || isInfinity"
|
|
41
|
+
class="dialog-playing yks-flex h-center v-center"
|
|
42
|
+
@click.stop="handlePlaying"
|
|
43
|
+
>
|
|
44
|
+
<i :class="[`icon-recording ${playingIcon}`]"></i>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
<script>
|
|
50
|
+
import videoBg from '../../icon/video-bg.png'
|
|
51
|
+
import musicBg1 from '../../icon/music-bg.png'
|
|
52
|
+
import { Slider } from 'element-ui'
|
|
53
|
+
import { formatTimeMin } from '../../assets/utils/index'
|
|
54
|
+
export default {
|
|
55
|
+
name: 'YksVideo',
|
|
56
|
+
components: {
|
|
57
|
+
Slider
|
|
58
|
+
},
|
|
59
|
+
props: {
|
|
60
|
+
src: { type: String, require: true },
|
|
61
|
+
width: { type: Number, default: 160 },
|
|
62
|
+
height: { type: Number, default: 90 }
|
|
63
|
+
},
|
|
64
|
+
data() {
|
|
65
|
+
return {
|
|
66
|
+
/* 播放状态 */
|
|
67
|
+
playing: false,
|
|
68
|
+
/* 歌曲总时长 */
|
|
69
|
+
musicAllDuration: 0,
|
|
70
|
+
/* 歌曲当前时长 */
|
|
71
|
+
musicDuration: 0,
|
|
72
|
+
/* 判断是否被拖动 */
|
|
73
|
+
isChange: false,
|
|
74
|
+
/* 判断是否为Infinity */
|
|
75
|
+
isInfinity: false
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
computed: {
|
|
79
|
+
playingIcon() {
|
|
80
|
+
if (this.playing) {
|
|
81
|
+
return 'el-icon-video-pause'
|
|
82
|
+
} else {
|
|
83
|
+
return 'el-icon-video-play'
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
/* 播放背景图 */
|
|
87
|
+
musicBgs() {
|
|
88
|
+
if (this.fileType === '3') {
|
|
89
|
+
return videoBg
|
|
90
|
+
}
|
|
91
|
+
if (this.playing) {
|
|
92
|
+
return 'https://pub-static.yks365.net/assets/image/music-bg.gif'
|
|
93
|
+
} else {
|
|
94
|
+
return musicBg1
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
/* 获取文件后缀 */
|
|
98
|
+
fileNameType() {
|
|
99
|
+
const url = this.src
|
|
100
|
+
return url.substr(url.lastIndexOf('.') + 1).toLowerCase()
|
|
101
|
+
},
|
|
102
|
+
/* 获取文件类型 */
|
|
103
|
+
fileType() {
|
|
104
|
+
if (['mp3'].includes(this.fileNameType)) {
|
|
105
|
+
return '2'
|
|
106
|
+
}
|
|
107
|
+
if (['mp4'].includes(this.fileNameType)) {
|
|
108
|
+
return '3'
|
|
109
|
+
}
|
|
110
|
+
return false
|
|
111
|
+
},
|
|
112
|
+
/* 播放图标 */
|
|
113
|
+
iconName() {
|
|
114
|
+
if (!this.playing) {
|
|
115
|
+
return 'el-icon-video-play'
|
|
116
|
+
} else {
|
|
117
|
+
return 'el-icon-video-pause'
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
/* 组件key */
|
|
121
|
+
videoId() {
|
|
122
|
+
return `video${Date.now()}${(Math.random() * 1000).toFixed(0)}`
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
created() {
|
|
126
|
+
/* 监听播放状态 */
|
|
127
|
+
this.$nextTick(() => {
|
|
128
|
+
if (this.fileType === '2' || this.fileType === '3') {
|
|
129
|
+
const video = this.$refs[this.videoId]
|
|
130
|
+
video.addEventListener('play', () => {
|
|
131
|
+
this.playing = true
|
|
132
|
+
})
|
|
133
|
+
video.addEventListener('pause', () => {
|
|
134
|
+
this.playing = false
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
},
|
|
139
|
+
methods: {
|
|
140
|
+
handleFullScreen() {
|
|
141
|
+
const video = this.$refs[this.videoId]
|
|
142
|
+
const requestMethod =
|
|
143
|
+
video.requestFullScreen ||
|
|
144
|
+
video.webkitRequestFullScreen ||
|
|
145
|
+
video.mozRequestFullScreen ||
|
|
146
|
+
video.msRequestFullScreen
|
|
147
|
+
if (requestMethod) {
|
|
148
|
+
requestMethod.call(video)
|
|
149
|
+
} else if (typeof window.ActiveXObject !== 'undefined') {
|
|
150
|
+
// eslint-disable-next-line no-undef
|
|
151
|
+
const wscript = new ActiveXObject('WScript.Shell')
|
|
152
|
+
if (wscript !== null) {
|
|
153
|
+
wscript.SendKeys('{F11}')
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
/* 进度时间转换 */
|
|
158
|
+
formatTime(time) {
|
|
159
|
+
return formatTimeMin(time)
|
|
160
|
+
},
|
|
161
|
+
/* 进度条时间定位 */
|
|
162
|
+
changeMusicDuration() {
|
|
163
|
+
if (this.musicAllDuration !== 0) {
|
|
164
|
+
const video = this.$refs[this.videoId]
|
|
165
|
+
video.currentTime = this.musicDuration
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
/* 获取音视频时长 */
|
|
169
|
+
getDuration() {
|
|
170
|
+
const video = this.$refs[this.videoId]
|
|
171
|
+
console.log(video.duration)
|
|
172
|
+
|
|
173
|
+
if (!Number.isFinite(video.duration)) {
|
|
174
|
+
this.musicAllDuration = 300
|
|
175
|
+
this.isInfinity = true
|
|
176
|
+
} else {
|
|
177
|
+
this.isInfinity = false
|
|
178
|
+
this.musicAllDuration = video.duration
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
/* 获取音视频播放当前时间 */
|
|
182
|
+
durationUpdate() {
|
|
183
|
+
if (!this.isChange) {
|
|
184
|
+
const video = this.$refs[this.videoId]
|
|
185
|
+
this.musicDuration = video.currentTime
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
/* 播放 */
|
|
189
|
+
handlePlaying() {
|
|
190
|
+
if (!this.playing) {
|
|
191
|
+
this.$refs[this.videoId].play()
|
|
192
|
+
} else {
|
|
193
|
+
this.handlePause()
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
/* 暂停 */
|
|
197
|
+
handlePause() {
|
|
198
|
+
if (this.playing) {
|
|
199
|
+
this.$refs[this.videoId].pause()
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
</script>
|
|
205
|
+
<style lang="scss" scoped>
|
|
206
|
+
.multimedia__video {
|
|
207
|
+
position: relative;
|
|
208
|
+
margin-right: 10px;
|
|
209
|
+
|
|
210
|
+
.slider-video {
|
|
211
|
+
position: absolute;
|
|
212
|
+
width: 100%;
|
|
213
|
+
left: 0;
|
|
214
|
+
bottom: 2px;
|
|
215
|
+
display: flex;
|
|
216
|
+
align-items: center;
|
|
217
|
+
|
|
218
|
+
.video-icon_mini {
|
|
219
|
+
font-size: 13px !important;
|
|
220
|
+
cursor: pointer;
|
|
221
|
+
color: #ffffff;
|
|
222
|
+
margin-left: 5px;
|
|
223
|
+
margin-right: 5px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.el-icon-video-pause {
|
|
227
|
+
cursor: pointer;
|
|
228
|
+
color: #ffffff;
|
|
229
|
+
margin-left: 5px;
|
|
230
|
+
margin-right: 5px;
|
|
231
|
+
}
|
|
232
|
+
.slider__value {
|
|
233
|
+
flex: 1;
|
|
234
|
+
margin: 0 5px;
|
|
235
|
+
}
|
|
236
|
+
.slider__text {
|
|
237
|
+
color: #fff;
|
|
238
|
+
font-size: 12px;
|
|
239
|
+
transform: scale(0.7);
|
|
240
|
+
}
|
|
241
|
+
::v-deep {
|
|
242
|
+
.el-slider__runway {
|
|
243
|
+
margin: 0;
|
|
244
|
+
}
|
|
245
|
+
.el-slider__runway {
|
|
246
|
+
height: 1px;
|
|
247
|
+
background-color: #ffffff;
|
|
248
|
+
border-radius: 1px;
|
|
249
|
+
}
|
|
250
|
+
.el-slider__bar {
|
|
251
|
+
height: 1px;
|
|
252
|
+
background-color: transparent;
|
|
253
|
+
border-radius: 1px;
|
|
254
|
+
}
|
|
255
|
+
.el-slider__button-wrapper {
|
|
256
|
+
height: 31px;
|
|
257
|
+
width: 13px;
|
|
258
|
+
}
|
|
259
|
+
.el-slider__button {
|
|
260
|
+
height: 5px;
|
|
261
|
+
width: 5px;
|
|
262
|
+
background: #ffffff;
|
|
263
|
+
border: unset;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.file-stem {
|
|
269
|
+
position: relative;
|
|
270
|
+
width: 80px;
|
|
271
|
+
margin: 0 auto;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
&:hover {
|
|
275
|
+
.media-delfile,
|
|
276
|
+
.media-delvideo {
|
|
277
|
+
opacity: 1 !important;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.dialog-pause {
|
|
281
|
+
.slider-video {
|
|
282
|
+
opacity: 1 !important;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
.media-delfile,
|
|
287
|
+
.media-delvideo {
|
|
288
|
+
color: red;
|
|
289
|
+
position: absolute;
|
|
290
|
+
opacity: 0;
|
|
291
|
+
right: -3px;
|
|
292
|
+
top: -3px;
|
|
293
|
+
background: #fff;
|
|
294
|
+
border-radius: 50%;
|
|
295
|
+
cursor: pointer;
|
|
296
|
+
transition: 0.3s opacity;
|
|
297
|
+
-webkit-transition: 0.3s opacity;
|
|
298
|
+
}
|
|
299
|
+
.media-delvideo {
|
|
300
|
+
top: -5px;
|
|
301
|
+
right: -5px;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.ks-stem__itemattrs {
|
|
305
|
+
border-radius: 4px;
|
|
306
|
+
position: relative;
|
|
307
|
+
.ks-stem__icon {
|
|
308
|
+
width: 77px;
|
|
309
|
+
height: 77px;
|
|
310
|
+
margin-bottom: 9px;
|
|
311
|
+
cursor: pointer;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
.ks-stem__content {
|
|
315
|
+
width: 160px;
|
|
316
|
+
font-size: 12px;
|
|
317
|
+
text-align: center;
|
|
318
|
+
padding-top: 5px;
|
|
319
|
+
color: #000;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.ks-stem__videos {
|
|
323
|
+
border-radius: 4px;
|
|
324
|
+
position: relative;
|
|
325
|
+
.file__videos {
|
|
326
|
+
background: #000000;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.dialog-playing {
|
|
331
|
+
margin: 0 auto;
|
|
332
|
+
width: 50px;
|
|
333
|
+
height: 50px;
|
|
334
|
+
cursor: pointer;
|
|
335
|
+
position: absolute;
|
|
336
|
+
|
|
337
|
+
&:hover {
|
|
338
|
+
opacity: 0.7;
|
|
339
|
+
}
|
|
340
|
+
.icon-recording {
|
|
341
|
+
color: #fff;
|
|
342
|
+
font-size: 30px !important;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.slider-video {
|
|
347
|
+
opacity: 0;
|
|
348
|
+
transition: 0.3s opacity;
|
|
349
|
+
-webkit-transition: 0.3s opacity;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
</style>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @param {string} time
|
|
4
|
+
* @returns {string}
|
|
5
|
+
*/
|
|
6
|
+
export function formatTime(time) {
|
|
7
|
+
if (!time) {
|
|
8
|
+
return '00:00:00'
|
|
9
|
+
}
|
|
10
|
+
const value = parseInt(time, 10)
|
|
11
|
+
let HH
|
|
12
|
+
let MM
|
|
13
|
+
let SS
|
|
14
|
+
switch (true) {
|
|
15
|
+
case value < 60:
|
|
16
|
+
if (value < 10) {
|
|
17
|
+
SS = '0' + value
|
|
18
|
+
} else {
|
|
19
|
+
SS = value
|
|
20
|
+
}
|
|
21
|
+
return `00:00:${SS}`
|
|
22
|
+
case value >= 60 && value < 3600:
|
|
23
|
+
MM = parseInt((value / 60).toString(), 10)
|
|
24
|
+
SS = parseInt((value % 60).toString(), 10)
|
|
25
|
+
if (MM < 10) {
|
|
26
|
+
MM = '0' + MM
|
|
27
|
+
}
|
|
28
|
+
if (SS < 10) {
|
|
29
|
+
SS = '0' + SS
|
|
30
|
+
}
|
|
31
|
+
return `00:${MM}:${SS}`
|
|
32
|
+
case value >= 3600:
|
|
33
|
+
HH = parseInt((value / 3600).toString(), 10)
|
|
34
|
+
MM = parseInt((value / 60).toString(), 10) - HH * 60
|
|
35
|
+
SS = parseInt((value % 60).toString(), 10)
|
|
36
|
+
if (SS < 10) {
|
|
37
|
+
SS = '0' + SS
|
|
38
|
+
}
|
|
39
|
+
if (MM < 10) {
|
|
40
|
+
MM = '0' + MM
|
|
41
|
+
}
|
|
42
|
+
if (SS < 10) {
|
|
43
|
+
SS = '0' + SS
|
|
44
|
+
}
|
|
45
|
+
return `${HH}:${MM}:${SS}`
|
|
46
|
+
default:
|
|
47
|
+
throw new Error('Val data is abnormal, please check the data!')
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @param {string} time
|
|
53
|
+
* @returns {string}
|
|
54
|
+
*/
|
|
55
|
+
export function formatTimeMin(time) {
|
|
56
|
+
if (!time) {
|
|
57
|
+
return '00:00'
|
|
58
|
+
}
|
|
59
|
+
const value = parseInt(time, 10)
|
|
60
|
+
let MM
|
|
61
|
+
let SS
|
|
62
|
+
switch (true) {
|
|
63
|
+
case value < 60:
|
|
64
|
+
if (value < 10) {
|
|
65
|
+
SS = '0' + value
|
|
66
|
+
} else {
|
|
67
|
+
SS = value
|
|
68
|
+
}
|
|
69
|
+
return `00:${SS}`
|
|
70
|
+
case value >= 60:
|
|
71
|
+
MM = parseInt((value / 60).toString(), 10)
|
|
72
|
+
SS = parseInt((value % 60).toString(), 10)
|
|
73
|
+
if (MM < 10) {
|
|
74
|
+
MM = '0' + MM
|
|
75
|
+
}
|
|
76
|
+
if (SS < 10) {
|
|
77
|
+
SS = '0' + SS
|
|
78
|
+
}
|
|
79
|
+
return `${MM}:${SS}`
|
|
80
|
+
default:
|
|
81
|
+
throw new Error('Val data is abnormal, please check the data!')
|
|
82
|
+
}
|
|
83
|
+
}
|