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') {