1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-06 07:21:24 +08:00

Modify form validation in Add Transactions and Personal Profiles

This commit is contained in:
ggb
2023-06-09 23:55:26 +08:00
parent ada7039675
commit d6a2bf9729
2 changed files with 70 additions and 68 deletions

View File

@@ -241,19 +241,23 @@ export default {
},
checkEmail(rule, value, callback) {
const mailReg = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/
if (mailReg.test(value)) {
callback()
} else {
return callback(new Error('邮箱格式错误!'))
if (value != null) {
if (mailReg.test(value)) {
callback()
} else {
return callback(new Error('邮箱格式错误!'))
}
}
},
checkTel(rule, value, callback) {
const telReg =
/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
if (telReg.test(value)) {
callback()
} else {
return callback(new Error('手机号格式错误!'))
if (value != null) {
if (telReg.test(value)) {
callback()
} else {
return callback(new Error('手机号格式错误!'))
}
}
}
},