From c7a3481b95448ca6a33b906d42c48ff76795d923 Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 7 Dec 2022 22:56:18 +0800 Subject: [PATCH] #285 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 观察细致入微。 --- class/core/files_api.py | 6 +++--- route/static/app/files.js | 8 ++++++-- route/static/app/public.js | 13 +++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/class/core/files_api.py b/class/core/files_api.py index f4d04c175..eea61e6f7 100755 --- a/class/core/files_api.py +++ b/class/core/files_api.py @@ -97,11 +97,11 @@ class files_api: import shutil try: shutil.move(sfile, dfile) - msg = mw.getInfo('移动文件或目录[{1}]到[{2}]成功!', (sfile, dfile,)) + msg = mw.getInfo('移动或重名命文件[{1}]到[{2}]成功!', (sfile, dfile,)) mw.writeLog('文件管理', msg) - return mw.returnJson(True, '移动文件或目录成功!') + return mw.returnJson(True, '移动或重名命文件成功!') except: - return mw.returnJson(False, '移动文件或目录失败!') + return mw.returnJson(False, '移动或重名命文件失败!') def deleteApi(self): path = request.form.get('path', '') diff --git a/route/static/app/files.js b/route/static/app/files.js index f47e2f892..bc5e44a13 100755 --- a/route/static/app/files.js +++ b/route/static/app/files.js @@ -1103,7 +1103,7 @@ function reName(type, fileName) { closeBtn: 1, area: '320px', title: '重命名', - btn:["确定","保存"], + btn:["确定","取消"], content: '
\
\ \ @@ -1615,10 +1615,13 @@ function getPathSize(){ $("body").not(".def-log").click(function(){ $("#rmenu").hide() }); + //指定路径 $("#DirPathPlace input").keyup(function(e){ if(e.keyCode == 13) { - getFiles($(this).val()); + var fpath = $(this).val(); + fpath = filterPath(fpath); + getFiles(fpath); } }); @@ -1662,6 +1665,7 @@ function pathLeft(){ $("#PathPlaceBtn ul").css("left",0); } } + //路径快捷点击 $("#PathPlaceBtn").on("click", function(e){ if($("#DirPathPlace").is(":hidden")){ diff --git a/route/static/app/public.js b/route/static/app/public.js index a8f74d2fb..91909d2eb 100755 --- a/route/static/app/public.js +++ b/route/static/app/public.js @@ -100,6 +100,19 @@ function isContains(str, substr) { return str.indexOf(substr) >= 0; } + +function filterPath(path){ + var path_arr = path.split('/'); + var path_new = []; + for (var i = 0; i < path_arr.length; i++) { + if (path_arr[i]!=''){ + path_new.push(path_arr[i]); + } + } + var rdata = "/"+path_new.join('/'); + return rdata; +} + function msgTpl(msg, args){ if (typeof args == 'string'){ return msg.replace('{1}', args);