diff --git a/src/components/uploadFile.vue b/src/components/uploadFile.vue index 94157dd..d4b0b16 100644 --- a/src/components/uploadFile.vue +++ b/src/components/uploadFile.vue @@ -261,7 +261,9 @@ return } // 文件名称不能包含特殊字符 - if (!this.$verify.specialChar(param.file.name)) { + let filename = param.file.name + let name = filename.substring(0, filename.lastIndexOf(".")) + if (this.$verify.specialCharNew(name)) { this.$message.error('文件名称包含非法字符,请重新上传!') return } diff --git a/src/pages/mediation-page/components/caseFileDialog.vue b/src/pages/mediation-page/components/caseFileDialog.vue index e8a94e5..6649907 100644 --- a/src/pages/mediation-page/components/caseFileDialog.vue +++ b/src/pages/mediation-page/components/caseFileDialog.vue @@ -109,13 +109,7 @@ export default { } }) this.repaymentObj.name = this.fileList.length?this.fileList[0].objectName : ''; - if (!this.$verify.specialChar(this.repaymentObj.name)) { - this.$message.error('文件名称包含非法字符,请重新上传!') - return false - } this.repaymentObj.url = this.fileList.length?this.fileList[0].fileName : ''; - - console.log(this.repaymentObj, '---this.repaymentObj', this.fileList) }, handleClose() { this.$emit('update:eventDialog', null) diff --git a/src/utils/verify.js b/src/utils/verify.js index 8c95609..46b75ca 100644 --- a/src/utils/verify.js +++ b/src/utils/verify.js @@ -35,7 +35,13 @@ function specialChar(value) { return /^[^~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、]+$/ .test(value) } - +/** + * 验证特殊字符格式 + */ +function specialCharNew(value) { + return /[ \n\t&V:?"#*|&<>%'+]/ + .test(value) +} /** * 替换特殊字符格式 */ @@ -222,5 +228,6 @@ export default { specialCharRep, postalCode, specialChar, + specialCharNew, judgeCard }