fix(项目设置): 修复环境配置导入非json格式报错提示多条问题

--bug=1034499 --user=王旭 【项目设置】环境配置-通用配置-导入变量-导入非json格式报错提示有两条 https://www.tapd.cn/55049933/s/1634418
This commit is contained in:
WangXu10 2024-12-19 13:45:31 +08:00 committed by Craftsman
parent 528ce3b750
commit 2cc45e88cb
6 changed files with 36 additions and 6 deletions

View File

@ -98,7 +98,9 @@ export default {
save() { save() {
if (this.uploadFiles.length > 0) { if (this.uploadFiles.length > 0) {
for (let i = 0; i < this.uploadFiles.length; i++) { for (let i = 0; i < this.uploadFiles.length; i++) {
this.uploadValidate(this.uploadFiles[i]); if (this.uploadValidate(this.uploadFiles[i])) {
return;
}
let file = this.uploadFiles[i]; let file = this.uploadFiles[i];
if (!file) { if (!file) {
continue; continue;
@ -139,10 +141,13 @@ export default {
const extension = file.name.substring(file.name.lastIndexOf('.') + 1); const extension = file.name.substring(file.name.lastIndexOf('.') + 1);
if (!(extension === 'json')) { if (!(extension === 'json')) {
this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit')); this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit'));
return true;
} }
if (file.size / 1024 / 1024 > 20) { if (file.size / 1024 / 1024 > 20) {
this.$warning(this.$t('api_test.api_import.file_size_limit')); this.$warning(this.$t('api_test.api_import.file_size_limit'));
return true;
} }
return false;
}, },
open() { open() {
this.dialogVisible = true; this.dialogVisible = true;

View File

@ -96,7 +96,9 @@ export default {
save() { save() {
if (this.uploadFiles.length > 0) { if (this.uploadFiles.length > 0) {
for (let i = 0; i < this.uploadFiles.length; i++) { for (let i = 0; i < this.uploadFiles.length; i++) {
this.uploadValidate(this.uploadFiles[i]); if(this.uploadValidate(this.uploadFiles[i])){
return;
}
let file = this.uploadFiles[i]; let file = this.uploadFiles[i];
if (!file) { if (!file) {
continue; continue;
@ -138,10 +140,13 @@ export default {
const extension = file.name.substring(file.name.lastIndexOf('.') + 1); const extension = file.name.substring(file.name.lastIndexOf('.') + 1);
if (!(extension === 'json')) { if (!(extension === 'json')) {
this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit')); this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit'));
return true;
} }
if (file.size / 1024 / 1024 > 20) { if (file.size / 1024 / 1024 > 20) {
this.$warning(this.$t('api_test.api_import.file_size_limit')); this.$warning(this.$t('api_test.api_import.file_size_limit'));
return true;
} }
return false;
}, },
open() { open() {
this.dialogVisible = true; this.dialogVisible = true;

View File

@ -94,7 +94,9 @@ export default {
save() { save() {
if (this.uploadFiles.length > 0) { if (this.uploadFiles.length > 0) {
for (let i = 0; i < this.uploadFiles.length; i++) { for (let i = 0; i < this.uploadFiles.length; i++) {
this.uploadValidate(this.uploadFiles[i]); if(this.uploadValidate(this.uploadFiles[i])){
return;
}
let file = this.uploadFiles[i]; let file = this.uploadFiles[i];
if (!file) { if (!file) {
continue; continue;
@ -136,10 +138,13 @@ export default {
const extension = file.name.substring(file.name.lastIndexOf('.') + 1); const extension = file.name.substring(file.name.lastIndexOf('.') + 1);
if (!(extension === 'json')) { if (!(extension === 'json')) {
this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit')); this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit'));
return true;
} }
if (file.size / 1024 / 1024 > 20) { if (file.size / 1024 / 1024 > 20) {
this.$warning(this.$t('api_test.api_import.file_size_limit')); this.$warning(this.$t('api_test.api_import.file_size_limit'));
return true;
} }
return false;
}, },
open() { open() {
this.dialogVisible = true; this.dialogVisible = true;

View File

@ -93,7 +93,9 @@ export default {
save() { save() {
if (this.uploadFiles.length > 0) { if (this.uploadFiles.length > 0) {
for (let i = 0; i < this.uploadFiles.length; i++) { for (let i = 0; i < this.uploadFiles.length; i++) {
this.uploadValidate(this.uploadFiles[i]); if (this.uploadValidate(this.uploadFiles[i])) {
return;
}
let file = this.uploadFiles[i]; let file = this.uploadFiles[i];
if (!file) { if (!file) {
continue; continue;
@ -133,10 +135,13 @@ export default {
const extension = file.name.substring(file.name.lastIndexOf('.') + 1); const extension = file.name.substring(file.name.lastIndexOf('.') + 1);
if (!(extension === 'json')) { if (!(extension === 'json')) {
this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit')); this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit'));
return true;
} }
if (file.size / 1024 / 1024 > this.uploadSize) { if (file.size / 1024 / 1024 > this.uploadSize) {
this.$warning(this.$t('api_test.api_import.file_size_limit', {size: this.uploadSize})); this.$warning(this.$t('api_test.api_import.file_size_limit', {size: this.uploadSize}));
return true
} }
return false;
}, },
open() { open() {
this.dialogVisible = true; this.dialogVisible = true;

View File

@ -86,7 +86,9 @@ export default {
save() { save() {
if (this.uploadFiles.length > 0) { if (this.uploadFiles.length > 0) {
for (let i = 0; i < this.uploadFiles.length; i++) { for (let i = 0; i < this.uploadFiles.length; i++) {
this.uploadValidate(this.uploadFiles[i]); if (this.uploadValidate(this.uploadFiles[i])) {
return;
}
let file = this.uploadFiles[i]; let file = this.uploadFiles[i];
if (!file) { if (!file) {
continue; continue;
@ -133,10 +135,13 @@ export default {
const extension = file.name.substring(file.name.lastIndexOf('.') + 1); const extension = file.name.substring(file.name.lastIndexOf('.') + 1);
if (!(extension === 'json')) { if (!(extension === 'json')) {
this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit')); this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit'));
return true;
} }
if (file.size / 1024 / 1024 > this.uploadSize) { if (file.size / 1024 / 1024 > this.uploadSize) {
this.$warning(this.$t('api_test.api_import.file_size_limit', {size: this.uploadSize})); this.$warning(this.$t('api_test.api_import.file_size_limit', {size: this.uploadSize}));
return true;
} }
return false;
}, },
open() { open() {
this.dialogVisible = true; this.dialogVisible = true;

View File

@ -81,7 +81,9 @@ export default {
save() { save() {
if (this.uploadFiles.length > 0) { if (this.uploadFiles.length > 0) {
for (let i = 0; i < this.uploadFiles.length; i++) { for (let i = 0; i < this.uploadFiles.length; i++) {
this.uploadValidate(this.uploadFiles[i]); if (this.uploadValidate(this.uploadFiles[i])) {
return;
}
let file = this.uploadFiles[i]; let file = this.uploadFiles[i];
if (!file) { if (!file) {
continue; continue;
@ -118,10 +120,13 @@ export default {
const extension = file.name.substring(file.name.lastIndexOf('.') + 1); const extension = file.name.substring(file.name.lastIndexOf('.') + 1);
if (!(extension === 'json')) { if (!(extension === 'json')) {
this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit')); this.$warning(this.$t('api_test.api_import.ms_env_import_file_limit'));
return true;
} }
if (file.size / 1024 / 1024 > 20) { if (file.size / 1024 / 1024 > 20) {
this.$warning(this.$t('api_test.api_import.file_size_limit')); this.$warning(this.$t('api_test.api_import.file_size_limit'));
return true;
} }
return false;
}, },
open() { open() {
this.dialogVisible = true; this.dialogVisible = true;