Browse Source

[新增]返回上级目录

master
邵佳豪 5 years ago
parent
commit
c15e964e2e
  1. 2
      proxy.config.json
  2. 4
      src/app/ui/all-file/all-file.component.html
  3. 25
      src/app/ui/all-file/all-file.component.ts

2
proxy.config.json

@ -1,6 +1,6 @@
{
"/api": {
"target": "http://192.168.1.250",
"target": "http://192.168.110.109:8100",
"secure": false,
"changeOrigin": true
}

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

@ -57,6 +57,8 @@
<div class="titlebox">
<div class="titleleft">
<span class="goBack" (click)='backToTop()' *ngIf="selectedDataBank.includes('/')">返回一级目录</span>
&nbsp;
<span class="goBack" (click)='backTominTop()' *ngIf="selectedDataBank.includes('/')">返回上一级目录</span>
<span style="margin: 0 3px;color: #c5d8f3;">|</span>
<span class="allFile">全部文件</span>
<span style="margin: 0 3px;color: #c5d8f3;"></span>
@ -92,7 +94,7 @@
<th style="width: 63%;" mat-header-cell *matHeaderCellDef> 文件名 </th>
<td mat-cell *matCellDef="let element">
<img *ngIf="element.type == 'pdf'" src="../../../assets/images/pdf.png" alt="">
<img *ngIf="element.type == 'jpeg' || element.type == 'jpg' || element.type == 'png' || element.type == 'gif' || element.type == 'svg'|| element.type == 'webp' || element.type == 'bmp'" src="../../../assets/images/img.png" alt="">
<img *ngIf="element.type == 'jpeg' || element.type == 'jpg' || element.type == 'png' || element.type == 'gif' || element.type == 'svg'|| element.type == 'webp' || element.type == 'bmp'|| element.type == 'JPG'" src="../../../assets/images/img.png" alt="">
<img *ngIf="element.type == 'doc' || element.type == 'docx'" src="../../../assets/images/word.png" alt="">
<img *ngIf="element.type == 'xlsx'" src="../../../assets/images/excel.png" alt="">
<img *ngIf="element.type == 'zip'" src="../../../assets/images/zip.png" alt="">

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

@ -224,12 +224,13 @@ export class AllFileComponent {
}
}
goback:any //记录上一级目录
//点击列表每一条的名字
clickName(e,item){
// console.log(item)
e.stopPropagation()
if(item.type == "jpg" || item.type == "png" || item.type == "bmp"|| item.type == "gif"&& !item.isDir){
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"}
@ -284,7 +285,9 @@ export class AllFileComponent {
window.open("qiuguan")
}else if (item.isDir) {
this.selectedDataBank = item.key.substring(0, item.key.length - 1)
// console.log(this.selectedDataBank)
this.getALLFileList(this.selectedDataBank)
}else{
const config = new MatSnackBarConfig();
@ -293,7 +296,23 @@ export class AllFileComponent {
this.snackBar.open('该文件类型暂不支持在线查看,请下载查看','确定',config)
}
}
//返回上一级目录
backTominTop(){
let topnum = this.gettoplist(this.selectedDataBank)
this.getALLFileList(topnum)
}
//上级目录产生函数
gettoplist(item){
let list = item
let listArr = list.split("/")
let listresult = ""
for(let i = 0;i < listArr.length - 1;i++){
listresult += listArr[i] + "/"
}
let listresult2 = listresult.substring(0, listresult.length - 1)
return listresult2
}
//上传按钮鼠标移入
@ -347,7 +366,11 @@ export class AllFileComponent {
fileArr:any
//上传文件夹
async selectFiles (e) {
// console.log(e)
this.fileArr = e.target.files || null //上传的文件
console.log(111,this.fileArr)
let _this = this
for (var i = 0;i < this.fileArr.length; i++) {
let f = this.fileArr[i];

Loading…
Cancel
Save