1 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
2 import { NzMessageService } from 'ng-zorro-antd';
3 import { intentBaseService } from '../../../../core/services/intentBase.service';
4 import { Recorder } from '../../../../shared/utils/recorder';
5 import { Util } from '../../../../shared/utils/utils';
8 selector: 'app-smart-cloud-leased-modal',
9 templateUrl: './smart-cloud-leased-modal.component.html',
10 styleUrls: ['./smart-cloud-leased-modal.component.less']
12 export class SmartCloudLeasedModalComponent implements OnInit {
16 private Recorder: Recorder,
17 private myhttp: intentBaseService,
18 private msg: NzMessageService
21 @Input() samrtCloudLeasedLineShowFlag: boolean;
22 @Output() resolveEmitter = new EventEmitter();
24 communicationMessage: String = "";
25 validateRulesShow: any[] = [];
26 rulesText: any[] = [];
27 radioValue: String = 'text';
28 isPlay: boolean = false;
29 clickRepeat: boolean = false;
30 isDisable: boolean = true;
33 this.validateRulesShow = [];
35 this.communicationMessage = '';
40 handleCancel(flag): void {
41 this.samrtCloudLeasedLineShowFlag = false;
42 this.communicationMessage = "";
43 this.resolveEmitter.emit({ "cancel": flag });
47 if (this.radioValue === 'text') {
48 this.submitFormMessage();
55 this.handleCancel(false);
58 submitFormMessage(): void {
61 "text": this.communicationMessage
63 this.myhttp.intentInstancePredict(params).subscribe(
65 console.log(response);
66 this.handleCancel(false);
76 this.isDisable = true;
77 this.Recorder.beforeStartRecord();
82 this.isDisable = false;
83 this.Recorder.stopRecord();
87 let audio = document.querySelector('audio');
88 audio["src"] = this.Recorder.playRecord();