1 import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
2 import { Util } from '../../../../../shared/utils/utils';
3 import { onboardService } from '../../../../../core/services/onboard.service';
4 import { Recorder } from '../../../../../shared/utils/recorder';
7 selector: 'app-input-business-order',
8 templateUrl: './input-business-order.component.html',
9 styleUrls: ['./input-business-order.component.less']
11 export class InputBusinessOrderComponent implements OnInit {
13 constructor(private Util: Util, private Recorder: Recorder, private myhttp: onboardService) { }
15 @Input() showModel: boolean;
16 @Output() modalOpreation = new EventEmitter();
17 isSpinning: boolean = false;
18 communicationMessage: String = "";
19 validateRulesShow: any[] = [];
20 rulesText: any[] = [];
21 radioValue: String = 'text';
22 isPlay: boolean = false;
23 clickRepeat: boolean = false;
26 this.validateRulesShow = [];
28 this.communicationMessage = '';
34 handleCancel(): void {
35 this.showModel = false;
36 this.communicationMessage = "";
37 this.modalOpreation.emit({ "cancel": true });
41 if (this.clickRepeat) {
44 this.clickRepeat = true;
45 if (this.radioValue === "text") {
46 this.submitFormMessage();
49 this.clickRepeat = false;
50 this.communicationMessage = "";
51 this.showModel = false;
53 coverageArea: "Beijing Beijing Haiding Wanshoulu",
54 expDataRateDL: "1000",
55 expDataRateUL: "1000",
58 name: "exclusive slicing service",
59 resourceSharingLevel: "shared",
60 uEMobilityLevel: "stationary"
62 this.modalOpreation.emit({ "cancel": false, "param": defaultParams });
64 submitFormMessage(): void {
65 this.Util.validator("communicationMessage", "communicationMessage", this.communicationMessage, 0, this.rulesText, this.validateRulesShow);
66 if (this.validateRulesShow.indexOf(true) > -1) {
67 this.clickRepeat = false;
72 "text": this.communicationMessage
74 this.myhttp["analysisInputText"](params)
75 .subscribe((data) => {
76 this.clickRepeat = false;
80 let orderForm = { ...data };
81 this.communicationMessage = "";
82 this.showModel = false;
83 this.modalOpreation.emit({ "cancel": false, "param": orderForm });
85 this.clickRepeat = false;
91 this.Recorder.beforeStartRecord();
95 this.Recorder.stopRecord();
98 let audio = document.querySelector('audio');
99 audio["src"] = this.Recorder.playRecord();