Browse Source

录音盒失败修改

seimin 4 months ago
parent
commit
713221aedc

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

@@ -62,6 +62,8 @@ export class WebsocketPhoneService {
62
       console.log(response)
62
       console.log(response)
63
       if (!this.isHandler && response.status === 408 && sessionStorage.getItem('phoneNumber')) {
63
       if (!this.isHandler && response.status === 408 && sessionStorage.getItem('phoneNumber')) {
64
         this.reconnect(this.url, this.urlParams);
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
       this.ws.close();
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
     private http: HttpClient,
116
     private http: HttpClient,
117
     public route: ActivatedRoute,
117
     public route: ActivatedRoute,
118
     public incomingService: WebsocketIncomingService,
118
     public incomingService: WebsocketIncomingService,
119
-  ) {}
119
+  ) {
120
+    // 在组件中订阅服务的Observable
121
+    this.phones.getDataUpdate().subscribe(data => {
122
+      this.websocketLoading = data;
123
+    });
124
+  }
120
   validateFormZy!: FormGroup;
125
   validateFormZy!: FormGroup;
121
   validateFormQt!: FormGroup;
126
   validateFormQt!: FormGroup;
122
   // ---------------------------------------
127
   // ---------------------------------------