yks-element 1.0.314 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yks-element",
3
- "version": "1.0.314",
3
+ "version": "1.0.315",
4
4
  "description": "yks公共库",
5
5
  "private": false,
6
6
  "keywords": ["yks-element", "element-ui", "tinymce", "vue"],
@@ -37,7 +37,7 @@ export default {
37
37
  ...ElDialog.props,
38
38
  height: {
39
39
  type: String,
40
- default: '300px'
40
+ default: '390px'
41
41
  },
42
42
  show: {
43
43
  type: Boolean,
@@ -15,7 +15,17 @@
15
15
  ></i>
16
16
  </div>
17
17
  </div>
18
- <yks-video v-if="fileType === '2'" :src="data.content"></yks-video>
18
+ <yks-video v-else-if="fileType === '2'" :src="data.content"></yks-video>
19
+ <div v-else class="ks-stem__itemattrs" :title="fileName">
20
+ <div class="yks-tc file-stem">
21
+ <i class="el-icon-document-remove ks-stem__remove" @click="handleClick"></i>
22
+ <i
23
+ v-if="visibleDel"
24
+ class="el-icon-error media-delfile"
25
+ @click.stop="handleCloseFile"
26
+ ></i>
27
+ </div>
28
+ </div>
19
29
  <div class="ks-stem__content yks-text-ellipsis">
20
30
  {{ fileName }}
21
31
  </div>
@@ -135,6 +145,10 @@ export default {
135
145
  .ks-stem__itemattrs {
136
146
  border-radius: 4px;
137
147
  position: relative;
148
+ .ks-stem__remove{
149
+ font-size: 50px;
150
+ cursor: pointer;
151
+ }
138
152
  .ks-stem__icon {
139
153
  width: 77px;
140
154
  height: 77px;
@@ -29,6 +29,7 @@
29
29
  :show.sync="show"
30
30
  :fileData="fileData"
31
31
  :title="title"
32
+ :uploadFileFunction="uploadFileFunction"
32
33
  @sure="onSure"
33
34
  ></yks-uploadfile>
34
35
  </div>
@@ -93,19 +94,28 @@ export default {
93
94
  value: {
94
95
  required: true
95
96
  },
97
+ /* 语言包 */
96
98
  language: {
99
+ type: String,
97
100
  default: 'zh_CN'
98
101
  },
102
+ /* 扩展bar */
99
103
  toolbar: {
104
+ type: [String, Array],
100
105
  default: () => []
101
106
  },
107
+ /* 字数限制 */
102
108
  charLimit: {
109
+ type: Number,
103
110
  default: 5000
104
111
  },
112
+ /* 插件 */
105
113
  plugins: {
114
+ type: [String, Array],
106
115
  default: () => []
107
116
  },
108
117
  menubar: {
118
+ type: String,
109
119
  default: 'file edit insert view format table'
110
120
  },
111
121
  height: {
@@ -113,31 +123,37 @@ export default {
113
123
  default: '660px'
114
124
  },
115
125
  width: {
126
+ type: String,
116
127
  default: 'auto'
117
128
  },
118
129
  inline: {
119
130
  type: Boolean,
120
131
  default: false
121
132
  },
133
+ /* 音视频数据 */
122
134
  fileParams: {
123
135
  type: Array,
124
136
  default: () => []
125
137
  },
138
+ /*
139
+ 上传文件函数
140
+ 抛出blobInfo函数
141
+ 接收data src
142
+ */
126
143
  uploadFileToHwCloud: {
127
144
  required: true,
128
145
  type: Function
129
146
  },
130
- paramsList: {
131
- type: Array,
132
- default: () => {
133
- return [
134
- {
135
- keys: 'fileType',
136
- value: 'stem'
137
- }
138
- ]
139
- }
147
+ /*
148
+ 上传音视频文件函数
149
+ 抛出数组文件信息
150
+ 接收data src
151
+ */
152
+ uploadFileFunction: {
153
+ required: true,
154
+ type: Function
140
155
  },
156
+ /* 扩展插件 */
141
157
  externalPlugins: {
142
158
  type: Object,
143
159
  default: () => {
@@ -236,7 +252,7 @@ export default {
236
252
  })
237
253
 
238
254
  try {
239
- const { data } = await this.uploadFileToHwCloud(blobInfo)
255
+ const data = await this.uploadFileToHwCloud(blobInfo)
240
256
  success(data)
241
257
  } catch (error) {
242
258
  console.log(error)
@@ -7,7 +7,7 @@
7
7
  :show.sync="show"
8
8
  append-to-body
9
9
  width="600px"
10
- height="250px"
10
+ height="300px"
11
11
  @close="onClose"
12
12
  @sure="onSure"
13
13
  >
@@ -35,7 +35,6 @@
35
35
  :multiple="false"
36
36
  :accept="accept"
37
37
  :auto-upload="false"
38
- :headers="params.headers"
39
38
  :limit="1"
40
39
  :on-change="beforeUpload"
41
40
  >
@@ -105,17 +104,16 @@ export default {
105
104
  type: String,
106
105
  default: ''
107
106
  },
108
- params: {
109
- type: Object,
110
- default: () => {
111
- return {
112
- type: 'multimediaFile',
113
- headers: {},
114
- data: null
115
- }
116
- }
107
+ /* 上传函数 */
108
+ uploadFileFunction: {
109
+ type: Function,
110
+ required: true
117
111
  },
118
- uploadFn: Function,
112
+ /*
113
+ fileType: 上传类型
114
+ typeList: 文件类型
115
+ fileSize: 文件大小
116
+ */
119
117
  fileData: {
120
118
  type: Object,
121
119
  default: () => {
@@ -237,27 +235,9 @@ export default {
237
235
  async handleUpload() {
238
236
  this.loading = true
239
237
  try {
240
- const fileData = new FormData()
241
- Object.keys(this.params.data || {}).forEach((key) => {
242
- fileData.append(key, this.params.data[key])
243
- })
244
-
245
- if (this.fileData.fileType === 'recording') {
246
- const fileNmae = Date.now() + '.mp3'
247
- const file = new File([this.data.data], fileNmae)
248
- fileData.append('fileType', this.params.type || 'multimediaFile')
249
- fileData.append('file', file)
250
- } else {
251
- fileData.append('fileType', this.params.type || 'multimediaFile')
252
- fileData.append('file', this.data.raw)
253
- }
254
-
255
- const { data, code } = await this.uploadFn(fileData)
256
- if (code === 20000) {
257
- Message.success('添加成功')
258
- this.$emit('sure', data)
259
- this.onClose()
260
- }
238
+ const data = await this.uploadFileFunction(this.data)
239
+ this.$emit('sure', data)
240
+ this.onClose()
261
241
  } catch (error) {
262
242
  console.log(error)
263
243
  }
@@ -373,7 +353,7 @@ export default {
373
353
  .dialog {
374
354
  position: relative;
375
355
  .dialog-title {
376
- margin-top: 0;
356
+ margin-top: 20px;
377
357
  }
378
358
  .dialog-audio {
379
359
  display: none;
@@ -399,10 +379,10 @@ export default {
399
379
  bottom: 20px;
400
380
  }
401
381
  .icon-pause {
402
- width: 10px;
382
+ width: 20px;
403
383
  height: 20px;
404
- border-left: #fff solid 4px;
405
- border-right: #fff solid 4px;
384
+ border-left: #fff solid 5px;
385
+ border-right: #fff solid 5px;
406
386
  }
407
387
  }
408
388
  </style>
@@ -1,39 +1,48 @@
1
1
  <template>
2
- <div class="ks-stem__videos yks-flex h-center v-center" :class="{ 'dialog-pause': playing }">
3
- <video
4
- :ref="videoId"
5
- :width="width"
6
- :height="height"
7
- :src="src"
8
- :poster="musicBgs"
9
- playsinline
10
- webkit-playsinline
11
- preload="auto"
12
- class="file__videos"
13
- @timeupdate="durationUpdate"
14
- @canplay="getDuration"
15
- ></video>
16
- <div class="slider-video">
17
- <i class="el-icon-video-pause" @click.stop="handlePause"></i>
18
- <Slider
19
- v-model="musicDuration"
20
- :max="musicAllDuration"
21
- height="2px"
22
- :show-tooltip="false"
23
- class="slider__value"
24
- @change="changeMusicDuration"
25
- @mousedown.native="isChange = true"
26
- @mouseup.native="isChange = false"
27
- ></Slider>
28
- <span class="slider__text">{{ formatTime(musicAllDuration) }}</span>
29
- <i class="el-icon-full-screen" @click.stop="handleFullScreen"></i>
30
- </div>
2
+ <div class="multimedia__video">
31
3
  <div
32
- v-if="!playing"
33
- class="dialog-playing yks-flex h-center v-center"
34
- @click.stop="handlePlaying"
4
+ class="ks-stem__videos yks-flex h-center v-center"
5
+ :class="{ 'dialog-pause': playing }"
35
6
  >
36
- <i class="icon-recording el-icon-video-play"></i>
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>
37
46
  </div>
38
47
  </div>
39
48
  </template>
@@ -61,10 +70,19 @@ export default {
61
70
  /* 歌曲当前时长 */
62
71
  musicDuration: 0,
63
72
  /* 判断是否被拖动 */
64
- isChange: false
73
+ isChange: false,
74
+ /* 判断是否为Infinity */
75
+ isInfinity: false
65
76
  }
66
77
  },
67
78
  computed: {
79
+ playingIcon() {
80
+ if (this.playing) {
81
+ return 'el-icon-video-pause'
82
+ } else {
83
+ return 'el-icon-video-play'
84
+ }
85
+ },
68
86
  /* 播放背景图 */
69
87
  musicBgs() {
70
88
  if (this.fileType === '3') {
@@ -150,7 +168,15 @@ export default {
150
168
  /* 获取音视频时长 */
151
169
  getDuration() {
152
170
  const video = this.$refs[this.videoId]
153
- this.musicAllDuration = video.duration
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
+ }
154
180
  },
155
181
  /* 获取音视频播放当前时间 */
156
182
  durationUpdate() {
@@ -163,6 +189,8 @@ export default {
163
189
  handlePlaying() {
164
190
  if (!this.playing) {
165
191
  this.$refs[this.videoId].play()
192
+ } else {
193
+ this.handlePause()
166
194
  }
167
195
  },
168
196
  /* 暂停 */
@@ -175,93 +203,150 @@ export default {
175
203
  }
176
204
  </script>
177
205
  <style lang="scss" scoped>
206
+ .multimedia__video {
207
+ position: relative;
208
+ margin-right: 10px;
178
209
 
179
- .slider-video {
180
- position: absolute;
181
- width: 100%;
182
- left: 0;
183
- bottom: 2px;
184
- display: flex;
185
- align-items: center;
186
- .el-icon-video-pause {
187
- cursor: pointer;
188
- color: #ffffff;
189
- margin-left: 5px;
190
- margin-right: 5px;
191
- }
192
- .el-icon-full-screen {
193
- cursor: pointer;
194
- color: #ffffff;
195
- font-size: 12px;
196
- margin-left: 5px;
197
- margin-right: 5px;
198
- }
199
- .slider__value {
200
- flex: 1;
201
- margin: 0 5px;
202
- }
203
- .slider__text {
204
- color: #fff;
205
- font-size: 12px;
206
- transform: scale(0.7);
207
- }
208
- ::v-deep {
209
- .el-slider__runway {
210
- margin: 0;
211
- height: 1px;
212
- background-color: #ffffff;
213
- border-radius: 1px;
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;
214
224
  }
215
- .el-slider__bar {
216
- height: 1px;
217
- background-color: transparent;
218
- border-radius: 1px;
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;
219
235
  }
220
- .el-slider__button-wrapper {
221
- height: 31px;
222
- width: 13px;
236
+ .slider__text {
237
+ color: #fff;
238
+ font-size: 12px;
239
+ transform: scale(0.7);
223
240
  }
224
- .el-slider__button {
225
- height: 5px;
226
- width: 5px;
227
- background: #ffffff;
228
- border: unset;
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
+ }
229
265
  }
230
266
  }
231
- }
232
267
 
233
- .media-delvideo {
234
- top: -5px;
235
- right: -5px;
236
- }
268
+ .file-stem {
269
+ position: relative;
270
+ width: 80px;
271
+ margin: 0 auto;
272
+ }
237
273
 
238
- .ks-stem__videos {
239
- border-radius: 4px;
240
- position: relative;
241
- .file__videos {
242
- background: #000000;
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;
243
302
  }
244
- }
245
303
 
246
- .dialog-playing {
247
- margin: 0 auto;
248
- width: 50px;
249
- height: 50px;
250
- cursor: pointer;
251
- position: absolute;
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
+ }
252
321
 
253
- &:hover {
254
- opacity: 0.7;
322
+ .ks-stem__videos {
323
+ border-radius: 4px;
324
+ position: relative;
325
+ .file__videos {
326
+ background: #000000;
327
+ }
255
328
  }
256
- .icon-recording {
257
- color: #fff;
258
- font-size: 30px;
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
+ }
259
344
  }
260
- }
261
345
 
262
- .slider-video {
263
- opacity: 1;
264
- transition: 0.3s opacity;
265
- -webkit-transition: 0.3s opacity;
346
+ .slider-video {
347
+ opacity: 0;
348
+ transition: 0.3s opacity;
349
+ -webkit-transition: 0.3s opacity;
350
+ }
266
351
  }
267
352
  </style>
package/packages/index.js CHANGED
@@ -87,8 +87,11 @@ import YksDialog from './Dialog'
87
87
  import YksMultimedia from './Multimedia'
88
88
  import YksTinymce from './Tinymce'
89
89
  import YksPagination from './Pagination'
90
- import YksScrollbar from './Select'
90
+ import YksSelect from './Select'
91
+ import YksScrollbar from './Scrollbar'
91
92
  import YksTable from './Table'
93
+ import YksUploadfile from './UploadFile'
94
+ import YksVideo from './Video'
92
95
  import YksOption from './option/index'
93
96
 
94
97
  import locale from 'element-ui/src/locale'
@@ -98,9 +101,12 @@ const components = [
98
101
  YksMultimedia,
99
102
  YksTinymce,
100
103
  YksPagination,
104
+ YksSelect,
101
105
  YksScrollbar,
102
106
  YksTable,
103
- YksOption
107
+ YksUploadfile,
108
+ YksOption,
109
+ YksVideo
104
110
  ]
105
111
  const install = function (Vue, opts = {}) {
106
112
  locale.use(opts.locale)
@@ -130,7 +136,7 @@ if (typeof window !== 'undefined' && window.Vue) {
130
136
  install(window.Vue)
131
137
  }
132
138
  export default {
133
- version: '1.0.314',
139
+ version: '1.0.315',
134
140
  locale: locale.use,
135
141
  i18n: locale.i18n,
136
142
  install,