Compare commits
2 Commits
4434ef0a58
...
prod-26-01
| Author | SHA1 | Date | |
|---|---|---|---|
| fde16ed45c | |||
| 516841b000 |
@@ -121,7 +121,7 @@ export default {
|
||||
let flag=this.validatePhone(val)
|
||||
// console.log('flag',flag)
|
||||
if(!flag){
|
||||
this.$toast('手机号格式不正确')
|
||||
this.$toast('电话号码格式不正确')
|
||||
}
|
||||
},
|
||||
validatePhone(val) {
|
||||
@@ -129,13 +129,22 @@ export default {
|
||||
if(!val){
|
||||
return true
|
||||
}
|
||||
const purePhone = val
|
||||
// 情况1:11位且1开头 → 合法
|
||||
if (/^1[0-9]{10}$/.test(purePhone)) {
|
||||
const purePhone = String(val).trim()
|
||||
const mobileReg = /^1[3-9]\d{9}$/ // 大陆手机号正则表达式
|
||||
const hkMobileReg = /^[569]\d{3}[\s-]?\d{4}$/ // 香港手机号正则表达式,允许使用空格或 "-" 分隔
|
||||
const macauMobileReg = /^6\d{3}[\s-]?\d{4}$/ // 澳门手机号正则表达式,允许使用空格或 "-" 分隔
|
||||
const telReg = /^(0\d{2,3})([\s-])?\d{7,8}$/ // 大陆座机号正则表达式,允许区号和座机号用空格或 "-" 分开
|
||||
const hkTelReg = /^\(?\d{2,4}\)?[\s-]?\d{4}[\s-]?\d{4}$/ // 香港座机号正则表达式,允许使用空格或 "-" 分隔
|
||||
const macauTelReg = /^\(?\d{2,4}\)?[\s-]?\d{4}[\s-]?\d{4}$/ // 澳门座机号正则表达式,允许使用空格或 "-" 分隔
|
||||
const phone400Reg = /^400[\s-]?\d{3}[\s-]?\d{4}$/ // 以 "400" 开头的号码正则表达式,允许使用空格或 "-" 分隔
|
||||
// 情况1:12位且首位是0、第二位是1 → 去0后按大陆手机号校验
|
||||
if (/^01[0-9]{10}$/.test(purePhone)) {
|
||||
return true
|
||||
}
|
||||
// 情况2:12位且首位是0、第二位是1 → 去0后合法
|
||||
if (/^01[0-9]{10}$/.test(purePhone)) {
|
||||
// 匹配任意一种格式即为合法
|
||||
if (mobileReg.test(purePhone) || hkMobileReg.test(purePhone) || macauMobileReg.test(purePhone) ||
|
||||
telReg.test(purePhone) || hkTelReg.test(purePhone) || macauTelReg.test(purePhone) ||
|
||||
phone400Reg.test(purePhone)) {
|
||||
return true
|
||||
}
|
||||
// 其他情况 → 不合法
|
||||
@@ -226,6 +235,7 @@ export default {
|
||||
console.log('phone1Flag',phone1Flag)
|
||||
console.log('phone2Flag',phone2Flag)
|
||||
if(!phone1Flag || !phone2Flag){
|
||||
this.$toast('电话号码格式不正确')
|
||||
return
|
||||
}
|
||||
await submitConfirm({supplierId:this.supplierId,infos:this.personList})
|
||||
|
||||
@@ -478,6 +478,21 @@ export default {
|
||||
otherPhoto:this.otherImgSrc?.join(',')
|
||||
})
|
||||
this.clearStorageFormInfo()
|
||||
if(res.code == 200 && !res.msg){
|
||||
this.$toast('发布成功')
|
||||
if(this.isWebFunc()){
|
||||
setTimeout(()=>{
|
||||
this.closeParentDialog()
|
||||
},1000)
|
||||
}else{
|
||||
setTimeout(()=>{
|
||||
this.$router.push({ name: "mineRelease"})
|
||||
sessionStorage.setItem('mineActiveTab',String(1) )
|
||||
},1000)
|
||||
}
|
||||
}else{
|
||||
this.$toast(res.msg)
|
||||
}
|
||||
console.log("车源发布publishCarInfo",res)
|
||||
} catch (e){
|
||||
console.log('e',e)
|
||||
|
||||
Reference in New Issue
Block a user