From a5cf5c095ff7a14d49ce7762df2cb28fe2d413bf Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Thu, 28 Apr 2022 15:39:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=85=B7=E4=BD=93=E6=91=84?= =?UTF-8?q?=E5=83=8F=E5=A4=B4=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../host-config/host-config.component.ts | 3 +- .../image-label2/image-label2.component.ts | 34 +++++++++++-------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/app/system-management/host-config/host-config.component.ts b/src/app/system-management/host-config/host-config.component.ts index d5f8b2b..b907cdb 100644 --- a/src/app/system-management/host-config/host-config.component.ts +++ b/src/app/system-management/host-config/host-config.component.ts @@ -134,10 +134,9 @@ export class HostConfigComponent implements OnInit { } label(item) { - this.router.navigate(['/system/host/camera/imageLabel'],{queryParams: {id : item.id, type: item.type}}) + this.router.navigate(['/system/host/camera/imageLabel'],{queryParams: {id : item.id}}) } - connect() { let ids = [] this.listOfData.forEach((item: any) => { diff --git a/src/app/system-management/image-label2/image-label2.component.ts b/src/app/system-management/image-label2/image-label2.component.ts index 7ef06ab..0825d47 100644 --- a/src/app/system-management/image-label2/image-label2.component.ts +++ b/src/app/system-management/image-label2/image-label2.component.ts @@ -12,7 +12,8 @@ export class ImageLabel2Component implements OnInit { constructor(private route: ActivatedRoute, private http: HttpClient, private message: NzMessageService) { } - imgItem: any; + camerasData: any; //摄像头Data + imgItem: any; //图片 URL canvasWidth: number = 0; canvasHeight: number = 0; copyCanvas: any; //拷贝 canvas底图 @@ -42,20 +43,23 @@ export class ImageLabel2Component implements OnInit { let that = this return new Promise((resolve, reject) => { that.route.queryParams.subscribe(parmas => { - parmas.type != undefined? that.markType = Number(parmas.type) : null; - const httpOptions = { - responseType: 'blob' as 'json', - params: {cameraId: parmas.id} - }; - that.http.get(`/api/Cameras/Images`,httpOptions).subscribe({ - next: (data) => { - resolve(data) - }, - error: (err) => { - reject('error') - }, - }) - }) + that.http.get(`/api/Cameras/${parmas.id}`).subscribe((info: any)=>{ + that.camerasData = info + that.markType = info.type + const httpOptions = { + responseType: 'blob' as 'json', + params: {cameraId: parmas.id} + }; + that.http.get(`/api/Cameras/Images`,httpOptions).subscribe({ + next: (data) => { + resolve(data) + }, + error: (err) => { + reject('error') + }, + }) //get + }) //get + }) //route }) }