@94ai/nf-microphone 3.3.36 → 3.3.38

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.
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="nf-microphone"></div>
2
+ <div class="nf-microphone" ref="nfMicrophone"></div>
3
3
  </template>
4
4
 
5
5
  <script lang="ts">
@@ -11,20 +11,852 @@ export default defineComponent({
11
11
  </script>
12
12
 
13
13
  <script lang="ts" setup>
14
- const props = defineProps<{
15
- 'nf-microphone': string;
16
- }>()
14
+ import {
15
+ onMounted,
16
+ ref
17
+ } from 'vue-demi'
18
+ import {
19
+ registerMicroApps,
20
+ loadMicroApp,
21
+ start,
22
+ addGlobalUncaughtErrorHandler,
23
+ initGlobalState
24
+ } from 'qiankun'
25
+ // 注册子应用信息
26
+ import { bus, setupApp, startApp } from 'wujie'
27
+ import { isDomainOrIP } from './util'
28
+ import { Env } from './types'
29
+ import { onUnmounted } from 'vue'
30
+ import CryptoJS from 'crypto-js'
31
+ // @ts-ignore
32
+ window.CryptoJS = CryptoJS
33
+
34
+ const props = withDefaults(defineProps<{
35
+ mode?: 'qiankun' | 'wujie'
36
+
37
+ envMap?: Partial<Record<Env, Record<string, any>>>,
38
+ env?: Env,
39
+
40
+ agentId?: string,
41
+ agentTag?: string,
42
+ appKey?: string,
43
+ appSecret?: string,
44
+ extStatus?: string,
45
+
46
+ origin?: string,
47
+ ancestorOrigin?: string,
48
+ destinationOrigin?: string,
49
+
50
+ callShow?: '0' | '1',
51
+ transferToLaborShow?: '0' | '1',
52
+ restShow?: '0' | '1',
53
+ networkDetectShow?: '0' | '1',
54
+ muteShow?: '0' | '1',
55
+ logShow?: '0' | '1',
56
+ timingShow?: '0' | '1',
57
+ signShow?: '0' | '1',
58
+
59
+ lang?: 'zh' | 'en',
60
+
61
+ name?: string,
62
+
63
+ extensionInfo?: {
64
+ /** 软电话状态 { status: 0 | 1 } 0 未签入 1 已签入 */
65
+ status: 0 | 1
66
+ /** socket地址 */
67
+ wsRegisterAddress?: string,
68
+ /** socket协议 */
69
+ wsProtocol?: string,
70
+ /** 分机号 */
71
+ accountCode?: string
72
+ },
73
+
74
+ blackList?: string[],
75
+
76
+ extPassword?: string,
77
+ extensionNumber?: string,
78
+ wsRegisterAddress?: string,
79
+ wsProtocol?: string,
80
+
81
+ isOem?: boolean,
82
+ numberKeyBoard?: boolean,
83
+
84
+ accessMode?: 'mobile' | 'pc',
85
+ sipHeaders?: string[],
86
+ sgGateway?: string,
87
+ open?: string,
88
+
89
+ sgOpen?: string,
90
+ sgDomain?: string,
91
+ sgBase?: string,
92
+
93
+ token?: string,
94
+ timeZone?: string,
95
+
96
+ getOfflineInfo?: Function
97
+ changeALittleRest?: Function
98
+ quickCallWin?: Function
99
+
100
+ /** 校验号码正则 */
101
+ phoneRegex?: string
102
+ /** 坐席账号 */
103
+ account?: string,
104
+ /** 分机号 */
105
+ extAccount?: string,
106
+ /** socketHost地址 */
107
+ socketHost?: string,
108
+ /** 坐席id */
109
+ sid?: number,
110
+ /** 唯一id */
111
+ uid?: number,
112
+ /** 用户id */
113
+ newUserId?: number,
114
+ /** 公司id */
115
+ companyId?: number,
116
+ /** 公司名 */
117
+ company?: string
118
+ /** 国家id */
119
+ countryId?: number,
120
+ /** 国家名 */
121
+ countryName?: string,
122
+ /** 用户类型, 2是企业主账号、3是员工子账号、4是坐席账号 */
123
+ authUserType?: 4 | 3 | 2 | 1
124
+ /** 用户类型,1是超级管理员,2是企业用户,3普通用户,4坐席用户 */
125
+ userType?: 4 | 3 | 2 | 1
126
+ /** 语音文件前缀 */
127
+ recordPath?: string,
128
+ /** constMap */
129
+ constMap?: Record<string, any>,
130
+ }>(),
131
+ {
132
+ mode: 'qiankun',
133
+
134
+ envMap: () => ({
135
+ dev: {
136
+ // host: 'http://softphone.dev.k8s.com',
137
+ // port: '80',
138
+ // base: '/'
139
+ host: '//192.168.1.240',
140
+ port: '5173',
141
+ base: '/softphone'
142
+ },
143
+ test: {
144
+ // host: '//192.168.1.240',
145
+ // port: '5173',
146
+ // base: '/softphone'
147
+ host: 'http://softphone.test.k8s.com',
148
+ port: '80',
149
+ base: '/'
150
+ },
151
+ sg: {
152
+ host: 'https://seatsg.94ai.com',
153
+ port: '',
154
+ base: '/'
155
+ },
156
+ gray: {
157
+ // host: '//192.168.1.240',
158
+ // port: '5173',
159
+ // base: '/softphone'
160
+ host: 'http://softphone.gray.94ai.com',
161
+ port: 80,
162
+ base: '/'
163
+ },
164
+ prod: {
165
+ // host: '//192.168.1.240',
166
+ // port: '5173',
167
+ // base: '/softphone'
168
+ host: 'https://seat.94ai.com',
169
+ port: 80,
170
+ base: '/'
171
+ },
172
+ }),
173
+ env: 'test',
174
+ extStatus: '1',
175
+
176
+ origin: 'ai-softphone',
177
+ ancestorOrigin: 'nf-softphone',
178
+ destinationOrigin: '*',
179
+
180
+ callShow: '1',
181
+ transferToLaborShow: '1',
182
+ restShow: '1',
183
+ networkDetectShow: '1',
184
+ muteShow: '1',
185
+ logShow: '1',
186
+ timingShow: '1',
187
+ signShow: '1',
188
+ lang: 'zh',
189
+ name: 'nf-microphone',
190
+ blackList: () => ['#/login'],
191
+ isOem: true,
192
+ accessMode: 'pc',
193
+ numberKeyBoard: true,
194
+ sgOpen: '1',
195
+ open: '1',
196
+ })
197
+
17
198
  const emit = defineEmits<{
18
- (e: 'click', event: Event): void
199
+ (e: 'softphone-connect', event: any): void
200
+ (e: 'softphone-seats-status-change', event: any): void
201
+ (e: 'softphone-accept', event: any): void
202
+ (e: 'softphone-ignore', event: any): void
203
+ (e: 'softphone-hangup', event: any): void
204
+ (e: 'softphone-send-dtmf', event: any): void
205
+ (e: 'softphone-call-refresh', event: any): void
206
+ (e: 'softphone-session-state-change', event: any): void
207
+ (e: 'softphone-incoming', event: any): void
208
+ (e: 'softphone-connect-registered', event: any): void
19
209
  }>()
20
- const emitClick = (e: Event) => {
21
- e.stopPropagation()
22
- emit('click', e)
210
+
211
+ const showSoftPhone = ref(true)
212
+ const nfMicrophone = ref()
213
+
214
+ // 数据总线
215
+ class Shared {
216
+ key
217
+
218
+ constructor(key) {
219
+ this.key = key
220
+ }
221
+
222
+ /**
223
+ * 获取 UserInfo
224
+ */
225
+ getUserInfo() {
226
+ return {}
227
+ }
228
+
229
+ setUserInfo(data) {
230
+ }
231
+
232
+ /**
233
+ * 获取分机信息
234
+ */
235
+ getExtensionInfo() {
236
+ return props.extensionInfo || {}
237
+ }
238
+
239
+ /**
240
+ * 获取 Gateway
241
+ */
242
+ getGateway() {
243
+ if (props.sgGateway) {
244
+ if (isDomainOrIP(props.sgGateway)) {
245
+ return props.sgGateway
246
+ }
247
+ if (props.sgGateway === '1') {
248
+ return 'https://gateway.sg.94ai.com'
249
+ } else if (props.sgGateway === '0') {
250
+ return 'https://gateway.94ai.pro'
251
+ }
252
+ }
253
+ return 'https://gateway.94ai.pro'
254
+ }
255
+
256
+ getOpenApi () {
257
+ const {
258
+ sgOpen,
259
+ sgDomain
260
+ } = props
261
+ if (sgOpen) {
262
+ if (isDomainOrIP(sgOpen)) {
263
+ return sgOpen
264
+ }
265
+ if (sgOpen === '1') {
266
+ if (sgDomain === '1') {
267
+ return 'https://seatsg.94ai.com/sgopenapi'
268
+ } else {
269
+ return 'https://seatsg.94ai.com/openapi'
270
+ }
271
+ } else if (sgOpen === '0') {
272
+ if (sgDomain === '1') {
273
+ return 'https://seat.94ai.com/sgopenapi'
274
+ } else {
275
+ return 'https://seat.94ai.com/openapi'
276
+ }
277
+ }
278
+ }
279
+ return 'https://seat.94ai.com/openapi'
280
+ }
281
+
282
+ getBase () {
283
+ const {
284
+ sgBase
285
+ } = props
286
+ if (sgBase) {
287
+ if (isDomainOrIP(sgBase)) {
288
+ return sgBase
289
+ }
290
+ if (sgBase === '1') {
291
+ return 'https://seatsg.94ai.com/api'
292
+ } else if (sgBase === '0') {
293
+ return 'https://seat.94ai.com/api'
294
+ }
295
+ }
296
+ return undefined
297
+ }
298
+
299
+ getIsOem () {
300
+ return props.isOem
301
+ }
302
+
303
+ getSoftPhoneShowCall () {
304
+ return props.callShow
305
+ }
306
+
307
+ getSoftPhoneShowTransferToLabor () {
308
+ return props.transferToLaborShow
309
+ }
310
+
311
+ getSoftPhoneShowRest () {
312
+ return props.restShow
313
+ }
314
+
315
+ getSoftPhoneShowNetworkDetect () {
316
+ return props.networkDetectShow
317
+ }
318
+
319
+ getSoftPhoneShowMute () {
320
+ return props.muteShow
321
+ }
322
+
323
+ /**
324
+ * 是否展示对话记录功能
325
+ */
326
+ getSoftPhoneShowLog() {
327
+ return props.logShow
328
+ }
329
+
330
+ getSoftPhoneShowTiming () {
331
+ return props.timingShow
332
+ }
333
+
334
+ getSoftPhoneShowSign () {
335
+ return props.signShow
336
+ }
337
+
338
+ /**
339
+ * 使用按键拨号
340
+ */
341
+ getNumberKeyBoard (): any {
342
+ return props.numberKeyBoard
343
+ }
344
+
345
+ /**
346
+ * sip扩展头
347
+ */
348
+ getSipHeaders (): any {
349
+ // return ['sip-xx-headers1: 1', 'sip-xx-headers2: 2']
350
+ return props.sipHeaders
351
+ }
352
+
353
+ /**
354
+ * 启动移动端模式
355
+ */
356
+ getIsMobile (): any {
357
+ return props.accessMode === 'mobile'
358
+ }
359
+
360
+ /**
361
+ * 设置语言
362
+ */
363
+
364
+ getLanguage() {
365
+ return props.lang
366
+ }
367
+
368
+ setLanguage(language) {
369
+ //
370
+ }
371
+
372
+ getApplicationCode() {
373
+ return 3
374
+ }
23
375
  }
24
- </script>
25
- <style lang="scss" scoped>
26
- .nf-microphone {
27
- background-color: red;
28
- height: 300px;
376
+
377
+ // 通知
378
+ class SoftphoneNotity {
379
+ communicationList = {
380
+ 'softphone-connect-registered': (data) => {
381
+ emit('softphone-connect-registered', data)
382
+ },
383
+ 'softphone-session-state-change': (data) => {
384
+ emit('softphone-session-state-change', data)
385
+ },
386
+ 'softphone-call-refresh': (data) => {
387
+ emit('softphone-call-refresh', data)
388
+ },
389
+ 'softphone-connect': (data) => {
390
+ emit('softphone-connect', data)
391
+ },
392
+ 'softphone-accept': (data) => {
393
+ emit('softphone-accept', data)
394
+ },
395
+ 'softphone-seats-status-change': (data) => {
396
+ emit('softphone-seats-status-change', data)
397
+ },
398
+ 'softphone-ignore': (data) => {
399
+ emit('softphone-ignore', data)
400
+ },
401
+ 'softphone-hangup': (data) => {
402
+ emit('softphone-hangup', data)
403
+ },
404
+ 'softphone-incoming': (data) => {
405
+ emit( 'softphone-incoming', data)
406
+ },
407
+ 'softphone-send-dtmf': (data) => {
408
+ emit('softphone-send-dtmf', data)
409
+ },
410
+ }
411
+ useQinkunSoftphoneNotity = (state) => {
412
+ if ((state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin) ||
413
+ (state.ancestorOrigin === props.origin && state.origin === props.origin)) {
414
+ if (state.destinationOrigin === '*' || state.destinationOrigin === props.destinationOrigin) {
415
+ this.communicationList[state.type]?.(state.data)
416
+ }
417
+ }
418
+ }
419
+ useWujieSoftphoneNotity() {
420
+ Object.keys(this.communicationList).forEach(key => {
421
+ bus.$on(key, (state) => {
422
+ if ((state.ancestorOrigin === props.ancestorOrigin && state.origin !== props.ancestorOrigin) ||
423
+ (state.ancestorOrigin === props.origin && state.origin === props.origin)) {
424
+ if (state.destinationOrigin === '*' || state.destinationOrigin === props.destinationOrigin) {
425
+ this.communicationList[key]?.(state.data)
426
+ }
427
+ }
428
+ })
429
+ })
430
+ }
431
+ }
432
+
433
+ // 实例+动作管理
434
+ class MicroManager {
435
+ app
436
+ mode = props.mode
437
+
438
+ #qiankunActions
439
+
440
+ getQiankunActions() {
441
+ return this.#qiankunActions
442
+ }
443
+
444
+ getWejieActions() {
445
+ return bus
446
+ }
447
+
448
+ microCommunicat(type: string, status?: boolean) {
449
+ const state = {
450
+ origin: 'nf-softphone',
451
+ ancestorOrigin: props.ancestorOrigin,
452
+ destinationOrigin: props.destinationOrigin,
453
+ type,
454
+ data: {
455
+ status,
456
+ type: 'manual'
457
+ }
458
+ }
459
+ if (this.mode === 'qiankun') {
460
+ this.getQiankunActions().setGlobalState(state)
461
+ } else if (this.mode === 'wujie') {
462
+ this.getWejieActions().$emit('ai-softphone', state)
463
+ }
464
+ }
465
+
466
+
467
+ // 签入
468
+ connect() {
469
+ this.microCommunicat('softphone-connect', true)
470
+ }
471
+
472
+ disconnect() {
473
+ this.microCommunicat('softphone-connect', false)
474
+ }
475
+
476
+ seatsStatusChange(status: boolean) {
477
+ this.microCommunicat('softphone-connect', status)
478
+ }
479
+ accept() {
480
+ this.microCommunicat('softphone-connect')
481
+ }
482
+ ignore() {
483
+ this.microCommunicat('softphone-hangup')
484
+ }
485
+ hangup() {
486
+ this.microCommunicat('softphone-hangup')
487
+ }
488
+ sendDtmf() {
489
+ this.microCommunicat('softphone-send-dtmf')
490
+ }
491
+
492
+ changeServerToRegister() {
493
+ this.microCommunicat('softphone-change-server-to-register')
494
+ }
495
+
496
+ getMicroAppConfig() {
497
+ const config: Record<string, any> = [];
498
+ const shared: any = new Shared('default')
499
+ if (props.getOfflineInfo) {
500
+ shared.getOfflineInfo = async (data) => {
501
+ return await props.getOfflineInfo!(data)
502
+ }
503
+ }
504
+ if (props.changeALittleRest) {
505
+ shared.changeALittleRest = async (data) => {
506
+ return await props.changeALittleRest!(data)
507
+ }
508
+ }
509
+ if (props.quickCallWin) {
510
+ shared.quickCallWin = async (data) => {
511
+ return await props.quickCallWin!(data)
512
+ }
513
+ }
514
+ (Object.keys(props.envMap).reduce((res, currentValue) => {
515
+ res[currentValue] = [{
516
+ name: props.name,
517
+ host: props.envMap[currentValue].host,
518
+ port: props.envMap[currentValue].port,
519
+ base: props.envMap[currentValue].base,
520
+ container: nfMicrophone.value,
521
+ activeRule: (location) => {
522
+ if (!showSoftPhone.value) {
523
+ return false
524
+ }
525
+ if (props.blackList.includes(location.hash)) {
526
+ return false
527
+ }
528
+ return true
529
+ },
530
+ props: {
531
+ name: props.name
532
+ }
533
+ }]
534
+ return res
535
+ }, {})[props.env] || []).forEach(item => {
536
+ config.push({
537
+ name: item.name,
538
+ entry: `${item.host}${(item.port ? `:${item.port}` : '') + item.base}?name=${item.name}`,
539
+ container: item.container,
540
+ activeRule: item.activeRule,
541
+ props: { ...item.props, shared }
542
+ })
543
+ })
544
+ return config
545
+ }
546
+
547
+ initState() {
548
+ this.#qiankunActions = initGlobalState({
549
+ type: 'qiankun-init',
550
+ origin: props.origin,
551
+ ancestorOrigin: props.ancestorOrigin,
552
+ destinationOrigin: props.destinationOrigin,
553
+ data: null
554
+ })
555
+ this.#qiankunActions.onGlobalStateChange((state, prev) => {
556
+ // state: 变更后的状态; prev 变更前的状态
557
+ (new SoftphoneNotity()).useQinkunSoftphoneNotity(state)
558
+ })
559
+ addGlobalUncaughtErrorHandler((event: any) => {
560
+ if (event.type === 'error' && event.error?.message === "application 'softPhone' died in status LOADING_SOURCE_CODE: Failed to fetch") {
561
+ showSoftPhone.value = false
562
+ }
563
+ console.error(event)
564
+ })
565
+ }
566
+
567
+ /**
568
+ * 手动加载子应用
569
+ */
570
+ loadQiankunMicroApps() {
571
+ const appConfig = this.getMicroAppConfig()[0]
572
+ appConfig.props.shared.getUserInfo = getUserInfo
573
+ appConfig.props.shared.setUserInfo = () => {}
574
+ this.initState()
575
+ this.app = loadMicroApp(appConfig, {
576
+ sandbox: {
577
+ experimentalStyleIsolation: true
578
+ }
579
+ })
580
+ }
581
+
582
+ /**
583
+ * 卸载子应用
584
+ */
585
+ unmountQiankunMicroApps() {
586
+ try {
587
+ this.app?.unmount()
588
+ this.#qiankunActions?.offGlobalStateChange()
589
+ } catch (e) {
590
+ //
591
+ } finally {
592
+ this.app = null
593
+ }
594
+ }
595
+
596
+
597
+ registerWujieMicroApps() {
598
+ const appConfig = this.getMicroAppConfig()[0]
599
+ const url = appConfig.entry
600
+ appConfig.props.shared.getUserInfo = getUserInfo
601
+ appConfig.props.shared.setUserInfo = () => {}
602
+
603
+ setupApp({
604
+ name: props.name,
605
+ plugins: [
606
+ {
607
+ cssBeforeLoaders: [{ src: `${url}/index.css` }],
608
+ },
609
+ ],
610
+ url,
611
+ exec: true,
612
+ props: {
613
+ shared: appConfig.props.shared
614
+ },
615
+ fetch(url, options) {
616
+ return window.fetch(url, { ...options, credentials: 'omit' })
617
+ },
618
+ degrade: !window.Proxy || !window.CustomElementRegistry,
619
+ // @ts-ignore
620
+ beforeLoad: (appWindow) => console.log(`${appWindow.__WUJIE.id} beforeLoad 生命周期`),
621
+ // @ts-ignore
622
+ beforeMount: (appWindow) => console.log(`${appWindow.__WUJIE.id} beforeMount 生命周期`),
623
+ // @ts-ignore
624
+ afterMount: (appWindow) => console.log(`${appWindow.__WUJIE.id} afterMount 生命周期`),
625
+ // @ts-ignore
626
+ beforeUnmount: (appWindow) => console.log(`${appWindow.__WUJIE.id} beforeUnmount 生命周期`),
627
+ // @ts-ignore
628
+ afterUnmount: (appWindow) => console.log(`${appWindow.__WUJIE.id} afterUnmount 生命周期`),
629
+ // @ts-ignore
630
+ activated: (appWindow) => console.log(`${appWindow.__WUJIE.id} activated 生命周期`),
631
+ // @ts-ignore
632
+ deactivated: (appWindow) => console.log(`${appWindow.__WUJIE.id} deactivated 生命周期`),
633
+ // loadError: (url, e) => console.log(`${url} 加载失败`, e),
634
+ });
635
+ (new SoftphoneNotity()).useWujieSoftphoneNotity()
636
+ }
637
+
638
+ registerQiankunMicroApps() {
639
+ const appConfig = this.getMicroAppConfig()[0]
640
+ appConfig.props.shared.getUserInfo = getUserInfo
641
+ appConfig.props.shared.setUserInfo = () => {}
642
+
643
+ registerMicroApps([appConfig], {
644
+ // qiankun 生命周期钩子 - 加载前
645
+ beforeLoad: [(app) => {
646
+ // 加载子应用前,加载进度条
647
+ // NProgress.start()
648
+ return Promise.resolve()
649
+ }],
650
+ // qiankun 生命周期钩子 - 挂载后
651
+ afterMount: [(app) => {
652
+ // 加载子应用前,进度条加载完成
653
+ // NProgress.done()
654
+ return Promise.resolve()
655
+ }],
656
+ // qiankun 生命周期钩子 - 卸载后
657
+ afterUnmount: [app => {
658
+ return Promise.resolve()
659
+ }]
660
+ })
661
+ this.initState()
662
+ }
663
+
664
+ startQiankun() {
665
+ this.registerQiankunMicroApps()
666
+ start({
667
+ singular: false,
668
+ prefetch: 'all',
669
+ sandbox: {
670
+ experimentalStyleIsolation: true
671
+ }
672
+ })
673
+ }
674
+
675
+ startWujie() {
676
+ this.registerWujieMicroApps()
677
+ // @ts-ignore
678
+ startApp({
679
+ name: props.name,
680
+ el: nfMicrophone.value,
681
+ })
682
+ }
683
+
684
+ startMicrotask() {
685
+ if (this.mode === 'wujie') {
686
+ this.startWujie()
687
+ } else {
688
+ this.startQiankun()
689
+ }
690
+ }
29
691
  }
