From 732b184ab4b638c8211cd905e620a35c3b16e796 Mon Sep 17 00:00:00 2001 From: x1ao4 Date: Wed, 2 Jul 2025 02:19:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=89=E6=8B=A9=E8=B5=B7?= =?UTF-8?q?=E5=A7=8B=E6=96=87=E4=BB=B6=E5=92=8C=E9=80=89=E6=8B=A9=E9=9C=80?= =?UTF-8?q?=E8=BD=AC=E5=AD=98=E7=9A=84=E6=96=87=E4=BB=B6=E5=A4=B9=E6=A8=A1?= =?UTF-8?q?=E6=80=81=E6=A1=86=E7=9A=84=E6=8E=92=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/templates/index.html | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/app/templates/index.html b/app/templates/index.html index 978775c..13713bb 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -749,7 +749,7 @@
- +
@@ -764,7 +764,7 @@
- +
@@ -808,7 +808,7 @@
- +
@@ -825,7 +825,7 @@
-
@@ -3161,7 +3161,7 @@ this.fileSelect.fileList = []; this.fileSelect.paths = []; this.fileSelect.index = index; - // 重置排序状态为默认值 + // 重置排序状态为默认值 - 选择需转存的文件夹模态框默认修改时间倒序 this.fileSelect.sortBy = "updated_at"; this.fileSelect.sortOrder = "desc"; @@ -3248,8 +3248,12 @@ // 命名预览模式下使用重命名列倒序排序 this.fileSelect.sortBy = "file_name_re"; this.fileSelect.sortOrder = "desc"; + } else if (this.fileSelect.selectDir) { + // 选择需转存的文件夹模态框:默认修改时间倒序 + this.fileSelect.sortBy = "updated_at"; + this.fileSelect.sortOrder = "desc"; } else { - // 其他情况使用文件名倒序排序(使用全局文件排序函数) + // 选择起始文件模态框:使用文件名倒序排序(使用全局文件排序函数) this.fileSelect.sortBy = "file_name"; this.fileSelect.sortOrder = "desc"; } @@ -3868,13 +3872,25 @@ // 文件夹始终在前 if (a.dir && !b.dir) return -1; if (!a.dir && b.dir) return 1; - // 使用拼音排序 - let aValue = pinyinPro.pinyin(a.file_name, { toneType: 'none', type: 'string' }).toLowerCase(); - let bValue = pinyinPro.pinyin(b.file_name, { toneType: 'none', type: 'string' }).toLowerCase(); - if (this.fileSelect.sortOrder === 'asc') { - return aValue > bValue ? 1 : -1; + + // 检查当前模态框类型,选择起始文件模态框使用全局文件排序函数 + const modalType = document.getElementById('fileSelectModal').getAttribute('data-modal-type'); + if (modalType === 'start-file') { + // 选择起始文件模态框:使用全局文件排序函数 + const ka = sortFileByName(a), kb = sortFileByName(b); + for (let i = 0; i < ka.length; ++i) { + if (ka[i] !== kb[i]) return this.fileSelect.sortOrder === 'asc' ? (ka[i] > kb[i] ? 1 : -1) : (ka[i] < kb[i] ? 1 : -1); + } + return 0; } else { - return aValue < bValue ? 1 : -1; + // 其他模态框:使用拼音排序 + let aValue = pinyinPro.pinyin(a.file_name, { toneType: 'none', type: 'string' }).toLowerCase(); + let bValue = pinyinPro.pinyin(b.file_name, { toneType: 'none', type: 'string' }).toLowerCase(); + if (this.fileSelect.sortOrder === 'asc') { + return aValue > bValue ? 1 : -1; + } else { + return aValue < bValue ? 1 : -1; + } } } if (field === 'file_name_re') {