diff --git a/common/util.js b/common/util.js index c5e121b..4e43d13 100644 --- a/common/util.js +++ b/common/util.js @@ -64,8 +64,26 @@ const base = { // 验证手机号 isMobile : (phoneNumber) => { - const regex = /^1[3-9]\d{9}$/; - return regex.test(phoneNumber); + return /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(phoneNumber) + }, + isMail (val) { + return /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(val) + }, + // 整数 + isInteger(str) { + // 正则表达式,用于匹配整数,包括带正号的情况 + const regex = /^[+-]?\d+$/; + + // 测试字符串是否匹配正则表达式 + return regex.test(str); + }, + // 数字 + isNumber(str) { + // 正则表达式,用于匹配数字 + const regex = /^-?\d+(\.\d+)?$/; + + // 测试字符串是否匹配正则表达式 + return regex.test(str); }, // 分享 shareInfo : () => { diff --git a/components/applyForm/index.vue b/components/applyForm/index.vue index 63f29d6..d9cc773 100644 --- a/components/applyForm/index.vue +++ b/components/applyForm/index.vue @@ -12,8 +12,8 @@ @click="showSelect(item,index)" /> - -