Browse Source

[完善]新建文件夹完成

master
陈鹏飞 5 years ago
parent
commit
9e9c6c21ae
  1. 17
      src/app/ui/all-file/all-file.component.html
  2. 6
      src/app/ui/all-file/all-file.component.scss
  3. 61
      src/app/ui/all-file/all-file.component.ts

17
src/app/ui/all-file/all-file.component.html

@ -49,18 +49,11 @@
</div>
</div>
<div class="titlebox">
<ng-container *ngIf="!isClickFile; else elseTemplate">
<div class="titleleft">
<span>全部文件</span>
</div>
</ng-container>
<ng-template #elseTemplate>
<div class="titleleft">
<span class="goBack" (click)='backToTop()' *ngIf="selectedDataBank.includes('/')">返回顶级目录</span>
<span style="margin: 0 3px;color: #c5d8f3;">|</span>
<span class="allFile" (click)="allFile()">全部文件</span>
</div>
</ng-template>
<div class="titleleft">
<span class="goBack" (click)='backToTop()'>返回顶级目录</span>
<span style="margin: 0 3px;color: #c5d8f3;">|</span>
<span class="allFile">全部文件</span>
</div>

6
src/app/ui/all-file/all-file.component.scss

@ -161,17 +161,13 @@
}
.titleleft{
float: left;
.goBack,.allFile{
.goBack{
color: #09aaff;
}
.goBack:hover{
cursor: pointer;
text-decoration: underline;
}
.allFile:hover{
cursor: pointer;
text-decoration: underline;
}
}
.titleright{
float: right;

61
src/app/ui/all-file/all-file.component.ts

@ -10,9 +10,9 @@ import { async } from '@angular/core/testing';
@Component({
selector: 'app-all-file',
templateUrl: './all-file.component.html',
styleUrls: ['./all-file.component.scss']
styleUrls: ['./all-file.component.scss'],
})
export class AllFileComponent implements OnInit {
export class AllFileComponent {
displayedColumns: string[] = ['select', 'name', 'weight', 'time'];
dataSource:any = new MatTableDataSource;
@ -26,7 +26,7 @@ export class AllFileComponent implements OnInit {
selectedDataBank:any //当前需要显示的资料库
selectedDataBank:string //当前需要显示的资料库
fileNum:any = 0 //当前资料库文件数量
selection = new SelectionModel(true, []);
@ -153,26 +153,25 @@ export class AllFileComponent implements OnInit {
//点击列表每一条的名字
clickName(e,item){
e.stopPropagation()
console.log(item)
if(item.type == "jpg" || item.type == "png"){
if(item.type == "jpg" || item.type == "png" && !item.isDir){
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"){
}else if(item.type == "mp4" || item.type == "MP4" && !item.isDir){
const dialogRef = this.dialog.open(ViewDetails, {//调用open方法打开对话框并且携带参数过去
width: '1600px',
height:'900px',
data: {url:item.key,type:"video"}
});
dialogRef.afterClosed().subscribe(
);
}else if (item.isDir) {
this.selectedDataBank = item.key.substring(0, item.key.length - 1)
this.getALLFileList(this.selectedDataBank)
}else{
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
@ -180,14 +179,9 @@ export class AllFileComponent implements OnInit {
this.snackBar.open('该文件类型暂不支持在线查看,请下载查看','确定',config)
}
}
//面包屑点击全部文件
allFile(){
this.isClickFile = false
}
yyy(){
console.log(this.selection)
}
//上传按钮鼠标移入
uploadBtnEnter(){
this.isOpenUpload = true
@ -263,26 +257,31 @@ export class AllFileComponent implements OnInit {
const dialogRef = this.dialog.open(FolderDialog);
dialogRef.afterClosed().subscribe((data)=>{
if(data){
<<<<<<< HEAD
console.log(data,this.selectedDataBank)
=======
>>>>>>> f1d33bc0c5ec774db205e9b6088bdf1bf457a7bf
//创建空文件夹
this.http.post(`/api/Objects/drives/${this.selectedDataBank}/${data.name}/`,{}).subscribe(data=>{
console.log(data)
// this.getALLFileList(this.selectedDataBank)
// const config = new MatSnackBarConfig();
// config.verticalPosition = 'top';
// config.duration = 3000
// this.snackBar.open('新建文件夹成功','确定',config)
this.getALLFileList(this.selectedDataBank)
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('新建文件夹成功','确定',config)
})
} //if
});
}
//返回顶级目录
backToTop () {
console.log(this.selectedDataBank,'返回')
if (this.selectedDataBank.includes('/')) {
let arr = this.selectedDataBank.split('/')
this.getALLFileList(arr[0])
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('目前已是顶级目录','确定',config)
}
}

Loading…
Cancel
Save