新增文件夹时添加限制

This commit is contained in:
miao 2023-02-15 16:30:42 +08:00 committed by fangxiang
parent e68eb4c8d6
commit fc6b23432c
3 changed files with 35 additions and 12 deletions

View File

@ -899,7 +899,8 @@ export default defineComponent({
message: $t.t("input folder name") + ":", message: $t.t("input folder name") + ":",
prompt: { prompt: {
model: "", model: "",
isValid: (val: string) => !!val && val.trim().length > 0, isValid: (val: string) =>
!!val && val.trim().length > 0&& val.indexOf(".") != 0 ,
type: "text", type: "text",
}, },
ok: { ok: {
@ -917,6 +918,7 @@ export default defineComponent({
const response = await GlobalData.getInstance() const response = await GlobalData.getInstance()
.getCurrentClient() .getCurrentClient()
?.CreateDirectoryFileManager(path.value, data); ?.CreateDirectoryFileManager(path.value, data);
console.log(response);
if (response && response.success) { if (response && response.success) {
refresh_file_list(); refresh_file_list();
$q.notify({ $q.notify({
@ -926,17 +928,35 @@ export default defineComponent({
timeout: 1500, timeout: 1500,
}); });
} else { } else {
// if (
// response?.error_message ==
// "the folder name cannot start with a '.'"
// ) {
// $q.notify({
// type: "warning",
// message:
// $t.t("create folder") +
// $t.t("fail") +
// "!" +
// $t.t("the folder name cannot start with a '.'"),
// position: "top",
// timeout: 1500,
// });
// }
// else {
if (response) {
$q.notify({ $q.notify({
type: "warning", type: "warning",
message: message:
$t.t("create folder") + $t.t("create folder") +
$t.t("fail") + $t.t("fail") +
"! " + "! " +
(response ? response.error_message : ""), $t.t(response.error_message),
position: "top", position: "top",
timeout: 1500, timeout: 1500,
}); });
} }
}
}); });
}, },

View File

@ -445,4 +445,6 @@ export default {
resize: "Resize", resize: "Resize",
"export magic": "Export", "export magic": "Export",
"raster graph": "Raster Graph", "raster graph": "Raster Graph",
"the folder name cannot start with a '.'":"The Folder Name Cannot Start With a '.'",
}; };

View File

@ -713,4 +713,5 @@ export default {
resize: "缩放", resize: "缩放",
"export magic": "导出", "export magic": "导出",
"raster graph": "栅格图", "raster graph": "栅格图",
"the folder name cannot start with a '.'":"文件夹名称不能以“.” 开头",
}; };