zydx-plus 1.32.259 → 1.32.260
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
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
<button v-if="item.key === 'but'" class="buts" @click="item.onClick(item,info)"
|
|
8
8
|
:style="{color: (item.active)? '#00ff00' :'#000'}">{{ item.title }}
|
|
9
9
|
</button>
|
|
10
|
+
<button v-if="item.key === 'speech'" class="buts" @mousedown.stop="speechDown" @click="item.onClick(item)"
|
|
11
|
+
:style="{color: (item.active)? '#00ff00' :'#000'}">{{ voiceStatus ? '关闭语音' : '语音输入' }}
|
|
12
|
+
</button>
|
|
10
13
|
<label v-else-if="item.key === 'upImg' || item.key === 'uploadAtt'">
|
|
11
14
|
<input type="file" @change="upload($event,item.key)"
|
|
12
15
|
:accept="(item.key === 'upImg')?'image/*':'.docx,.pptx,.pdf,.xlsx,.mp3,.mp4'" style="display: none;">
|
|
@@ -14,23 +17,21 @@
|
|
|
14
17
|
</label>
|
|
15
18
|
<button v-else class="buts" @click="toolTap(item.key)">{{ item.title }}</button>
|
|
16
19
|
</div>
|
|
17
|
-
<div class="voice">
|
|
18
|
-
<button class="buts" @click="voice" :style="{color: (voiceStatus)? '#00ff00' :'#000'}">
|
|
19
|
-
{{ voiceStatus ? '关闭语音' : '语音输入' }}
|
|
20
|
-
</button>
|
|
21
|
-
</div>
|
|
22
20
|
</div>
|
|
23
21
|
</div>
|
|
24
22
|
<div class="ed-cont" :style="heightStyleCont">
|
|
25
|
-
<div
|
|
23
|
+
<div :style="{'border': (borderShow)? '1px solid #ccc': '0'}" v-if="editorShow">
|
|
26
24
|
<editor-content @paste.native.capture.prevent="preventPaste" ref="editorRef" class="editor" :editor="editor"
|
|
27
25
|
:style="heightStyleCont"/>
|
|
28
26
|
</div>
|
|
29
|
-
<div v-if="voiceStatus" class="speak"
|
|
27
|
+
<div v-if="voiceStatus" class="speak"
|
|
28
|
+
@mousedown.stop="mousedown"
|
|
29
|
+
@mouseup.stop="mouseup"
|
|
30
|
+
:style="{transform: `translate(${x}px, ${y}px)`}">
|
|
30
31
|
<div class="speak-cont">
|
|
31
32
|
<svg t="1698630789078" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4553" width="15" height="15"><path d="M533.84533333 930.88426667c-13.65333333 0-24.576-10.92266667-24.576-24.576v-122.33386667c0-13.65333333 10.92266667-24.576 24.576-24.576s24.576 10.92266667 24.576 24.576v122.33386667c-0.54613333 13.65333333-11.4688 24.576-24.576 24.576zM533.84533333 686.21653333c-101.03466667 0-183.5008-82.46613333-183.5008-183.5008V258.048c0-101.03466667 82.46613333-183.5008 183.5008-183.5008s183.5008 82.46613333 183.5008 183.5008v244.66773333c0 101.03466667-82.46613333 183.5008-183.5008 183.5008z m0-563.06346666c-74.27413333 0-134.89493333 60.6208-134.89493333 134.89493333v244.66773333c0 74.27413333 60.6208 134.89493333 134.89493333 134.89493334s134.89493333-60.6208 134.89493334-134.89493334V258.048c-0.54613333-74.27413333-60.6208-134.89493333-134.89493334-134.89493333z" fill="#fff" p-id="4554"></path><path d="M533.84533333 808.5504c-168.7552 0-305.83466667-137.07946667-305.83466666-305.83466667 0-13.65333333 10.92266667-24.576 24.576-24.576s24.576 10.92266667 24.576 24.576c0 141.99466667 115.23413333 257.2288 257.2288 257.2288S790.528 644.7104 790.528 502.71573333c0-13.65333333 10.92266667-24.576 24.576-24.576s24.576 10.92266667 24.576 24.576c0 168.7552-137.07946667 305.83466667-305.83466667 305.83466667zM729.36106667 955.46026667H337.78346667c-13.65333333 0-24.576-10.92266667-24.576-24.576s10.92266667-24.576 24.576-24.576h391.5776c13.65333333 0 24.576 10.92266667 24.576 24.576s-10.92266667 24.576-24.576 24.576z" fill="#FFF" p-id="4555"></path></svg>
|
|
32
33
|
<svgs :vol="vol"></svgs>
|
|
33
|
-
<span>{{ error? '
|
|
34
|
+
<span>{{ error? '连接中...' : '正在说话...' }}</span>
|
|
34
35
|
<svg style="cursor: pointer" @click="close" t="1698630749910" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4415" width="20" height="20"><path d="M726.976 274.432a16 16 0 0 0-22.656 0L512 466.752l-192.32-192.32a16 16 0 0 0-22.624 0l-22.656 22.624a16 16 0 0 0 0 22.624l192.32 192.32-192.32 192.32a16 16 0 0 0 0 22.656l22.656 22.624a16 16 0 0 0 22.624 0l192.32-192.32 192.32 192.32a16 16 0 0 0 22.656 0l22.624-22.624a16 16 0 0 0 0-22.624L557.28 512l192.32-192.352a16 16 0 0 0 0-22.624l-22.624-22.624z" fill="#fff" p-id="4416"></path></svg>
|
|
35
36
|
</div>
|
|
36
37
|
</div>
|
|
@@ -128,7 +129,14 @@ export default {
|
|
|
128
129
|
vol: 0,
|
|
129
130
|
appData: {},
|
|
130
131
|
error: false,
|
|
131
|
-
time: {}
|
|
132
|
+
time: {},
|
|
133
|
+
toolbars: [],
|
|
134
|
+
left: 0,
|
|
135
|
+
top: 0,
|
|
136
|
+
isMove: false,
|
|
137
|
+
x: 0,
|
|
138
|
+
y: 0,
|
|
139
|
+
speech: {}
|
|
132
140
|
}
|
|
133
141
|
},
|
|
134
142
|
beforeUnmount() {
|
|
@@ -136,6 +144,7 @@ export default {
|
|
|
136
144
|
this.recorder?.destroy()
|
|
137
145
|
this.ws?.send(JSON.stringify({"type":"CANCEL"}))
|
|
138
146
|
this.ws?.close()
|
|
147
|
+
this.ws = null
|
|
139
148
|
},
|
|
140
149
|
props: {
|
|
141
150
|
data: {
|
|
@@ -245,6 +254,22 @@ export default {
|
|
|
245
254
|
})
|
|
246
255
|
},
|
|
247
256
|
deep: true
|
|
257
|
+
},
|
|
258
|
+
toolbar: {
|
|
259
|
+
handler: function (e, oldVal) {
|
|
260
|
+
e.map(x => {
|
|
261
|
+
if (x.key === 'speech') {
|
|
262
|
+
this.voiceStatus = x.active
|
|
263
|
+
if(this.voiceStatus) {
|
|
264
|
+
this.voice()
|
|
265
|
+
}else {
|
|
266
|
+
this.close()
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return x
|
|
270
|
+
})
|
|
271
|
+
},
|
|
272
|
+
deep: true
|
|
248
273
|
}
|
|
249
274
|
},
|
|
250
275
|
mounted() {
|
|
@@ -297,7 +322,6 @@ export default {
|
|
|
297
322
|
}
|
|
298
323
|
}
|
|
299
324
|
})
|
|
300
|
-
_this.appID()
|
|
301
325
|
// 初始化录音
|
|
302
326
|
this.recorder = new Recorder({
|
|
303
327
|
sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
|
|
@@ -307,8 +331,29 @@ export default {
|
|
|
307
331
|
this.recorder.onprogress = function (params) {
|
|
308
332
|
_this.vol = params.vol
|
|
309
333
|
}
|
|
334
|
+
document.addEventListener('mousemove', (event) => {
|
|
335
|
+
if (!this.isMove) return
|
|
336
|
+
this.x = event.clientX - this.left;
|
|
337
|
+
this.y = event.clientY - this.top;
|
|
338
|
+
})
|
|
310
339
|
},
|
|
311
340
|
methods: {
|
|
341
|
+
speechDown(e) {
|
|
342
|
+
this.speech = {
|
|
343
|
+
x: e.clientX - e.offsetX,
|
|
344
|
+
y: e.clientY - e.offsetY,
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
mousedown(event) {
|
|
348
|
+
event.preventDefault()
|
|
349
|
+
//鼠标按下事件
|
|
350
|
+
this.left = event.offsetX;
|
|
351
|
+
this.top = event.offsetY;
|
|
352
|
+
this.isMove = true
|
|
353
|
+
},
|
|
354
|
+
mouseup() {
|
|
355
|
+
this.isMove = false
|
|
356
|
+
},
|
|
312
357
|
// 粘贴文本处理
|
|
313
358
|
preventPaste(event) {
|
|
314
359
|
const text = event.clipboardData.getData('text/plain');
|
|
@@ -363,35 +408,40 @@ export default {
|
|
|
363
408
|
scriptProcessor.connect(that.recorder.context.destination);
|
|
364
409
|
},
|
|
365
410
|
voice() {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
this.
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}else {
|
|
380
|
-
that.close()
|
|
381
|
-
}
|
|
411
|
+
this.recorder.start().then(() => { // 开始录音
|
|
412
|
+
this.audioData = []
|
|
413
|
+
this.x = this.speech.x - 85
|
|
414
|
+
const h = this.height.split('px')[0]
|
|
415
|
+
this.y = this.speech.y + ((this.height === '100%') ? 40 : Number(h) - 10)
|
|
416
|
+
this.appID()
|
|
417
|
+
}, (error) => {
|
|
418
|
+
this.$message({
|
|
419
|
+
type: 'text',
|
|
420
|
+
cancelShow: false,
|
|
421
|
+
promptContent: '录音失败,请检查麦克风是否可用'
|
|
422
|
+
})
|
|
423
|
+
});
|
|
382
424
|
},
|
|
383
425
|
close() {
|
|
426
|
+
if(this.ws === null) return
|
|
427
|
+
this.toolbar.map(x => {
|
|
428
|
+
if (x.key === 'speech') {
|
|
429
|
+
x.active = false
|
|
430
|
+
}
|
|
431
|
+
return x
|
|
432
|
+
})
|
|
384
433
|
this.voiceStatus = false
|
|
385
|
-
this.ws
|
|
386
|
-
this.ws
|
|
434
|
+
this.ws?.send(JSON.stringify({"type":"CANCEL"}))
|
|
435
|
+
this.ws?.close()
|
|
436
|
+
this.ws = null
|
|
387
437
|
this.recorder.stop() // 停止录音
|
|
388
438
|
this.recorder.destroy()
|
|
389
439
|
},
|
|
390
440
|
webSocketInit() {
|
|
391
441
|
const _this = this
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
442
|
+
this.ws = new WebSocket(`wss://vop.baidu.com/realtime_asr?sn=${this.getRandomCode(15)}`)
|
|
443
|
+
this.ws.binaryType = 'arraybuffer'
|
|
444
|
+
this.ws.onopen = function () {
|
|
395
445
|
_this.error = false
|
|
396
446
|
const json = {
|
|
397
447
|
type: 'START',
|
|
@@ -407,7 +457,7 @@ export default {
|
|
|
407
457
|
_this.ws.send(JSON.stringify(json))
|
|
408
458
|
_this.getAudioSuccess()
|
|
409
459
|
}
|
|
410
|
-
|
|
460
|
+
this.ws.onmessage = function (e) {
|
|
411
461
|
const data = JSON.parse(e.data)
|
|
412
462
|
if(data.err_no === 0){
|
|
413
463
|
const json = _this.editor.getJSON()
|
|
@@ -422,10 +472,9 @@ export default {
|
|
|
422
472
|
_this.time = data
|
|
423
473
|
}
|
|
424
474
|
}
|
|
425
|
-
|
|
475
|
+
this.ws.onerror = function () {
|
|
426
476
|
// 连接失败重连
|
|
427
477
|
setTimeout(() => {
|
|
428
|
-
_this.error = true
|
|
429
478
|
_this.webSocketInit()
|
|
430
479
|
}, 5000)
|
|
431
480
|
}
|
|
@@ -439,14 +488,16 @@ export default {
|
|
|
439
488
|
token = sessionStorage.getItem('sessionId')
|
|
440
489
|
}
|
|
441
490
|
const xhr = new XMLHttpRequest()
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
xhr.open('GET', '/zydx/voice/getDesKeyId')
|
|
445
|
-
xhr.setRequestHeader('Authorization', token)
|
|
491
|
+
xhr.open('GET', 'http://192.168.15.124:8888/zydx/voice/getDesKeyId')
|
|
492
|
+
xhr.setRequestHeader('Authorization', 'dd9fabcd-ca68-4f1a-97f0-21a66628207d')
|
|
493
|
+
// xhr.open('GET', '/zydx/voice/getDesKeyId')
|
|
494
|
+
// xhr.setRequestHeader('Authorization', token)
|
|
495
|
+
this.error = true
|
|
446
496
|
xhr.onreadystatechange = () => {
|
|
447
497
|
if (xhr.readyState === 4) {
|
|
448
498
|
if (xhr.status === 200) {
|
|
449
499
|
this.appData = JSON.parse(xhr.responseText).data
|
|
500
|
+
this.webSocketInit()
|
|
450
501
|
}
|
|
451
502
|
}
|
|
452
503
|
}
|
|
@@ -657,8 +708,11 @@ export default {
|
|
|
657
708
|
|
|
658
709
|
<style scoped>
|
|
659
710
|
.speak{
|
|
660
|
-
|
|
661
|
-
|
|
711
|
+
position: fixed;
|
|
712
|
+
top: 0;
|
|
713
|
+
left: 0;
|
|
714
|
+
z-index: 50;
|
|
715
|
+
cursor: move;
|
|
662
716
|
}
|
|
663
717
|
.speak-cont{
|
|
664
718
|
background: rgba(67, 207, 124, 1);
|
|
@@ -812,6 +866,7 @@ export default {
|
|
|
812
866
|
.ed-cont {
|
|
813
867
|
padding-top: 4px;
|
|
814
868
|
margin-bottom: 14px;
|
|
869
|
+
position: relative;
|
|
815
870
|
}
|
|
816
871
|
|
|
817
872
|
.editor {
|
|
@@ -60,8 +60,10 @@
|
|
|
60
60
|
</div>
|
|
61
61
|
<div v-if="item.alist" class="subject-html" v-show="item.open">
|
|
62
62
|
<div v-for="(it,ind) in item.alist">
|
|
63
|
-
<div
|
|
64
|
-
|
|
63
|
+
<div v-if="it.annexType === '0'">
|
|
64
|
+
<div class="subject-html-title">{{ titleText }}{{ ind + 1 }}</div>
|
|
65
|
+
<div class="subject-html-cont" v-html="it.annexContent"></div>
|
|
66
|
+
</div>
|
|
65
67
|
</div>
|
|
66
68
|
</div>
|
|
67
69
|
<div class="choice" v-if="item.testKey" v-show="item.open">
|