30
- </style>
692
+ const nfMicrophoneInstance = new MicroManager()
693
+
694
+ const getUserInfo = () => {
695
+ const {
696
+ agentId,
697
+ agentTag,
698
+ appKey,
699
+ appSecret,
700
+ extStatus,
701
+ origin,
702
+ ancestorOrigin,
703
+ destinationOrigin,
704
+ callShow,
705
+ transferToLaborShow,
706
+ restShow,
707
+ networkDetectShow,
708
+ muteShow,
709
+ logShow,
710
+ timingShow,
711
+ signShow,
712
+ lang,
713
+ name,
714
+ extensionInfo,
715
+ blackList,
716
+ extPassword,
717
+ extensionNumber,
718
+ wsRegisterAddress,
719
+ wsProtocol,
720
+ isOem,
721
+ numberKeyBoard,
722
+ accessMode,
723
+ sipHeaders,
724
+ sgGateway,
725
+ open,
726
+ sgOpen,
727
+ sgDomain,
728
+ sgBase,
729
+ token,
730
+ timeZone,
731
+ getOfflineInfo,
732
+ changeALittleRest,
733
+ quickCallWin,
734
+ phoneRegex,
735
+ account,
736
+ extAccount,
737
+ socketHost,
738
+ sid,
739
+ uid,
740
+ newUserId,
741
+ companyId,
742
+ company,
743
+ countryId,
744
+ countryName,
745
+ authUserType,
746
+ userType,
747
+ recordPath,
748
+ constMap,
749
+ } = props
750
+
751
+ return {
752
+ agentId,
753
+ agentTag,
754
+ appKey,
755
+ appSecret,
756
+ extStatus,
757
+ origin,
758
+ ancestorOrigin,
759
+ destinationOrigin,
760
+ callShow,
761
+ transferToLaborShow,
762
+ restShow,
763
+ networkDetectShow,
764
+ muteShow,
765
+ logShow,
766
+ timingShow,
767
+ signShow,
768
+ lang,
769
+ name,
770
+ extensionInfo,
771
+ blackList,
772
+ extPassword,
773
+ extensionNumber,
774
+ wsRegisterAddress,
775
+ wsProtocol,
776
+ isOem,
777
+ numberKeyBoard,
778
+ accessMode,
779
+ sipHeaders,
780
+ sgGateway,
781
+ open,
782
+ sgOpen,
783
+ sgDomain,
784
+ sgBase,
785
+ token,
786
+ timeZone,
787
+ getOfflineInfo,
788
+ changeALittleRest,
789
+ quickCallWin,
790
+ phoneRegex,
791
+ account,
792
+ extAccount,
793
+ socketHost,
794
+ sid,
795
+ uid,
796
+ newUserId,
797
+ companyId,
798
+ company,
799
+ countryId,
800
+ countryName,
801
+ authUserType,
802
+ userType,
803
+ recordPath,
804
+ constMap,
805
+ seats: true
806
+ }
807
+ }
808
+
809
+ onMounted(() => {
810
+ // 注册软电话微应用
811
+ if (props.mode === 'qiankun') {
812
+ nfMicrophoneInstance.loadQiankunMicroApps()
813
+ } else {
814
+ nfMicrophoneInstance.startWujie()
815
+ }
816
+ })
817
+
818
+ onUnmounted(() => {
819
+ nfMicrophoneInstance.unmountQiankunMicroApps()
820
+ })
821
+
822
+ const connect = () => {
823
+ nfMicrophoneInstance.connect()
824
+ }
825
+
826
+ const disconnect = () => {
827
+ nfMicrophoneInstance.disconnect()
828
+ }
829
+
830
+ const seatsStatusChange = (status: boolean) => {
831
+ nfMicrophoneInstance.seatsStatusChange(status)
832
+ }
833
+
834
+ const accept = () => {
835
+ nfMicrophoneInstance.accept()
836
+ }
837
+ const ignore = () => {
838
+ nfMicrophoneInstance.ignore()
839
+ }
840
+ const hangup = () => {
841
+ nfMicrophoneInstance.hangup()
842
+ }
843
+ const sendDtmf = () => {
844
+ nfMicrophoneInstance.sendDtmf()
845
+ }
846
+
847
+ const changeServerToRegister = () => {
848
+ nfMicrophoneInstance.changeServerToRegister()
849
+ }
850
+
851
+ defineExpose({
852
+ connect,
853
+ disconnect,
854
+ seatsStatusChange,
855
+ accept,
856
+ ignore,
857
+ hangup,
858
+ sendDtmf,
859
+ changeServerToRegister,
860
+ })
861
+
862
+ </script>