1 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
2 import { NzMessageService } from 'ng-zorro-antd';
3 import { onboardService } from '../../../../../core/services/onboard.service';
4 import { Recorder } from '../../../../../shared/utils/recorder';
5 import { Util } from '../../../../../shared/utils/utils';
8 selector: 'app-input-business-order',
9 templateUrl: './input-business-order.component.html',
10 styleUrls: ['./input-business-order.component.less']
12 export class InputBusinessOrderComponent implements OnInit {
16 private Recorder: Recorder,
17 private myhttp: onboardService,
18 private msg: NzMessageService
21 @Input() showModel: boolean;
22 @Output() modalOpreation = new EventEmitter();
23 isSpinning: boolean = false;
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;
32 this.validateRulesShow = [];
34 this.communicationMessage = '';
40 handleCancel(): void {
41 this.showModel = false;
42 this.communicationMessage = "";
43 this.modalOpreation.emit({ "cancel": true });
47 if (this.clickRepeat) {
50 this.clickRepeat = true;
51 if (this.radioValue === "text") {
52 this.submitFormMessage();
55 this.clickRepeat = false;
56 this.communicationMessage = "";
57 this.showModel = false;
59 coverageArea: "Beijing Beijing Haiding Wanshoulu",
60 expDataRateDL: "1000",
61 expDataRateUL: "1000",
64 name: "exclusive slicing service",
65 resourceSharingLevel: "shared",
66 uEMobilityLevel: "stationary"
68 this.modalOpreation.emit({ "cancel": false, "param": defaultParams });
70 submitFormMessage(): void {
71 this.Util.validator("communicationMessage", "communicationMessage", this.communicationMessage, 0, this.rulesText, this.validateRulesShow);
72 if (this.validateRulesShow.indexOf(true) > -1) {
73 this.clickRepeat = false;
79 "text": this.communicationMessage
81 this.myhttp["analysisInputText"](params)
82 .subscribe((data) => {
83 this.clickRepeat = false;
87 let orderForm = { ...data };
88 this.communicationMessage = "";
89 this.showModel = false;
90 this.modalOpreation.emit({ "cancel": false, "param": orderForm });
92 this.clickRepeat = false;
93 this.msg.error(`Error: Request failed with status code ${err.status}`);
98 this.isDisable = true;
99 this.Recorder.beforeStartRecord();
103 this.isDisable = false;
104 this.Recorder.stopRecord();
107 let audio = document.querySelector('audio');
108 audio["src"] = this.Recorder.playRecord();