From 0665f2de5fc47a5ad6696cff2e3668657df8b617 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sun, 26 Dec 2021 11:51:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/pages/manage/file.vue | 57 +++++++++++++-- resources/assets/sass/pages/page-file.scss | 85 ++++++++++++++++++++++ 2 files changed, 137 insertions(+), 5 deletions(-) diff --git a/resources/assets/js/pages/manage/file.vue b/resources/assets/js/pages/manage/file.vue index 8b2b211f..1daf5b35 100644 --- a/resources/assets/js/pages/manage/file.vue +++ b/resources/assets/js/pages/manage/file.vue @@ -9,6 +9,10 @@

{{$L('文件')}}

+
+ + +
@@ -132,6 +136,24 @@ +
+
+
+ {{$L('上传列表')}} + {{$L('清空已完成')}} +
+
    +
  • + {{item.name}} + {{item.response.msg}} + + +
  • +
+ +
+
+ { + let index = this.uploadList.findIndex(({uid}) => uid == file.uid) + if (index > -1) { + this.uploadList.splice(index, 1, file) + } else { + this.uploadList.unshift(file) + } + }) }, - handleSuccess(res, file) { + uploadClear() { + this.uploadList = this.uploadList.filter(({status}) => status !== 'finished') + }, + + uploadPercentageParse(val) { + return parseInt(val, 10); + }, + + handleProgress(event, file, fileList) { + //开始上传 + this.uploadIng++; + this.uploadUpdate(fileList); + }, + + handleSuccess(res, file, fileList) { //上传完成 this.uploadIng--; + this.uploadUpdate(fileList); if (res.ret === 1) { this.$store.dispatch("saveFile", res.data); } else { @@ -933,9 +978,10 @@ export default { } }, - handleError() { + handleError(error, file, fileList) { //上传错误 this.uploadIng--; + this.uploadUpdate(fileList); }, handleFormatError(file) { @@ -959,6 +1005,7 @@ export default { handleBeforeUpload() { //上传前判断 + this.uploadShow = true; return true; }, } diff --git a/resources/assets/sass/pages/page-file.scss b/resources/assets/sass/pages/page-file.scss index 27fd9d66..06beb9cf 100644 --- a/resources/assets/sass/pages/page-file.scss +++ b/resources/assets/sass/pages/page-file.scss @@ -38,6 +38,18 @@ } } } + .file-status { + flex-shrink: 0; + margin-left: 22px; + display: flex; + align-items: center; + cursor: pointer; + > button { + color: #ffffff; + background: #8bcf70; + border-color: #8bcf70; + } + } .file-search { flex-shrink: 0; margin-left: 22px; @@ -525,6 +537,79 @@ position: absolute; } } + .file-upload-list { + display: flex; + width: 380px; + padding: 14px 26px 14px 13px; + border-radius: 8px; + border: 1px solid #ebeef5; + position: fixed; + right: 16px; + bottom: 16px; + background-color: #fff; + box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); + transition: opacity .3s, transform .3s, left .3s, right .3s, top .4s, bottom .3s; + overflow: hidden; + .upload-wrap { + flex: 1; + margin-left: 13px; + margin-right: 8px; + .title { + font-weight: 700; + font-size: 16px; + color: #303133; + margin: 0; + > em { + padding-left: 4px; + font-style: normal; + cursor: pointer; + color: #2b85e4; + font-size: 12px; + font-weight: normal; + } + } + .content { + font-size: 14px; + line-height: 21px; + margin: 12px -16px 0 0; + color: #606266; + max-height: 500px; + overflow: auto; + > li { + list-style: none; + padding: 4px 16px 4px 0; + position: relative; + .file-name { + line-height: 18px; + } + .file-error { + font-size: 12px; + color: #ff0000; + } + .file-close { + position: absolute; + top: 7px; + right: 0; + display: none; + cursor: pointer; + } + &:hover { + .file-close { + display: block; + } + } + } + } + .close { + position: absolute; + top: 18px; + right: 15px; + cursor: pointer; + color: #909399; + font-size: 16px; + } + } + } } .page-file-dropdown-menu {