ソースを参照

录音盒失败修改

seimin 4 ヶ月 前
コミット
713221aedc
共有2 個のファイルを変更した21 個の追加1 個の削除を含む
  1. 15 0
      src/app/services/websocket-phone.service.ts
  2. 6 1
      src/app/views/fuwutai/fuwutai.component.ts

+ 15 - 0
src/app/services/websocket-phone.service.ts

@@ -62,6 +62,8 @@ export class WebsocketPhoneService {
62 62
       console.log(response)
63 63
       if (!this.isHandler && response.status === 408 && sessionStorage.getItem('phoneNumber')) {
64 64
         this.reconnect(this.url, this.urlParams);
65
+      }else{
66
+        this.updateProperty(false);
65 67
       }
66 68
     };
67 69
 
@@ -119,4 +121,17 @@ export class WebsocketPhoneService {
119 121
       this.ws.close();
120 122
     }
121 123
   }
124
+
125
+  // 创建一个Subject来发送和接收数据
126
+  private updateData = new Subject<any>();
127
+
128
+  // 提供一个方法来发送数据
129
+  updateProperty(data: any) {
130
+    this.updateData.next(data);
131
+  }
132
+
133
+  // 提供一个方法来订阅数据
134
+  getDataUpdate(): Subject<any> {
135
+    return this.updateData;
136
+  }
122 137
 }

+ 6 - 1
src/app/views/fuwutai/fuwutai.component.ts

@@ -116,7 +116,12 @@ export class FuwutaiComponent implements OnInit {
116 116
     private http: HttpClient,
117 117
     public route: ActivatedRoute,
118 118
     public incomingService: WebsocketIncomingService,
119
-  ) {}
119
+  ) {
120
+    // 在组件中订阅服务的Observable
121
+    this.phones.getDataUpdate().subscribe(data => {
122
+      this.websocketLoading = data;
123
+    });
124
+  }
120 125
   validateFormZy!: FormGroup;
121 126
   validateFormQt!: FormGroup;
122 127
   // ---------------------------------------