|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { Component, OnInit,ViewChild ,Inject,NgZone } from '@angular/core'; |
|
|
|
|
import { Component, OnInit,ViewChild ,Inject,NgZone, ElementRef } from '@angular/core'; |
|
|
|
|
import { SelectionModel } from '@angular/cdk/collections'; |
|
|
|
|
import {MatSort} from '@angular/material/sort'; |
|
|
|
|
import {MatTableDataSource} from '@angular/material/table'; |
|
|
|
@ -9,6 +9,7 @@ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dial
|
|
|
|
|
import {UploadFilesComponent} from '../upload-files/upload-files.component'; |
|
|
|
|
import { ComponentServiceService } from '../../component-service.service'; |
|
|
|
|
import { DomSanitizer } from "@angular/platform-browser"; |
|
|
|
|
import Viewer from 'viewerjs'; |
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-all-file', |
|
|
|
|
templateUrl: './all-file.component.html', |
|
|
|
@ -18,7 +19,7 @@ export class AllFileComponent {
|
|
|
|
|
displayedColumns: string[] = ['select', 'name', 'weight', 'time']; |
|
|
|
|
dataSource:any = new MatTableDataSource; |
|
|
|
|
|
|
|
|
|
constructor(private sanitizer: DomSanitizer,public emitService: ComponentServiceService,private http: HttpClient,public snackBar: MatSnackBar,public downloadFile:IsLoginService,public dialog: MatDialog,private zone: NgZone) { } |
|
|
|
|
constructor(private elementRef: ElementRef,private sanitizer: DomSanitizer,public emitService: ComponentServiceService,private http: HttpClient,public snackBar: MatSnackBar,public downloadFile:IsLoginService,public dialog: MatDialog,private zone: NgZone) { } |
|
|
|
|
isCancel:boolean = false //搜索框的X是否显示
|
|
|
|
|
searchData:any = "搜索您的文件" //搜索框内容
|
|
|
|
|
isClickFile:boolean = false //是否点击过文件
|
|
|
|
@ -330,12 +331,25 @@ export class AllFileComponent {
|
|
|
|
|
//点击列表每一条的名字
|
|
|
|
|
clickName(e,item){ |
|
|
|
|
e.stopPropagation() |
|
|
|
|
if(item.type == "jpg" || item.type == "png" || item.type == "bmp"|| item.type == "gif" || item.type == "jpeg"&& !item.isDir){ |
|
|
|
|
const dialogRef = this.dialog.open(ViewDetails, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
data: {url:item.key,type:"img"} |
|
|
|
|
if(item.type == "jpg" || item.type == "JPG" || item.type == "png" || item.type == "PNG" || item.type == "bmp"|| item.type == "gif" || item.type == "jpeg"&& !item.isDir){ |
|
|
|
|
|
|
|
|
|
let dom = document.getElementById(`viewerjs`) |
|
|
|
|
let pObjs = dom.childNodes; |
|
|
|
|
let node = document.createElement("img") |
|
|
|
|
node.style.display = "none"; |
|
|
|
|
node.src = "/api/Objects/drives/" + item.key; |
|
|
|
|
node.id = 'imgxxx' |
|
|
|
|
dom.appendChild(node) |
|
|
|
|
setTimeout(() => { |
|
|
|
|
let viewer = new Viewer(document.getElementById(`viewerjs`), { |
|
|
|
|
hidden:()=>{ |
|
|
|
|
dom.removeChild(pObjs[0]); |
|
|
|
|
viewer.destroy(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
node.click(); |
|
|
|
|
}, 0); |
|
|
|
|
|
|
|
|
|
this.downloadFile.handleData(item.key,"查看") |
|
|
|
|
}else if(item.type == "mp4" || item.type == "MP4" && !item.isDir){ |
|
|
|
|
const dialogRef = this.dialog.open(ViewDetails, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '1400px', |
|
|
|
|