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.
- package/README.md +74 -8
- package/lib/theme-chalk/buttons.css +1 -0
- package/lib/theme-chalk/common.css +1 -0
- package/lib/theme-chalk/dialogs.css +1 -0
- package/{packages/Topic/src/indefiniteChoice.vue → lib/theme-chalk/element-variables.css} +0 -0
- package/lib/theme-chalk/elements.css +1 -0
- package/lib/theme-chalk/enlarge.css +1 -0
- package/{packages/styles → lib/theme-chalk}/fonts/element-icons.ttf +0 -0
- package/{packages/styles → lib/theme-chalk}/fonts/element-icons.woff +0 -0
- package/{packages/styles → lib/theme-chalk}/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/icons.css +1 -0
- package/lib/theme-chalk/index.css +1 -0
- package/lib/theme-chalk/multimedia.css +1 -0
- package/lib/theme-chalk/paginations.css +1 -0
- package/lib/theme-chalk/scrollbars.css +1 -0
- package/lib/theme-chalk/selects.css +1 -0
- package/lib/theme-chalk/tables.css +1 -0
- package/lib/theme-chalk/tinymce.css +1 -0
- package/lib/theme-chalk/uploadfile.css +1 -0
- package/lib/theme-chalk/video.css +1 -0
- package/{packages/Topic/src/matching.vue → lib/theme-chalk/videoPlayer.css} +0 -0
- package/lib/yks.js +1 -0
- package/package.json +42 -12
- package/lib/fonts/element-icons.535877f5.woff +0 -0
- package/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 +0 -1
- package/packages/Button/index.js +0 -8
- package/packages/Button/src/index.vue +0 -78
- package/packages/Dialog/index.js +0 -8
- package/packages/Dialog/src/index.vue +0 -103
- package/packages/Multimedia/index.js +0 -8
- package/packages/Multimedia/src/index.vue +0 -179
- package/packages/Pagination/index.js +0 -8
- package/packages/Pagination/src/index.vue +0 -149
- package/packages/Scrollbar/index.js +0 -8
- package/packages/Scrollbar/src/index.vue +0 -27
- package/packages/Select/index.js +0 -8
- package/packages/Select/src/index.vue +0 -350
- package/packages/Select/src/option.vue +0 -29
- package/packages/Table/index.js +0 -8
- package/packages/Table/src/index.vue +0 -141
- package/packages/Tinymce/index.js +0 -8
- package/packages/Tinymce/src/config.js +0 -25
- package/packages/Tinymce/src/index.vue +0 -500
- package/packages/Topic/index.js +0 -23
- package/packages/Topic/src/attachment.vue +0 -125
- package/packages/Topic/src/audioFrequency.vue +0 -127
- package/packages/Topic/src/clozeFillInBlanks.vue +0 -267
- package/packages/Topic/src/compound.vue +0 -221
- package/packages/Topic/src/config.js +0 -132
- package/packages/Topic/src/fillInBlanks.vue +0 -272
- package/packages/Topic/src/judgment.vue +0 -140
- package/packages/Topic/src/multiple.vue +0 -193
- package/packages/Topic/src/pictureAnswer.vue +0 -127
- package/packages/Topic/src/shortAnswer.vue +0 -136
- package/packages/Topic/src/single.vue +0 -194
- package/packages/UploadFile/index.js +0 -8
- package/packages/UploadFile/src/index.vue +0 -390
- package/packages/Video/index.js +0 -8
- package/packages/Video/src/index.vue +0 -351
- package/packages/assets/mixins/topic.js +0 -137
- package/packages/assets/utils/index.js +0 -83
- package/packages/assets/utils/topic.js +0 -132
- package/packages/icon/default/icons.js +0 -182
- package/packages/icon/default/icons.min.js +0 -1
- package/packages/icon/default/index.js +0 -7
- 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 +0 -223
- package/packages/option/index.js +0 -6
- package/packages/styles/_mixin.scss +0 -93
- package/packages/styles/_variables.scss +0 -40
- package/packages/styles/common.scss +0 -200
- package/packages/styles/element-ui.scss +0 -135
- package/packages/styles/element-variables.scss +0 -794
- package/packages/styles/fonts/iconfont.woff +0 -0
- package/packages/styles/icon.scss +0 -69
- package/packages/styles/index.scss +0 -11
- package/packages/styles/select.scss +0 -98
- package/packages/styles/table.scss +0 -45
- package/packages/styles/topic.scss +0 -26
|
@@ -1,351 +0,0 @@
|
|
|
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
|
-
|
|
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
|
-
}
|
|
179
|
-
},
|
|
180
|
-
/* 获取音视频播放当前时间 */
|
|
181
|
-
durationUpdate() {
|
|
182
|
-
if (!this.isChange) {
|
|
183
|
-
const video = this.$refs[this.videoId]
|
|
184
|
-
this.musicDuration = video.currentTime
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
/* 播放 */
|
|
188
|
-
handlePlaying() {
|
|
189
|
-
if (!this.playing) {
|
|
190
|
-
this.$refs[this.videoId].play()
|
|
191
|
-
} else {
|
|
192
|
-
this.handlePause()
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
/* 暂停 */
|
|
196
|
-
handlePause() {
|
|
197
|
-
if (this.playing) {
|
|
198
|
-
this.$refs[this.videoId].pause()
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
</script>
|
|
204
|
-
<style lang="scss" scoped>
|
|
205
|
-
.multimedia__video {
|
|
206
|
-
position: relative;
|
|
207
|
-
margin-right: 10px;
|
|
208
|
-
|
|
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;
|
|
223
|
-
}
|
|
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;
|
|
234
|
-
}
|
|
235
|
-
.slider__text {
|
|
236
|
-
color: #fff;
|
|
237
|
-
font-size: 12px;
|
|
238
|
-
transform: scale(0.7);
|
|
239
|
-
}
|
|
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
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
.file-stem {
|
|
268
|
-
position: relative;
|
|
269
|
-
width: 80px;
|
|
270
|
-
margin: 0 auto;
|
|
271
|
-
}
|
|
272
|
-
|
|
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;
|
|
301
|
-
}
|
|
302
|
-
|
|
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
|
-
}
|
|
320
|
-
|
|
321
|
-
.ks-stem__videos {
|
|
322
|
-
border-radius: 4px;
|
|
323
|
-
position: relative;
|
|
324
|
-
.file__videos {
|
|
325
|
-
background: #000000;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
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
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
.slider-video {
|
|
346
|
-
opacity: 0;
|
|
347
|
-
transition: 0.3s opacity;
|
|
348
|
-
-webkit-transition: 0.3s opacity;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
</style>
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { toolbar, plugins, toolbarSpare } from '../utils/topic'
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
model: {
|
|
5
|
-
prop: 'fromData',
|
|
6
|
-
event: 'change'
|
|
7
|
-
},
|
|
8
|
-
props: {
|
|
9
|
-
topicDataExtent: {
|
|
10
|
-
type: Object,
|
|
11
|
-
default: () => {
|
|
12
|
-
return {}
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
uploadFileCloud: {
|
|
16
|
-
required: true,
|
|
17
|
-
type: Function
|
|
18
|
-
},
|
|
19
|
-
fromData: {
|
|
20
|
-
required: true,
|
|
21
|
-
type: Object,
|
|
22
|
-
default: () => {
|
|
23
|
-
return {}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
data() {
|
|
28
|
-
return {
|
|
29
|
-
pageLoading: false,
|
|
30
|
-
processing: false,
|
|
31
|
-
toolbar: toolbar,
|
|
32
|
-
toolbarSpare: toolbarSpare,
|
|
33
|
-
plugins: plugins,
|
|
34
|
-
topic: {
|
|
35
|
-
single: '单项选择题',
|
|
36
|
-
multiple: '多项选择题',
|
|
37
|
-
judgment: '判断题',
|
|
38
|
-
short_answer: '简答题'
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
methods: {
|
|
43
|
-
/**
|
|
44
|
-
* 获取题类型
|
|
45
|
-
* @param {string} type
|
|
46
|
-
* @return {Object}
|
|
47
|
-
*/
|
|
48
|
-
getFileType(type, data) {
|
|
49
|
-
if (data) {
|
|
50
|
-
let params = {}
|
|
51
|
-
switch (type) {
|
|
52
|
-
case 'stem':
|
|
53
|
-
params = {
|
|
54
|
-
stem_voiceRecord: 'recording',
|
|
55
|
-
stem_video: 'video',
|
|
56
|
-
stem_audio: 'audio',
|
|
57
|
-
stem_document: 'file'
|
|
58
|
-
}
|
|
59
|
-
break
|
|
60
|
-
case 'answer':
|
|
61
|
-
params = {
|
|
62
|
-
answer_voiceRecord: 'recording',
|
|
63
|
-
answer_video: 'video',
|
|
64
|
-
answer_audio: 'audio',
|
|
65
|
-
answer_document: 'file'
|
|
66
|
-
}
|
|
67
|
-
break
|
|
68
|
-
case 'option':
|
|
69
|
-
params = {
|
|
70
|
-
option_voiceRecord: 'recording',
|
|
71
|
-
option_video: 'video',
|
|
72
|
-
option_audio: 'audio',
|
|
73
|
-
option_document: 'file'
|
|
74
|
-
}
|
|
75
|
-
break
|
|
76
|
-
case 'analysis':
|
|
77
|
-
params = {
|
|
78
|
-
description_voiceRecord: 'recording',
|
|
79
|
-
description_video: 'video',
|
|
80
|
-
description_audio: 'audio',
|
|
81
|
-
description_document: 'file'
|
|
82
|
-
}
|
|
83
|
-
break
|
|
84
|
-
}
|
|
85
|
-
const fileType = params[data.type]
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
...data,
|
|
89
|
-
fileType
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return false
|
|
93
|
-
},
|
|
94
|
-
getFileTypes(type, list) {
|
|
95
|
-
return (list || []).map((v) => this.getFileType(type, v))
|
|
96
|
-
},
|
|
97
|
-
async uploadFileToHwCloud(file) {
|
|
98
|
-
try {
|
|
99
|
-
const fileData = new FormData()
|
|
100
|
-
fileData.append('fileType', 'stem')
|
|
101
|
-
fileData.append('file', file.blob())
|
|
102
|
-
const { data, code } = await this.uploadFileCloud(fileData)
|
|
103
|
-
if (code === 20000) {
|
|
104
|
-
return data
|
|
105
|
-
} else {
|
|
106
|
-
return ''
|
|
107
|
-
}
|
|
108
|
-
} catch (error) {
|
|
109
|
-
console.log(error)
|
|
110
|
-
return ''
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
async uploadFileFunction({ file, fileData }) {
|
|
114
|
-
try {
|
|
115
|
-
const fileDatas = new FormData()
|
|
116
|
-
if (fileData.fileType === 'recording') {
|
|
117
|
-
const fileNmae = Date.now() + '.mp3'
|
|
118
|
-
const files = new File([file.data], fileNmae)
|
|
119
|
-
fileDatas.append('fileType', 'multimediaFile')
|
|
120
|
-
fileDatas.append('file', files)
|
|
121
|
-
} else {
|
|
122
|
-
fileDatas.append('fileType', 'multimediaFile')
|
|
123
|
-
fileDatas.append('file', file.raw)
|
|
124
|
-
}
|
|
125
|
-
const { data, code } = await this.uploadFileCloud(fileDatas)
|
|
126
|
-
if (code === 20000) {
|
|
127
|
-
return data
|
|
128
|
-
} else {
|
|
129
|
-
return Promise.reject(new Error('出错了'))
|
|
130
|
-
}
|
|
131
|
-
} catch (error) {
|
|
132
|
-
console.log(error)
|
|
133
|
-
return Promise.reject(error)
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* uploadRecording 录音
|
|
3
|
-
* uploadVideo 视频
|
|
4
|
-
* uploadAudio 音频
|
|
5
|
-
* uploadFile 文件
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export const toolbar = [
|
|
9
|
-
'bold underline italic strikethrough | kityformula-editor subscript superscript charmap | link image | table | removeformat | uploadRecording uploadVideo uploadAudio uploadFile'
|
|
10
|
-
]
|
|
11
|
-
|
|
12
|
-
/* 选项、填空等 */
|
|
13
|
-
export const toolbarSpare = ['kityformula-editor subscript superscript charmap']
|
|
14
|
-
|
|
15
|
-
/* 插件 */
|
|
16
|
-
export const plugins = ['kityformula-editor powerpaste lists image media table charmap imagetools']
|
|
17
|
-
|
|
18
|
-
/* 选项字符 */
|
|
19
|
-
export const letter = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N']
|
|
20
|
-
|
|
21
|
-
/* 自定义添加菜单项(录音、上传视频、上传音乐、上传文件):题干 / 标题 - 类型 */
|
|
22
|
-
export const stemItemType = {
|
|
23
|
-
recording: 'stem_voiceRecord',
|
|
24
|
-
video: 'stem_video',
|
|
25
|
-
audio: 'stem_audio',
|
|
26
|
-
file: 'stem_document'
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/* 自定义添加菜单项(录音、上传视频、上传音乐、上传文件): 标准答案 - 类型 */
|
|
30
|
-
export const shortItemType = {
|
|
31
|
-
recording: 'answer_voiceRecord',
|
|
32
|
-
video: 'answer_video',
|
|
33
|
-
audio: 'answer_audio',
|
|
34
|
-
file: 'answer_document'
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/* 自定义添加菜单项(录音、上传视频、上传音乐、上传文件): 选项 - 类型 */
|
|
38
|
-
export const optionItemType = {
|
|
39
|
-
recording: 'option_voiceRecord',
|
|
40
|
-
video: 'option_video',
|
|
41
|
-
audio: 'option_audio',
|
|
42
|
-
file: 'option_document'
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/* 自定义添加菜单项(录音、上传视频、上传音乐、上传文件): 答案解析 - 类型 */
|
|
46
|
-
export const analysisItemType = {
|
|
47
|
-
recording: 'description_voiceRecord',
|
|
48
|
-
video: 'description_video',
|
|
49
|
-
audio: 'description_audio',
|
|
50
|
-
file: 'description_document'
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* 获取题类型
|
|
55
|
-
* @param {string} type
|
|
56
|
-
* @return {Object}
|
|
57
|
-
*/
|
|
58
|
-
export const getFileType = (type, data) => {
|
|
59
|
-
if (data) {
|
|
60
|
-
let params = {}
|
|
61
|
-
switch (type) {
|
|
62
|
-
case 'stem':
|
|
63
|
-
params = {
|
|
64
|
-
stem_voiceRecord: 'recording',
|
|
65
|
-
stem_video: 'video',
|
|
66
|
-
stem_audio: 'audio',
|
|
67
|
-
stem_document: 'file'
|
|
68
|
-
}
|
|
69
|
-
break
|
|
70
|
-
case 'answer':
|
|
71
|
-
params = {
|
|
72
|
-
answer_voiceRecord: 'recording',
|
|
73
|
-
answer_video: 'video',
|
|
74
|
-
answer_audio: 'audio',
|
|
75
|
-
answer_document: 'file'
|
|
76
|
-
}
|
|
77
|
-
break
|
|
78
|
-
case 'option':
|
|
79
|
-
params = {
|
|
80
|
-
option_voiceRecord: 'recording',
|
|
81
|
-
option_video: 'video',
|
|
82
|
-
option_audio: 'audio',
|
|
83
|
-
option_document: 'file'
|
|
84
|
-
}
|
|
85
|
-
break
|
|
86
|
-
case 'analysis':
|
|
87
|
-
params = {
|
|
88
|
-
description_voiceRecord: 'recording',
|
|
89
|
-
description_video: 'video',
|
|
90
|
-
description_audio: 'audio',
|
|
91
|
-
description_document: 'file'
|
|
92
|
-
}
|
|
93
|
-
break
|
|
94
|
-
}
|
|
95
|
-
const fileType = params[data.type]
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
...data,
|
|
99
|
-
fileType
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return false
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export const itemDataLists = () => {
|
|
106
|
-
return [
|
|
107
|
-
{
|
|
108
|
-
optionName: 'A',
|
|
109
|
-
content: '',
|
|
110
|
-
optionAttrs: [],
|
|
111
|
-
score: ''
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
optionName: 'B',
|
|
115
|
-
content: '',
|
|
116
|
-
optionAttrs: [],
|
|
117
|
-
score: ''
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
optionName: 'C',
|
|
121
|
-
content: '',
|
|
122
|
-
optionAttrs: [],
|
|
123
|
-
score: ''
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
optionName: 'D',
|
|
127
|
-
content: '',
|
|
128
|
-
optionAttrs: [],
|
|
129
|
-
score: ''
|
|
130
|
-
}
|
|
131
|
-
]
|
|
132
|
-
}
|