fix: 测试报告模版名称特殊字符检查

This commit is contained in:
shiziyuan9527 2020-07-21 21:37:29 +08:00
parent c9b312600a
commit df2a6af6a4
4 changed files with 7 additions and 0 deletions

View File

@ -219,12 +219,16 @@
}); });
}, },
handleSave() { handleSave() {
let pattern = new RegExp("[`~!@#$^&*=|{}':;',<>/?~@#¥……&*()——|{}【】‘;:”“'。,、?]");
if (this.template.name == null || this.template.name == '') { if (this.template.name == null || this.template.name == '') {
this.$warning(this.$t('test_track.plan_view.input_template_name')); this.$warning(this.$t('test_track.plan_view.input_template_name'));
return; return;
} else if (this.template.name.length > 64) { } else if (this.template.name.length > 64) {
this.$warning(this.$t('commons.name') + this.$t('test_track.length_less_than') + '64'); this.$warning(this.$t('commons.name') + this.$t('test_track.length_less_than') + '64');
return; return;
} else if (pattern.test(this.template.name)) {
this.$warning(this.$t('test_track.plan_view.template_special_characters'));
return;
} }
let param = {}; let param = {};
this.buildParam(param); this.buildParam(param);

View File

@ -602,6 +602,7 @@ export default {
component_library_tip: "Drag and drop the component from the component library, add to the right, preview the report effect, only one can be added per system component.", component_library_tip: "Drag and drop the component from the component library, add to the right, preview the report effect, only one can be added per system component.",
delete_component_tip: "Please reserve at least one component", delete_component_tip: "Please reserve at least one component",
input_template_name: "Input template name", input_template_name: "Input template name",
template_special_characters: 'Template name does not support special characters',
case_count: "Case count", case_count: "Case count",
issues_count: "Issues count", issues_count: "Issues count",
result_statistics: "Result statistics", result_statistics: "Result statistics",

View File

@ -602,6 +602,7 @@ export default {
component_library_tip: "拖拽组件库中组件,添加至右侧,预览报告效果,每个系统组件只能添加一个。", component_library_tip: "拖拽组件库中组件,添加至右侧,预览报告效果,每个系统组件只能添加一个。",
delete_component_tip: "请至少保留一个组件", delete_component_tip: "请至少保留一个组件",
input_template_name: "输入模版名称", input_template_name: "输入模版名称",
template_special_characters: '模版名称不支持特殊字符',
case_count: "用例数", case_count: "用例数",
issues_count: "缺陷数", issues_count: "缺陷数",
result_statistics: "测试结果统计", result_statistics: "测试结果统计",

View File

@ -601,6 +601,7 @@ export default {
component_library_tip: "拖拽組件庫中組件,添加至右側,預覽報告效果,每個系統組件只能添加壹個。", component_library_tip: "拖拽組件庫中組件,添加至右側,預覽報告效果,每個系統組件只能添加壹個。",
delete_component_tip: "請至少保留壹個組件", delete_component_tip: "請至少保留壹個組件",
input_template_name: "輸入模版名稱", input_template_name: "輸入模版名稱",
template_special_characters: '模版名稱不支持特殊字符',
case_count: "用例數", case_count: "用例數",
issues_count: "缺陷數", issues_count: "缺陷數",
result_statistics: "測試結果統計", result_statistics: "測試結果統計",