yks-element 1.0.314 → 1.0.317

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.317",
4
4
  "description": "yks公共库",
5
5
  "private": false,
6
6
  "keywords": ["yks-element", "element-ui", "tinymce", "vue"],
@@ -19,6 +19,17 @@ export default {
19
19
  .el-button {
20
20
  padding: 8px 24px;
21
21
  }
22
+ .el-button--text {
23
+ border-color: transparent;
24
+ color: #409eff;
25
+ background: transparent;
26
+ padding-left: 0;
27
+ padding-right: 0;
28
+ }
29
+
30
+ .el-button--text.is-plain {
31
+ padding: 8px 24px;
32
+ }
22
33
 
23
34
  .el-button--primary.is-plain,
24
35
  .el-button--primary.is-plain.is-disabled {
@@ -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: () => {
@@ -167,6 +183,10 @@ export default {
167
183
  },
168
184
  set(value) {
169
185
  this.$emit('input', value)
186
+ this.$emit('change', {
187
+ value: value,
188
+ itemAttr: { type: this.fileData.fileType, content: this.mediaFile }
189
+ })
170
190
  }
171
191
  },
172
192
  containerWidth() {
@@ -236,7 +256,7 @@ export default {
236
256
  })
237
257
 
238
258
  try {
239
- const { data } = await this.uploadFileToHwCloud(blobInfo)
259
+ const data = await this.uploadFileToHwCloud(blobInfo)
240
260
  success(data)
241
261
  } catch (error) {
242
262
  console.log(error)
@@ -351,7 +371,7 @@ export default {
351
371
  },
352
372
  methods: {
353
373
  handleCloseFile(row, index) {
354
- this.$emit('delteFile', {
374
+ this.$emit('delte', {
355
375
  row: row,
356
376
  index: index
357
377
  })
@@ -379,7 +399,7 @@ export default {
379
399
  }
380
400
  },
381
401
  onSure(value) {
382
- this.$emit('changeFile', {
402
+ this.$emit('change', {
383
403
  value: this.tinymceContent,
384
404
  itemAttr: { type: this.fileData.fileType, content: value }
385
405
  })
@@ -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
  >
@@ -44,25 +43,21 @@
44
43
  <div slot="tip" class="el-upload__tip">{{ tipsMsg }}</div>
45
44
  </Upload>
46
45
  </div>
47
- <template v-slot:footer>
46
+ <slot slot="footer" name="footer" :row="fileDataRow">
48
47
  <div>
49
- <yks-button
50
- type="primary"
51
- :disabled="!fileSrc || loading"
52
- :loading="loading"
53
- icon="el-icon-upload"
54
- @click="handleUpload"
55
- >上传文件</yks-button
56
- >
57
- <yks-button
58
- type="danger"
59
- :disabled="!fileSrc"
60
- icon="el-icon-delete"
61
- @click="hanleDelete"
62
- >删除文件</yks-button
63
- >
48
+ <yks-button
49
+ type="primary"
50
+ icon="el-icon-upload"
51
+ :disabled="!fileSrc || loading"
52
+ :loading="loading"
53
+ @click="handleUpload"
54
+ >上传文件</yks-button
55
+ >
56
+ <yks-button type="danger" icon="el-icon-delete" :disabled="!fileSrc" @click="hanleDelete"
57
+ >删除文件</yks-button
58
+ >
64
59
  </div>
65
- </template>
60
+ </slot>
66
61
  </yks-dialog>
67
62
  </template>
68
63
 
@@ -105,17 +100,16 @@ export default {
105
100
  type: String,
106
101
  default: ''
107
102
  },
108
- params: {
109
- type: Object,
110
- default: () => {
111
- return {
112
- type: 'multimediaFile',
113
- headers: {},
114
- data: null
115
- }
116
- }
103
+ /* 上传函数 */
104
+ uploadFileFunction: {
105
+ type: Function,
106
+ required: true
117
107
  },
118
- uploadFn: Function,
108
+ /*
109
+ fileType: 上传类型
110
+ typeList: 文件类型
111
+ fileSize: 文件大小
112
+ */
119
113
  fileData: {
120
114
  type: Object,
121
115
  default: () => {
@@ -184,6 +178,9 @@ export default {
184
178
  return 'icon-pause'
185
179
  }
186
180
  return 'el-icon-microphone'
181
+ },
182
+ fileDataRow() {
183
+ return this.data || {}
187
184
  }
188
185
  },
189
186
  watch: {
@@ -237,27 +234,13 @@ export default {
237
234
  async handleUpload() {
238
235
  this.loading = true
239
236
  try {
240
- const fileData = new FormData()
241
- Object.keys(this.params.data || {}).forEach((key) => {
242
- fileData.append(key, this.params.data[key])
237
+ const data = await this.uploadFileFunction({
238
+ file: this.data,
239
+ fileData: this.fileData,
240
+ fileSrc: this.fileSrc
243
241
  })
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
- }
242
+ this.$emit('sure', data)
243
+ this.onClose()
261
244
  } catch (error) {
262
245
  console.log(error)
263
246
  }
@@ -373,7 +356,7 @@ export default {
373
356
  .dialog {
374
357
  position: relative;
375
358
  .dialog-title {
376
- margin-top: 0;
359
+ margin-top: 20px;
377
360
  }
378
361
  .dialog-audio {
379
362
  display: none;
@@ -399,10 +382,10 @@ export default {
399
382
  bottom: 20px;
400
383
  }
401
384
  .icon-pause {
402
- width: 10px;
385
+ width: 20px;
403
386
  height: 20px;
404
- border-left: #fff solid 4px;
405
- border-right: #fff solid 4px;
387
+ border-left: #fff solid 5px;
388
+ border-right: #fff solid 5px;
406
389
  }
407
390
  }
408
391
  </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,14 @@ export default {
150
168
  /* 获取音视频时长 */
151
169
  getDuration() {
152
170
  const video = this.$refs[this.videoId]
153
- this.musicAllDuration = video.duration
171
+
172
+ if (!Number.isFinite(video.duration)) {
173
+ this.musicAllDuration = 300
174
+ this.isInfinity = true
175
+ } else {
176
+ this.isInfinity = false
177
+ this.musicAllDuration = video.duration
178
+ }
154
179
  },
155
180
  /* 获取音视频播放当前时间 */
156
181
  durationUpdate() {
@@ -163,6 +188,8 @@ export default {
163
188
  handlePlaying() {
164
189
  if (!this.playing) {
165
190
  this.$refs[this.videoId].play()
191
+ } else {
192
+ this.handlePause()
166
193
  }
167
194
  },
168
195
  /* 暂停 */
@@ -175,93 +202,150 @@ export default {
175
202
  }
176
203
  </script>
177
204
  <style lang="scss" scoped>
205
+ .multimedia__video {
206
+ position: relative;
207
+ margin-right: 10px;
178
208
 
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;
209
+ .slider-video {
210
+ position: absolute;
211
+ width: 100%;
212
+ left: 0;
213
+ bottom: 2px;
214
+ display: flex;
215
+ align-items: center;
216
+
217
+ .video-icon_mini {
218
+ font-size: 13px !important;
219
+ cursor: pointer;
220
+ color: #ffffff;
221
+ margin-left: 5px;
222
+ margin-right: 5px;
214
223
  }
215
- .el-slider__bar {
216
- height: 1px;
217
- background-color: transparent;
218
- border-radius: 1px;
224
+
225
+ .el-icon-video-pause {
226
+ cursor: pointer;
227
+ color: #ffffff;
228
+ margin-left: 5px;
229
+ margin-right: 5px;
230
+ }
231
+ .slider__value {
232
+ flex: 1;
233
+ margin: 0 5px;
219
234
  }
220
- .el-slider__button-wrapper {
221
- height: 31px;
222
- width: 13px;
235
+ .slider__text {
236
+ color: #fff;
237
+ font-size: 12px;
238
+ transform: scale(0.7);
223
239
  }
224
- .el-slider__button {
225
- height: 5px;
226
- width: 5px;
227
- background: #ffffff;
228
- border: unset;
240
+ ::v-deep {
241
+ .el-slider__runway {
242
+ margin: 0;
243
+ }
244
+ .el-slider__runway {
245
+ height: 1px;
246
+ background-color: #ffffff;
247
+ border-radius: 1px;
248
+ }
249
+ .el-slider__bar {
250
+ height: 1px;
251
+ background-color: transparent;
252
+ border-radius: 1px;
253
+ }
254
+ .el-slider__button-wrapper {
255
+ height: 31px;
256
+ width: 13px;
257
+ }
258
+ .el-slider__button {
259
+ height: 5px;
260
+ width: 5px;
261
+ background: #ffffff;
262
+ border: unset;
263
+ }
229
264
  }
230
265
  }
231
- }
232
266
 
233
- .media-delvideo {
234
- top: -5px;
235
- right: -5px;
236
- }
267
+ .file-stem {
268
+ position: relative;
269
+ width: 80px;
270
+ margin: 0 auto;
271
+ }
237
272
 
238
- .ks-stem__videos {
239
- border-radius: 4px;
240
- position: relative;
241
- .file__videos {
242
- background: #000000;
273
+ &:hover {
274
+ .media-delfile,
275
+ .media-delvideo {
276
+ opacity: 1 !important;
277
+ }
278
+
279
+ .dialog-pause {
280
+ .slider-video {
281
+ opacity: 1 !important;
282
+ }
283
+ }
284
+ }
285
+ .media-delfile,
286
+ .media-delvideo {
287
+ color: red;
288
+ position: absolute;
289
+ opacity: 0;
290
+ right: -3px;
291
+ top: -3px;
292
+ background: #fff;
293
+ border-radius: 50%;
294
+ cursor: pointer;
295
+ transition: 0.3s opacity;
296
+ -webkit-transition: 0.3s opacity;
297
+ }
298
+ .media-delvideo {
299
+ top: -5px;
300
+ right: -5px;
243
301
  }
244
- }
245
302
 
246
- .dialog-playing {
247
- margin: 0 auto;
248
- width: 50px;
249
- height: 50px;
250
- cursor: pointer;
251
- position: absolute;
303
+ .ks-stem__itemattrs {
304
+ border-radius: 4px;
305
+ position: relative;
306
+ .ks-stem__icon {
307
+ width: 77px;
308
+ height: 77px;
309
+ margin-bottom: 9px;
310
+ cursor: pointer;
311
+ }
312
+ }
313
+ .ks-stem__content {
314
+ width: 160px;
315
+ font-size: 12px;
316
+ text-align: center;
317
+ padding-top: 5px;
318
+ color: #000;
319
+ }
252
320
 
253
- &:hover {
254
- opacity: 0.7;
321
+ .ks-stem__videos {
322
+ border-radius: 4px;
323
+ position: relative;
324
+ .file__videos {
325
+ background: #000000;
326
+ }
255
327
  }
256
- .icon-recording {
257
- color: #fff;
258
- font-size: 30px;
328
+
329
+ .dialog-playing {
330
+ margin: 0 auto;
331
+ width: 50px;
332
+ height: 50px;
333
+ cursor: pointer;
334
+ position: absolute;
335
+
336
+ &:hover {
337
+ opacity: 0.7;
338
+ }
339
+ .icon-recording {
340
+ color: #fff;
341
+ font-size: 30px !important;
342
+ }
259
343
  }
260
- }
261
344
 
262
- .slider-video {
263
- opacity: 1;
264
- transition: 0.3s opacity;
265
- -webkit-transition: 0.3s opacity;
345
+ .slider-video {
346
+ opacity: 0;
347
+ transition: 0.3s opacity;
348
+ -webkit-transition: 0.3s opacity;
349
+ }
266
350
  }
267
351
  </style>