diff --git a/app/Http/Controllers/Api/FileController.php b/app/Http/Controllers/Api/FileController.php
index bc479566..7ec579cd 100755
--- a/app/Http/Controllers/Api/FileController.php
+++ b/app/Http/Controllers/Api/FileController.php
@@ -509,7 +509,7 @@ class FileController extends AbstractController
}
//
if ($file->isNnShare()) {
- return Base::retError('已经处于共享目录中');
+ return Base::retError('已经处于共享文件夹中');
}
//
if ($action == 'unshare') {
diff --git a/app/Models/File.php b/app/Models/File.php
index 3122542f..7f852bdb 100644
--- a/app/Models/File.php
+++ b/app/Models/File.php
@@ -51,21 +51,21 @@ class File extends AbstractModel
/**
* 是否有访问权限
- * ① 自己的目录
- * ② 共享所有人的目录
+ * ① 自己的文件夹
+ * ② 共享所有人的文件夹
* ③ 在指定共享人员内
* @param $userid
*/
public function chackAllow($userid)
{
if ($userid == $this->userid) {
- // ① 自己的目录
+ // ① 自己的文件夹
return;
}
$row = $this->getShareInfo();
if ($row) {
if ($row->share == 1) {
- // ② 共享所有人的目录
+ // ② 共享所有人的文件夹
return;
} elseif ($row->share == 2) {
// ③ 在指定共享人员内
@@ -101,7 +101,7 @@ class File extends AbstractModel
}
/**
- * 是否处于共享目录内(不含自身)
+ * 是否处于共享文件夹内(不含自身)
* @return bool
*/
public function isNnShare()
diff --git a/app/Module/Base.php b/app/Module/Base.php
index c5bc04d9..b3fe5159 100755
--- a/app/Module/Base.php
+++ b/app/Module/Base.php
@@ -249,7 +249,7 @@ class Base
}
/**
- * 新建目录
+ * 新建文件夹
* @param $path
* @return mixed
*/
@@ -268,7 +268,7 @@ class Base
}
/**
- * 删除目录
+ * 删除文件夹
* @param $path
*/
public static function deleteDir($path)
@@ -277,9 +277,9 @@ class Base
}
/**
- * 删除目录及目录下所有的文件
+ * 删除文件夹及文件夹下所有的文件
* @param $dirName
- * @param bool $undeleteDir 不删除目录(只删除文件)
+ * @param bool $undeleteDir 不删除文件夹(只删除文件)
*/
public static function deleteDirAndFile($dirName, $undeleteDir = false)
{
@@ -2129,7 +2129,7 @@ class Base
$array = [
"name" => $fileName, //原文件名
"size" => Base::twoFloat($fileSize / 1024, true), //大小KB
- "file" => $filePath . $fileName, //目录的完整路径 "D:\www....KzZ.jpg"
+ "file" => $filePath . $fileName, //文件的完整路径 "D:\www....KzZ.jpg"
"path" => $fileDir . $fileName, //相对路径 "uploads/pic....KzZ.jpg"
"url" => Base::fillUrl($fileDir . $fileName), //完整的URL "https://.....hhsKzZ.jpg"
"thumb" => '', //缩略图(预览图) "https://.....hhsKzZ.jpg_thumb.jpg"
@@ -2278,7 +2278,7 @@ class Base
$array = [
"name" => $file->getClientOriginalName(), //原文件名
"size" => Base::twoFloat($fileSize / 1024, true), //大小KB
- "file" => public_path($param['path'] . $fileName), //目录的完整路径 "D:\www....KzZ.jpg"
+ "file" => public_path($param['path'] . $fileName), //文件的完整路径 "D:\www....KzZ.jpg"
"path" => $param['path'] . $fileName, //相对路径 "uploads/pic....KzZ.jpg"
"url" => Base::fillUrl($param['path'] . $fileName), //完整的URL "https://.....hhsKzZ.jpg"
"thumb" => '', //缩略图(预览图) "https://.....hhsKzZ.jpg_thumb.jpg"
diff --git a/electron/build.js b/electron/build.js
index f130de26..1f65a192 100644
--- a/electron/build.js
+++ b/electron/build.js
@@ -7,7 +7,7 @@ const argv = process.argv;
const env = require('dotenv').config({ path: './.env' })
/**
- * 删除目录及文件
+ * 删除文件夹及文件
* @param path
*/
function deleteFile(path) {
diff --git a/public/images/file/updir.svg b/public/images/file/updir.svg
new file mode 100644
index 00000000..41d10e59
--- /dev/null
+++ b/public/images/file/updir.svg
@@ -0,0 +1 @@
+
diff --git a/resources/assets/js/components/ImgUpload.vue b/resources/assets/js/components/ImgUpload.vue
index 468aa951..3aea1a53 100755
--- a/resources/assets/js/components/ImgUpload.vue
+++ b/resources/assets/js/components/ImgUpload.vue
@@ -334,7 +334,7 @@
browseItem(item) {
//点击选择图片
if (item.type === 'dir') {
- //目录
+ //文件夹
this.browsePicture(item.path);
}else if (item.type === 'file') {
//文件
diff --git a/resources/assets/js/components/MDEditor/components/pro/index.vue b/resources/assets/js/components/MDEditor/components/pro/index.vue
index 72608e5f..d154f4cf 100644
--- a/resources/assets/js/components/MDEditor/components/pro/index.vue
+++ b/resources/assets/js/components/MDEditor/components/pro/index.vue
@@ -171,7 +171,7 @@
@mouseenter="mousescrollSide('right')">
-
+
-
{{item.text}}
diff --git a/resources/assets/js/pages/manage/file.vue b/resources/assets/js/pages/manage/file.vue
index 4e1748c2..94c91369 100644
--- a/resources/assets/js/pages/manage/file.vue
+++ b/resources/assets/js/pages/manage/file.vue
@@ -1,7 +1,9 @@
-
+
+
+
+
- {{$L('全部文件')}}
@@ -38,19 +26,20 @@
{{item.name}}
-
+
+
@@ -65,25 +56,16 @@
{{$L('没有任何文件')}}
-
+
- -
-
+
-
+
@@ -108,15 +90,62 @@
+
+
+
+
+
+
import('./components/FileContent');
@@ -184,13 +214,19 @@ export default {
types: [
{
"value": "folder",
- "label": "新建目录",
- "name": "目录",
+ "label": "新建文件夹",
+ "name": "文件夹",
},
{
"value": "upload",
"label": "上传文件",
- "name": "上传",
+ "name": null,
+ "divided": true
+ },
+ {
+ "value": "updir",
+ "label": "上传文件夹",
+ "name": null,
},
{
"value": "document",
@@ -244,10 +280,18 @@ export default {
editHeight: 0,
editInfo: {},
+ uploadDir: false,
uploadIng: 0,
uploadFormat: ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'],
uploadAccept: ['.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx'].join(","),
- maxSize: 204800
+ maxSize: 204800,
+
+ contextMenuItem: {},
+ contextMenuVisible: false,
+ contextMenuStyles: {
+ top: 0,
+ left: 0
+ },
}
},
@@ -390,6 +434,7 @@ export default {
array.push(h('QuickEdit', {
props: {
value: row.name,
+ autoEdit: !!row._edit
},
on: {
'on-edit-change': (b) => {
@@ -464,7 +509,7 @@ export default {
resizable: true,
sortable: true,
render: (h, {row}) => {
- let type = this.types.find(({value}) => value == row.type);
+ let type = this.types.find(({value, name}) => value == row.type && name);
if (type) {
return h('AutoTip', type.name);
} else {
@@ -523,8 +568,13 @@ export default {
addFile(command) {
if (command == 'upload') {
+ this.uploadDir = false
this.$refs.fileUpload.handleClick();
return;
+ } else if (command == 'updir') {
+ this.uploadDir = true
+ this.$refs.dirUpload.handleClick();
+ return;
}
let id = $A.randomString(8);
this.files.push({
@@ -538,6 +588,25 @@ export default {
this.autoBlur(id)
},
+ handleRightClick(event, item, isAddButton) {
+ this.contextMenuItem = $A.isJson(item) ? item : {};
+ if (this.contextMenuVisible) {
+ this.handleClickContextMenuOutside();
+ }
+ this.$nextTick(() => {
+ const fileWrap = this.$refs.fileWrapper;
+ const fileBounding = fileWrap.getBoundingClientRect();
+ this.contextMenuStyles = {
+ left: `${event.clientX - fileBounding.left}px`,
+ top: `${event.clientY - fileBounding.top}px`
+ };
+ if (isAddButton === true) {
+ this.contextMenuStyles.top = `${event.target.clientHeight + event.target.offsetTop - 5}px`
+ }
+ this.contextMenuVisible = true;
+ })
+ },
+
openFile(item) {
if (this.fileList.findIndex((file) => file._edit === true) > -1) {
return;
@@ -559,6 +628,18 @@ export default {
this.dropFile(row, 'open');
},
+ handleContextMenu(row, event) {
+ this.handleRightClick(event, this.files.find(({id}) => id === row.id) || {});
+ },
+
+ handleContextClick(command) {
+ this.dropFile(this.contextMenuItem, command)
+ },
+
+ handleClickContextMenuOutside() {
+ this.contextMenuVisible = false;
+ },
+
dropFile(item, command) {
switch (command) {
case 'open':
@@ -653,7 +734,10 @@ export default {
cursor: 'all'
})
} else if (document.getElementById('input_' + id)) {
- document.getElementById('input_' + id).focus();
+ const el = document.getElementById('input_' + id);
+ const len = el.value.length;
+ el.focus();
+ el.setSelectionRange(0, len);
}
})
},
@@ -794,6 +878,9 @@ export default {
handleFormatError(file) {
//上传类型错误
+ if (this.uploadDir) {
+ return;
+ }
$A.modalWarning({
title: '文件格式不正确',
content: '文件 ' + file.name + ' 格式不正确,仅支持上传:' + this.uploadFormat.join(',')
diff --git a/resources/assets/sass/element.scss b/resources/assets/sass/element.scss
index deca265a..761cbb78 100644
--- a/resources/assets/sass/element.scss
+++ b/resources/assets/sass/element.scss
@@ -16,7 +16,6 @@ $--dropdown-menuItem-hover-color: #606266;
.el-dropdown-menu__item {
min-width: 100px;
- line-height: 34px;
.item {
&.red {
color: #f00;
diff --git a/resources/assets/sass/pages/page-file.scss b/resources/assets/sass/pages/page-file.scss
index 8f274f17..752d4439 100644
--- a/resources/assets/sass/pages/page-file.scss
+++ b/resources/assets/sass/pages/page-file.scss
@@ -8,6 +8,7 @@
height: 0;
display: flex;
flex-direction: column;
+ position: relative;
.file-head {
display: flex;
align-items: center;
@@ -49,7 +50,7 @@
}
.file-add {
flex-shrink: 0;
- margin-left: 22px;
+ margin-left: 18px;
cursor: pointer;
.taskfont {
font-size: 18px;
@@ -258,6 +259,9 @@
&.upload:before {
background-image: url("../images/file/upload.svg");
}
+ &.updir:before {
+ background-image: url("../images/file/updir.svg");
+ }
&.folder:before {
background-image: url("../images/file/folder.svg");
}
@@ -347,8 +351,8 @@
.file-menu {
opacity: 0;
position: absolute;
- top: 0;
- right: 0;
+ top: 2px;
+ right: 2px;
transition: opacity 0.2s;
display: flex;
.ivu-icon {
@@ -395,6 +399,9 @@
&.upload .file-icon {
background-image: url("../images/file/upload.svg");
}
+ &.updir .file-icon {
+ background-image: url("../images/file/updir.svg");
+ }
&.folder .file-icon {
background-image: url("../images/file/folder.svg");
}
@@ -428,6 +435,9 @@
}
}
}
+ .file-menu {
+ position: absolute;
+ }
}
}
@@ -439,8 +449,8 @@
&:before {
flex-shrink: 0;
content: "";
- width: 18px;
- height: 18px;
+ width: 20px;
+ height: 20px;
background-repeat: no-repeat;
background-size: contain;
margin-right: 8px;
@@ -448,6 +458,9 @@
&.upload:before {
background-image: url("../images/file/upload.svg");
}
+ &.updir:before {
+ background-image: url("../images/file/updir.svg");
+ }
&.folder:before {
background-image: url("../images/file/folder.svg");
}
diff --git a/resources/assets/statics/README.md b/resources/assets/statics/README.md
index b6d94bf2..0ca18e79 100644
--- a/resources/assets/statics/README.md
+++ b/resources/assets/statics/README.md
@@ -1 +1 @@
-## public目录所有资源将拷贝到public下
+## public文件夹所有资源将拷贝到public下
diff --git a/resources/assets/statics/public/images/file/updir.svg b/resources/assets/statics/public/images/file/updir.svg
new file mode 100644
index 00000000..41d10e59
--- /dev/null
+++ b/resources/assets/statics/public/images/file/updir.svg
@@ -0,0 +1 @@
+