yks-element 1.0.322 → 1.0.792

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.
Files changed (88) hide show
  1. package/README.md +74 -8
  2. package/lib/theme-chalk/buttons.css +1 -0
  3. package/lib/theme-chalk/common.css +1 -0
  4. package/lib/theme-chalk/dialogs.css +1 -0
  5. package/{packages/Topic/src/indefiniteChoice.vue → lib/theme-chalk/element-variables.css} +0 -0
  6. package/lib/theme-chalk/elements.css +1 -0
  7. package/lib/theme-chalk/enlarge.css +1 -0
  8. package/{packages/styles → lib/theme-chalk}/fonts/element-icons.ttf +0 -0
  9. package/{packages/styles → lib/theme-chalk}/fonts/element-icons.woff +0 -0
  10. package/{packages/styles → lib/theme-chalk}/fonts/iconfont.ttf +0 -0
  11. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  12. package/lib/theme-chalk/icons.css +1 -0
  13. package/lib/theme-chalk/index.css +1 -0
  14. package/lib/theme-chalk/multimedia.css +1 -0
  15. package/lib/theme-chalk/paginations.css +1 -0
  16. package/lib/theme-chalk/scrollbars.css +1 -0
  17. package/lib/theme-chalk/selects.css +1 -0
  18. package/lib/theme-chalk/tables.css +1 -0
  19. package/lib/theme-chalk/tinymce.css +1 -0
  20. package/lib/theme-chalk/uploadfile.css +1 -0
  21. package/lib/theme-chalk/video.css +1 -0
  22. package/{packages/Topic/src/matching.vue → lib/theme-chalk/videoPlayer.css} +0 -0
  23. package/lib/yks.js +1 -0
  24. package/package.json +42 -12
  25. package/lib/fonts/element-icons.535877f5.woff +0 -0
  26. package/lib/fonts/element-icons.732389de.ttf +0 -0
  27. package/lib/fonts/iconfont.19124b0d.ttf +0 -0
  28. package/lib/fonts/iconfont.3ae3dd4e.woff +0 -0
  29. package/lib/yks.css +0 -1
  30. package/packages/Button/index.js +0 -8
  31. package/packages/Button/src/index.vue +0 -78
  32. package/packages/Dialog/index.js +0 -8
  33. package/packages/Dialog/src/index.vue +0 -103
  34. package/packages/Multimedia/index.js +0 -8
  35. package/packages/Multimedia/src/index.vue +0 -179
  36. package/packages/Pagination/index.js +0 -8
  37. package/packages/Pagination/src/index.vue +0 -149
  38. package/packages/Scrollbar/index.js +0 -8
  39. package/packages/Scrollbar/src/index.vue +0 -27
  40. package/packages/Select/index.js +0 -8
  41. package/packages/Select/src/index.vue +0 -350
  42. package/packages/Select/src/option.vue +0 -29
  43. package/packages/Table/index.js +0 -8
  44. package/packages/Table/src/index.vue +0 -141
  45. package/packages/Tinymce/index.js +0 -8
  46. package/packages/Tinymce/src/config.js +0 -25
  47. package/packages/Tinymce/src/index.vue +0 -500
  48. package/packages/Topic/index.js +0 -23
  49. package/packages/Topic/src/attachment.vue +0 -125
  50. package/packages/Topic/src/audioFrequency.vue +0 -127
  51. package/packages/Topic/src/clozeFillInBlanks.vue +0 -267
  52. package/packages/Topic/src/compound.vue +0 -221
  53. package/packages/Topic/src/config.js +0 -132
  54. package/packages/Topic/src/fillInBlanks.vue +0 -272
  55. package/packages/Topic/src/judgment.vue +0 -140
  56. package/packages/Topic/src/multiple.vue +0 -193
  57. package/packages/Topic/src/pictureAnswer.vue +0 -127
  58. package/packages/Topic/src/shortAnswer.vue +0 -136
  59. package/packages/Topic/src/single.vue +0 -194
  60. package/packages/UploadFile/index.js +0 -8
  61. package/packages/UploadFile/src/index.vue +0 -390
  62. package/packages/Video/index.js +0 -8
  63. package/packages/Video/src/index.vue +0 -351
  64. package/packages/assets/mixins/topic.js +0 -137
  65. package/packages/assets/utils/index.js +0 -83
  66. package/packages/assets/utils/topic.js +0 -132
  67. package/packages/icon/default/icons.js +0 -182
  68. package/packages/icon/default/icons.min.js +0 -1
  69. package/packages/icon/default/index.js +0 -7
  70. package/packages/icon/ks-pdf.png +0 -0
  71. package/packages/icon/ks-ppt.png +0 -0
  72. package/packages/icon/ks-word.png +0 -0
  73. package/packages/icon/ks-xslx.png +0 -0
  74. package/packages/icon/music-bg.png +0 -0
  75. package/packages/icon/video-bg.png +0 -0
  76. package/packages/index.js +0 -223
  77. package/packages/option/index.js +0 -6
  78. package/packages/styles/_mixin.scss +0 -93
  79. package/packages/styles/_variables.scss +0 -40
  80. package/packages/styles/common.scss +0 -200
  81. package/packages/styles/element-ui.scss +0 -135
  82. package/packages/styles/element-variables.scss +0 -794
  83. package/packages/styles/fonts/iconfont.woff +0 -0
  84. package/packages/styles/icon.scss +0 -69
  85. package/packages/styles/index.scss +0 -11
  86. package/packages/styles/select.scss +0 -98
  87. package/packages/styles/table.scss +0 -45
  88. package/packages/styles/topic.scss +0 -26
