You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
885 B
29 lines
885 B
// 手机正则
|
|
export function reg(params1,params2){
|
|
let phone = ''
|
|
let code = ''
|
|
|
|
let ret = /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/ // 手机正则
|
|
let intPattern = /^[0-9]*$/ // 整数正则
|
|
|
|
if(params1 === ''){
|
|
uni.showToast({title:'请输入手机号',icon:"none"})
|
|
}else if( !ret.test(params1) ){
|
|
console.log(params1)
|
|
uni.showToast({title:'手机号不正确',icon:"none"})
|
|
}else if(params2 === 0){
|
|
uni.showToast({title:'获取验证码',icon:"none"})
|
|
}else if( params2 === '' ){
|
|
uni.showToast({title:'请输入验证码',icon:"none"})
|
|
}else if( params2 !== 0 && !intPattern.test(params2) ){
|
|
uni.showToast({title:'验证码不正确',icon:"none"})
|
|
}else if( params2 !== 0 && intPattern.test(params2)){
|
|
phone = ret
|
|
code = intPattern
|
|
}else{
|
|
phone = ret
|
|
code = intPattern
|
|
}
|
|
|
|
return phone,code
|
|
}
|
|
|