Browse Source

[完善]预警画框无数据打印

master
邵佳豪 2 years ago
parent
commit
46052848c9
  1. 43
      src/app/app.component.ts
  2. 3
      src/app/pages/get-out-of-line-details/get-out-of-line-details.component.html
  3. 11
      src/app/pages/get-out-of-line-details/get-out-of-line-details.component.scss
  4. 13
      src/app/pages/get-out-of-line-details/get-out-of-line-details.component.ts
  5. 1
      src/app/pages/login/login.component.ts

43
src/app/app.component.ts

@ -1,29 +1,38 @@
import { Component, TemplateRef, ViewChild } from '@angular/core';
import { HttpClient } from '@angular/common/http'
import { Router, ActivatedRoute } from '@angular/router'
import { CacheTokenService } from './service/cache-token.service'//引入服务
import { Component, TemplateRef, ViewChild } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Router, ActivatedRoute } from "@angular/router";
import { CacheTokenService } from "./service/cache-token.service"; //引入服务
import "reflect-metadata";
import { NzNotificationService } from 'ng-zorro-antd/notification';
import { NzNotificationService } from "ng-zorro-antd/notification";
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.scss"],
})
export class AppComponent {
@ViewChild(TemplateRef, { static: false }) template?: TemplateRef<{}>;
constructor(private http: HttpClient, private router: Router, public token: CacheTokenService, private notificationService: NzNotificationService) { }
constructor(
private http: HttpClient,
private router: Router,
public token: CacheTokenService,
private notificationService: NzNotificationService
) {}
ngOnInit(): void {
console.log("更新日期:20230728");
// console.log("window.parent", window.parent.location.href);
// alert(window.parent.location.href)
// 监听父页面向子页面的传参
// window.addEventListener("message", (e) => {
// // 通过origin对消息进行过滤,避免遭到XSS攻击
// // if (e.origin === "http://127.0.0.1:8001") {
// // console.log("父页面传输过来参数", e.data);
// // }
// console.log("父页面传输过来参数", e);
// });
}
ngAfterViewInit(): void {
}
ngAfterViewInit(): void {}
}

3
src/app/pages/get-out-of-line-details/get-out-of-line-details.component.html

@ -40,6 +40,9 @@
<div *ngIf="isCarStop && isAnxin" class="pageturning nextpage" (click)="pageturning('next')">
<i nz-icon nzType="right" nzTheme="outline"></i>
</div>
<div *ngIf="isAnxin && coordinate.length === 0" class="noCoordinate">
预警坐标信息获取失败
</div>
</ng-container>
<ng-template #elseTemplate>
<span class="SrcError">暂无图片</span>

11
src/app/pages/get-out-of-line-details/get-out-of-line-details.component.scss

@ -129,6 +129,17 @@
color: #40a9ff;
}
.noCoordinate {
color: red;
font-weight: 600;
font-size: 22px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 999;
}
.lastpage {
left: 20px;
}

13
src/app/pages/get-out-of-line-details/get-out-of-line-details.component.ts

@ -140,18 +140,19 @@ export class GetOutOfLineDetailsComponent implements OnInit {
canvasLabel() {
let imgBg: any = document.getElementById("img");
imgBg.onload = () => {
// console.log("图片记载完毕!", imgBg);
console.log("图片加载完毕...");
this.canvasWidth = imgBg.offsetWidth;
this.canvasHeight = imgBg.offsetHeight;
const canvas: any = document.querySelector("#canvas");
this.ctx = canvas.getContext("2d");
const cWidth = canvas.width,
cHeight = canvas.height;
setTimeout(() => {
const canvas: any = document.querySelector("#canvas");
this.ctx = canvas.getContext("2d");
const cWidth = canvas.width,
cHeight = canvas.height;
console.log("以图画底,描绘预警框...");
// 以图画底
this.ctx.drawImage(imgBg, 0, 0, cWidth, cHeight);
this.strokeRect(this.currentCoordinate);
}, 0);
}, 100);
};
}

1
src/app/pages/login/login.component.ts

@ -71,7 +71,6 @@ export class LoginComponent implements OnInit {
messages
encryptedAccessToken
submitForm(): void {
if (!this.remember) {
localStorage.removeItem("account")
localStorage.removeItem("password")

Loading…
Cancel
Save