feat: Add folder upload functionality and enhance document upload experience

- Introduced a new option for users to upload entire folders, improving document management capabilities.
- Enhanced file type verification to provide better feedback for unsupported files during uploads.
- Updated UI components in the menu for clearer action items related to document uploads.
- Improved localization support for new upload messages in English, Russian, and Chinese.
This commit is contained in:
wizardchen
2025-11-21 01:07:28 +08:00
parent 21649b62c7
commit c678094724
7 changed files with 704 additions and 181 deletions
+10 -4
View File
@@ -22,22 +22,28 @@ export function formatStringDate(date: any) {
year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second
);
}
export function kbFileTypeVerification(file: any) {
export function kbFileTypeVerification(file: any, silent = false) {
let validTypes = ["pdf", "txt", "md", "docx", "doc", "jpg", "jpeg", "png", "csv", "xlsx", "xls"];
let type = file.name.substring(file.name.lastIndexOf(".") + 1);
if (!validTypes.includes(type)) {
MessagePlugin.error("文件类型错误!");
if (!silent) {
MessagePlugin.error("文件类型错误!");
}
return true;
}
if (
(type == "pdf" || type == "docx" || type == "doc") &&
file.size > 31457280
) {
MessagePlugin.error("pdf/doc文件不能超过30M!");
if (!silent) {
MessagePlugin.error("pdf/doc文件不能超过30M!");
}
return true;
}
if ((type == "txt" || type == "md") && file.size > 31457280) {
MessagePlugin.error("txt/md文件不能超过30M!");
if (!silent) {
MessagePlugin.error("txt/md文件不能超过30M!");
}
return true;
}
return false