@@ -1,390 +0,0 @@
1
- <template>
2
- <yks-dialog
3
- :before-close="onClose"
4
- :close-on-click-modal="false"
5
- :destroy-on-close="true"
6
- :title="title"
7
- :show.sync="show"
8
- append-to-body
9
- width="600px"
10
- height="300px"
11
- @close="onClose"
12
- @sure="onSure"
13
- >
14
- <div v-if="fileData.fileType === 'recording'" class="dialog yks-tc">
15
- <h1 class="dialog-title">{{ formatTimes(timestamp) }}</h1>
16
- <div class="dialog-recording yks-flex h-center" @click="onRecord">
17
- <i :class="['icon-recording', iconName]"></i>
18
- </div>
19
- <div class="yks-mt10 yks-fs-12 info">
20
- 语音录入时长限制{{ (fileData.fileSize / 60).toFixed(2) }}分钟
21
- </div>
22
- <audio
23
- ref="audioS"
24
- :src="fileSrc"
25
- class="dialog-audio"
26
- @timeupdate="onTimeupdate"
27
- ></audio>
28
- </div>
29
- <div v-else class="dialog yks-tc">
30
- <Upload
31
- ref="uploadFile"
32
- drag
33
- action=""
34
- show-file-list
35
- :multiple="false"
36
- :accept="accept"
37
- :auto-upload="false"
38
- :limit="1"
39
- :on-change="beforeUpload"
40
- >
41
- <i class="el-icon-upload"></i>
42
- <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
43
- <div slot="tip" class="el-upload__tip">{{ tipsMsg }}</div>
44
- </Upload>
45
- </div>
46
- <slot slot="footer" name="footer" :row="fileDataRow">
47
- <div>
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
- >
59
- </div>
60
- </slot>
61
- </yks-dialog>
62
- </template>
63
-
64
- <script>
65
- import YksDialog from '../../Dialog'
66
- import YksButton from '../../Button'
67
- import { Upload, Message, MessageBox } from 'element-ui'
68
-
69
- import { formatTime } from '../../assets/utils/index'
70
-
71
- if (navigator.mediaDevices === undefined) {
72
- navigator.mediaDevices = {}
73
- }
74
-
75
- if (navigator.mediaDevices.getUserMedia === undefined) {
76
- navigator.mediaDevices.getUserMedia = function (constraints) {
77
- const getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia
78
- if (!getUserMedia) {
79
- return Promise.reject(new Error('getUserMedia is not implemented in this browser'))
80
- }
81
- return new Promise(function (resolve, reject) {
82
- getUserMedia.call(navigator, constraints, resolve, reject)
83
- })
84
- }
85
- }
86
-
87
- export default {
88
- name: 'YksUploadfile',
89
- components: {
90
- YksDialog,
91
- YksButton,
92
- Upload
93
- },
94
- props: {
95
- show: {
96
- type: Boolean,
97
- default: false
98
- },
99
- title: {
100
- type: String,
101
- default: ''
102
- },
103
- /* 上传函数 */
104
- uploadFileFunction: {
105
- type: Function
106
- },
107
- /*
108
- fileType: 上传类型
109
- typeList: 文件类型
110
- fileSize: 文件大小
111
- */
112
- fileData: {
113
- type: Object,
114
- default: () => {
115
- return {}
116
- }
117
- }
118
- },
119
- data() {
120
- return {
121
- /* 录音状态 */
122
- playStatus: false,
123
-
124
- /* 播放状态 */
125
- playing: false,
126
-
127
- /* 媒体流 */
128
- mediaRecorder: null,
129
-
130
- /* 录音文件地址 */
131
- fileSrc: '',
132
-
133
- /* 录音时长 */
134
- timestamp: 0,
135
-
136
- /* 记录录音时长 */
137
- recordTimestamp: 0,
138
-
139
- /* 定时器 */
140
- interval: null,
141
-
142
- /* 文件信息 */
143
- data: null,
144
-
145
- loading: false
146
- }
147
- },
148
- computed: {
149
- accept() {
150
- const { typeList } = this.fileData
151
- if (typeList && typeList.length > 0) {
152
- return '.' + typeList.join(',.')
153
- }
154
- return ''
155
- },
156
- tipsMsg() {
157
- let msg = ''
158
- let type = ''
159
- const { typeList, fileSize } = this.fileData
160
- if (typeList && typeList.length > 0) {
161
- type = typeList.join('、')
162
- msg = `只能上传${type}文件`
163
- if (fileSize) {
164
- return `${msg},且不超过${fileSize}MB`
165
- }
166
- }
167
- if (fileSize) {
168
- msg += `文件大小不超过${fileSize}MB`
169
- }
170
- return msg
171
- },
172
- iconName() {
173
- if (this.fileSrc && !this.playing) {
174
- return 'el-icon-caret-right'
175
- }
176
- if (this.playStatus || this.playing) {
177
- return 'icon-pause'
178
- }
179
- return 'el-icon-microphone'
180
- },
181
- fileDataRow() {
182
- return this.data || {}
183
- }
184
- },
185
- watch: {
186
- timestamp(val) {
187
- if (val <= 0.2) {
188
- clearInterval(this.interval)
189
- this.playing = false
190
- this.timestamp = this.recordTimestamp
191
- }
192
- },
193
- show(val) {
194
- if (val) {
195
- this.resetData()
196
- }
197
- }
198
- },
199
- methods: {
200
- formatTimes(value) {
201
- return formatTime(value)
202
- },
203
- resetData() {
204
- this.fileSrc = ''
205
- this.data = ''
206
- this.timestamp = 0
207
- this.recordTimestamp = 0
208
- this.playStatus = false
209
- this.playing = false
210
- },
211
-
212
- beforeUpload(file) {
213
- const name = file.name.substr(file.name.lastIndexOf('.') + 1).toLowerCase()
214
- const { typeList, fileSize } = this.fileData
215
- const isLt2M = file.size / 1024 / 1024 > fileSize
216
- const isType = typeList.includes(name)
217
- const type = typeList.join('、')
218
- if (fileSize && isLt2M) {
219
- Message.error(`上传文件大小不能超过 ${fileSize}MB!`)
220
- this.$refs.uploadFile.clearFiles()
221
- return false
222
- }
223
- if (typeList && !isType) {
224
- Message.error(`只能上传${type}文件!`)
225
- this.$refs.uploadFile.clearFiles()
226
- return false
227
- }
228
- this.fileSrc = file
229
- this.data = file
230
- return true
231
- },
232
-
233
- async handleUpload() {
234
- this.loading = true
235
- try {
236
- const data = await this.uploadFileFunction({
237
- file: this.data,
238
- fileData: this.fileData,
239
- fileSrc: this.fileSrc
240
- })
241
- this.$emit('sure', data)
242
- this.onClose()
243
- } catch (error) {
244
- console.log(error)
245
- }
246
- this.loading = false
247
- },
248
-
249
- onTimeupdate(el) {
250
- this.timestamp = this.recordTimestamp - el.target.currentTime
251
- },
252
-
253
- hanleDelete() {
254
- MessageBox.confirm('是否删除当前文件?', '提示', {
255
- confirmButtonText: '确定',
256
- cancelButtonText: '取消',
257
- type: 'warning'
258
- })
259
- .then(() => {
260
- this.fileSrc = ''
261
- this.data = ''
262
- this.timestamp = 0
263
- this.recordTimestamp = 0
264
- this.$refs.uploadFile.clearFiles()
265
- })
266
- .catch(() => {
267
- //
268
- })
269
- },
270
-
271
- /* 录音 */
272
- async onRecord() {
273
- if (this.fileSrc) {
274
- if (this.playing) {
275
- this.$refs.audioS.pause()
276
- this.playing = false
277
- } else {
278
- this.$refs.audioS.play()
279
- this.playing = true
280
- }
281
- return
282
- }
283
- try {
284
- if (this.playStatus) {
285
- this.mediaRecorder.stop()
286
- this.playStatus = false
287
- this.mediaRecorder = ''
288
- clearInterval(this.interval)
289
- this.interval = null
290
- this.recordTimestamp = this.timestamp
291
- } else {
292
- this.interval = setInterval(() => {
293
- this.timestamp += 1
294
- if (this.fileData.fileSize <= this.timestamp) {
295
- this.onRecord()
296
- }
297
- }, 1000)
298
- const audio = await navigator.mediaDevices.getUserMedia({
299
- audio: true,
300
- video: false
301
- })
302
- this.mediaRecorder = new MediaRecorder(audio)
303
- this.mediaRecorder.start()
304
- this.playStatus = true
305
- this.mediaRecorder.addEventListener('dataavailable', (el) => {
306
- this.fileSrc = URL.createObjectURL(el.data)
307
- this.data = el
308
- })
309
- }
310
- } catch (error) {
311
- const params = error
312
- this.playStatus = false
313
- this.mediaRecorder = ''
314
- clearInterval(this.interval)
315
- this.interval = null
316
- this.recordTimestamp = 0
317
- this.timestamp = 0
318
- let errorMessage
319
- switch (params.name) {
320
- case 'NotAllowedError':
321
- errorMessage = '用户拒绝,请在浏览器打开录音权限!'
322
- break
323
- case 'PermissionDeniedError':
324
- errorMessage = '用户已禁止网页调用录音设备'
325
- break
326
- case 'NotFoundError':
327
- errorMessage = '没接入录音设备'
328
- break
329
- case 'DevicesNotFoundError':
330
- errorMessage = '录音设备未找到'
331
- break
332
- case 'NotSupportedError':
333
- errorMessage = '不支持录音功能'
334
- break
335
- default:
336
- errorMessage = '录音调用错误'
337
- break
338
- }
339
- Message.error(errorMessage)
340
- }
341
- },
342
-
343
- onClose() {
344
- this.$emit('update:show', false)
345
- },
346
-
347
- onSure() {
348
- this.onClose()
349
- }
350
- }
351
- }
352
- </script>
353
-
354
- <style lang="scss" scoped>
355
- .dialog {
356
- position: relative;
357
- .dialog-title {
358
- margin-top: 20px;
359
- }
360
- .dialog-audio {
361
- display: none;
362
- }
363
- .dialog-recording {
364
- width: 100px;
365
- height: 100px;
366
- margin: 0 auto;
367
- border-radius: 50%;
368
- cursor: pointer;
369
- background-color: #03a9f4;
370
- &:hover {
371
- opacity: 0.7;
372
- }
373
- .icon-recording {
374
- font-size: 30px;
375
- color: #fff;
376
- }
377
- }
378
- .dialog-button {
379
- position: absolute;
380
- right: 0;
381
- bottom: 20px;
382
- }
383
- .icon-pause {
384
- width: 20px;
385
- height: 20px;
386
- border-left: #fff solid 5px;
387
- border-right: #fff solid 5px;
388
- }
389
- }
390
- </style>
@@ -1,8 +0,0 @@
1
- import YksVideo from './src/index';
2
-
3
- /* istanbul ignore next */
4
- YksVideo.install = function(Vue) {
5
- Vue.component(YksVideo.name, YksVideo);
6
- };
7
-
8
- export default YksVideo;