diff --git a/src/app/ui/all-file/all-file.component.ts b/src/app/ui/all-file/all-file.component.ts
index 5945e47..6b65434 100644
--- a/src/app/ui/all-file/all-file.component.ts
+++ b/src/app/ui/all-file/all-file.component.ts
@@ -1,10 +1,11 @@
-import { Component, OnInit,ViewChild } from '@angular/core';
+import { Component, OnInit,ViewChild ,Inject} from '@angular/core';
import { SelectionModel } from '@angular/cdk/collections';
import {MatSort} from '@angular/material/sort';
import {MatTableDataSource} from '@angular/material/table';
import { HttpClient,HttpHeaders } from '@angular/common/http';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { IsLoginService } from '../../is-login.service'
+import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
@Component({
selector: 'app-all-file',
templateUrl: './all-file.component.html',
@@ -14,7 +15,7 @@ export class AllFileComponent implements OnInit {
displayedColumns: string[] = ['select', 'name', 'weight', 'time'];
dataSource:any = new MatTableDataSource;
- constructor(private http: HttpClient,public snackBar: MatSnackBar,public downloadFile:IsLoginService) { }
+ constructor(private http: HttpClient,public snackBar: MatSnackBar,public downloadFile:IsLoginService,public dialog: MatDialog) { }
isCancel:boolean = false //搜索框的X是否显示
searchData:any = "搜索您的文件" //搜索框内容
isClickFile:boolean = false //是否点击过文件
@@ -57,7 +58,6 @@ export class AllFileComponent implements OnInit {
ngOnInit(): void {
this.dataSource.sort = this.sort;
this.getAllDataBank()
-
}
//获得所有资料库,默认显示第一个资料库的文件
@@ -125,13 +125,55 @@ export class AllFileComponent implements OnInit {
}
//搜索框点击X事件
cancelbtn(){
+ this.getALLFileList(this.selectedDataBank)
this.searchData = "搜索您的文件"
this.isCancel = false
}
- //点击名字
- clickName(e){
+ //点击搜索
+ search(){
+ if(this.searchData != "搜索您的文件"){
+ this.http.get("/api/Objects/drives",{
+ params:{
+ prefix : this.searchData
+ }
+ }).subscribe(data=>{
+ console.log(data)
+ },
+ err=>{
+
+ })
+ }
+ }
+
+ //点击列表每一条的名字
+ clickName(e,item){
e.stopPropagation()
- console.log(123)
+ console.log(item)
+ if(item.type == "jpg" || item.type == "png"){
+ const dialogRef = this.dialog.open(ViewDetails, {//调用open方法打开对话框并且携带参数过去
+ width: '1600px',
+ height:'900px',
+ data: {url:item.key,type:"img"}
+ });
+ dialogRef.afterClosed().subscribe(
+
+ );
+ }else if(item.type == "mp4" || item.type == "MP4"){
+
+ const dialogRef = this.dialog.open(ViewDetails, {//调用open方法打开对话框并且携带参数过去
+ width: '1600px',
+ height:'900px',
+ data: {url:item.key,type:"video"}
+ });
+ dialogRef.afterClosed().subscribe(
+
+ );
+ }else{
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = 'top';
+ config.duration = 3000
+ this.snackBar.open('该文件类型暂不支持在线查看,请下载查看','确定',config)
+ }
}
//面包屑点击全部文件
@@ -160,7 +202,17 @@ export class AllFileComponent implements OnInit {
}
}, 0);
}
-
+ //点击每条的li
+ clickCheckBoxLi(e,row){
+ this.selection.toggle(row)
+ setTimeout(() => {
+ if(this.selection.selected.length != 0){
+ this.isDelete = true
+ } else{
+ this.isDelete = false
+ }
+ }, 0);
+ }
file:any //需要上传的文件
//input file 选择文件
selectFile (e) {
@@ -325,3 +377,26 @@ export class AllFileComponent implements OnInit {
}
}
+
+
+
+@Component({
+ selector: 'viewdetails',
+ templateUrl: './viewdetails.html',
+ styleUrls: ['./all-file.component.scss']
+})
+export class ViewDetails {
+ // myControl = new FormControl();
+ //注入MatDialogRef,可以用来关闭对话框
+ //要访问对话框组件中的数据,必须使用MAT_DIALOG_DATA注入令牌
+ constructor(private http: HttpClient,public dialogRef: MatDialogRef
,@Inject(MAT_DIALOG_DATA) public data) {}
+ Url:string
+ onNoClick(): void {
+ this.dialogRef.close();
+ }
+ ngOnInit(): void {
+ this.Url = "/api/Objects/drives/" + this.data.url
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/app/ui/all-file/viewdetails.html b/src/app/ui/all-file/viewdetails.html
new file mode 100644
index 0000000..65fdc14
--- /dev/null
+++ b/src/app/ui/all-file/viewdetails.html
@@ -0,0 +1,6 @@
+
+
+
![]()
+
+
+
\ No newline at end of file
diff --git a/src/app/ui/ui.module.ts b/src/app/ui/ui.module.ts
index 78d6e58..cae1bfb 100644
--- a/src/app/ui/ui.module.ts
+++ b/src/app/ui/ui.module.ts
@@ -50,12 +50,12 @@ import { ChangepasswordComponent } from './changepassword/changepassword.compone
import { SizePipe , NamePipe} from '../pipes/size.pipe';
import {ConfirmpswDirective} from './changepassword/equal-validator.directive';
import { FileUploadModule } from 'ng2-file-upload'
-import { AllFileComponent } from './all-file/all-file.component';
+import { AllFileComponent, ViewDetails } from './all-file/all-file.component';
import { ChangeuserdataComponent } from './changeuserdata/changeuserdata.component';
import { LoginComponent } from './login/login.component';
@NgModule({
- declarations: [PersonaldataComponent, ChangepasswordComponent,SizePipe,NamePipe,ConfirmpswDirective, AllFileComponent, ChangeuserdataComponent, LoginComponent],
+ declarations: [ViewDetails,PersonaldataComponent, ChangepasswordComponent,SizePipe,NamePipe,ConfirmpswDirective, AllFileComponent, ChangeuserdataComponent, LoginComponent],
imports: [
CommonModule,