Browse Source

[完善]预警图片视频为空时处理

beijing
邵佳豪 3 years ago
parent
commit
50aa5ff430
  1. 22
      src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html
  2. 29
      src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.ts

22
src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html

@ -17,15 +17,25 @@
</div>
<div class="content">
<div *ngIf="selectedType == 'img'" class="imgbox">
<ng-container *ngIf="isImage; else elseTemplate">
<img [src]="imgUrl" alt="">
<ng-container *ngIf="imgUrl; else elseTemplate">
<ng-container *ngIf="isImage; else elseTemplate2">
<img [src]="imgUrl" alt="">
</ng-container>
<ng-template #elseTemplate2>
<iframe width="100%" height="100%" [src]="fileUrl" frameborder="0"></iframe>
</ng-template>
</ng-container>
<ng-template #elseTemplate>
<iframe width="100%" height="100%" [src]="fileUrl" frameborder="0"></iframe>
暂无图片
</ng-template>
</div>
<div *ngIf="selectedType == 'video'" class="vediobox">
<video controls style="width: 100%;height: 100%;" [src]="vedioUrl"></video>
<ng-container *ngIf="vedioUrl; else elseTemplate3">
<video controls style="width: 100%;height: 100%;" [src]="vedioUrl"></video>
</ng-container>
<ng-template #elseTemplate3>
暂无视频
</ng-template>
</div>
</div>
<div class="disposebox">
@ -43,10 +53,6 @@
<span *ngIf="data.handleTime" style="color: #4BFFD4;cursor: default;">已处置</span>
</div>
</ng-template>
</div>
<div class="disposeContent">
<textarea *ngIf="!data.handleTime" [(ngModel)]="content"></textarea>

29
src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.ts

@ -24,29 +24,28 @@ export class GetOutOfLineDetailsComponent implements OnInit {
isMisinformation: boolean = false//误报按钮的显隐
isImage //传过来的文件是否是图片
isImage = true//传过来的文件是否是图片
fileUrl
ngOnInit(): void {
console.log(this.data)
// console.log(this.data)
this.details = this.data.content1
this.vedioUrl = this.data.violateVideo
this.content = this.data.handleRecord
this.imgUrl = this.data.violateImage
if (this.getFileType(this.imgUrl) == 'img') {
this.isImage = true
} else {
this.isImage = false
if (this.getFileType(this.imgUrl) == 'word') {
let arr = this.imgUrl.split('.')
arr[arr.length - 1] = 'pdf'
this.fileUrl = this.sanitizer.bypassSecurityTrustResourceUrl(arr.join('.'));
} else if (this.getFileType(this.imgUrl) == 'pdf') {
this.fileUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.imgUrl);
if (this.imgUrl) {
if (this.getFileType(this.imgUrl) == 'img') {
this.isImage = true
} else {
this.isImage = false
if (this.getFileType(this.imgUrl) == 'word') {
let arr = this.imgUrl.split('.')
arr[arr.length - 1] = 'pdf'
this.fileUrl = this.sanitizer.bypassSecurityTrustResourceUrl(arr.join('.'));
} else if (this.getFileType(this.imgUrl) == 'pdf') {
this.fileUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.imgUrl);
}
}
}

Loading…
Cancel
Save