新增文件夹时添加限制

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") + ":",
prompt: {
model: "",
isValid: (val: string) => !!val && val.trim().length > 0,
isValid: (val: string) =>
!!val && val.trim().length > 0&& val.indexOf(".") != 0 ,
type: "text",
},
ok: {
@ -917,6 +918,7 @@ export default defineComponent({
const response = await GlobalData.getInstance()
.getCurrentClient()
?.CreateDirectoryFileManager(path.value, data);
console.log(response);
if (response && response.success) {
refresh_file_list();
$q.notify({
@ -926,16 +928,34 @@ export default defineComponent({
timeout: 1500,
});
} else {
$q.notify({
type: "warning",
message:
$t.t("create folder") +
$t.t("fail") +
"!" +
(response ? response.error_message : ""),
position: "top",
timeout: 1500,
});
// 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({
type: "warning",
message:
$t.t("create folder") +
$t.t("fail") +
"! " +
$t.t(response.error_message),
position: "top",
timeout: 1500,
});
}
}
});
},
@ -1071,7 +1091,7 @@ export default defineComponent({
timeout: 1500,
});
loading.value = false;
uploading.value=false;
uploading.value = false;
}
}, 500);
},

View File

@ -445,4 +445,6 @@ export default {
resize: "Resize",
"export magic": "Export",
"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: "缩放",
"export magic": "导出",
"raster graph": "栅格图",
"the folder name cannot start with a '.'":"文件夹名称不能以“.” 开头",
};