|
|
@ -7,16 +7,31 @@ export function reg(params1,params2){ |
|
|
let intPattern = /^[0-9]*$/ // 整数正则
|
|
|
let intPattern = /^[0-9]*$/ // 整数正则
|
|
|
|
|
|
|
|
|
if (params1 === '') { |
|
|
if (params1 === '') { |
|
|
uni.showToast({title:'请输入手机号',icon:"none"}) |
|
|
uni.showToast({ |
|
|
|
|
|
title: '请输入手机号', |
|
|
|
|
|
icon: "none" |
|
|
|
|
|
}) |
|
|
} else if (!ret.test(params1)) { |
|
|
} else if (!ret.test(params1)) { |
|
|
console.log(params1) |
|
|
console.log(params1) |
|
|
uni.showToast({title:'手机号不正确',icon:"none"}) |
|
|
uni.showToast({ |
|
|
|
|
|
title: '手机号不正确', |
|
|
|
|
|
icon: "none" |
|
|
|
|
|
}) |
|
|
} else if (params2 === 0) { |
|
|
} else if (params2 === 0) { |
|
|
uni.showToast({title:'获取验证码',icon:"none"}) |
|
|
uni.showToast({ |
|
|
|
|
|
title: '获取验证码', |
|
|
|
|
|
icon: "none" |
|
|
|
|
|
}) |
|
|
} else if (params2 === '') { |
|
|
} else if (params2 === '') { |
|
|
uni.showToast({title:'请输入验证码',icon:"none"}) |
|
|
uni.showToast({ |
|
|
|
|
|
title: '请输入验证码', |
|
|
|
|
|
icon: "none" |
|
|
|
|
|
}) |
|
|
} else if (params2 !== 0 && !intPattern.test(params2)) { |
|
|
} else if (params2 !== 0 && !intPattern.test(params2)) { |
|
|
uni.showToast({title:'验证码不正确',icon:"none"}) |
|
|
uni.showToast({ |
|
|
|
|
|
title: '验证码不正确', |
|
|
|
|
|
icon: "none" |
|
|
|
|
|
}) |
|
|
} else if (params2 !== 0 && intPattern.test(params2)) { |
|
|
} else if (params2 !== 0 && intPattern.test(params2)) { |
|
|
phone = ret |
|
|
phone = ret |
|
|
code = intPattern |
|
|
code = intPattern |
|
|
@ -27,6 +42,23 @@ export function reg(params1,params2){ |
|
|
|
|
|
|
|
|
return phone, code |
|
|
return phone, code |
|
|
} |
|
|
} |
|
|
|
|
|
//名称脱敏
|
|
|
|
|
|
export function maskShopName(str) { |
|
|
|
|
|
var reg = /^(.).+(.)$/g; |
|
|
|
|
|
if (str != null && str != "") { |
|
|
|
|
|
if (str.length < 4) { |
|
|
|
|
|
str = str.replace(reg, "$1*$2"); |
|
|
|
|
|
} else { |
|
|
|
|
|
str = str.replace(reg, "$1***$2"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
console.log('1111111111',str) |
|
|
|
|
|
return str; |
|
|
|
|
|
} |
|
|
|
|
|
//电话脱敏
|
|
|
|
|
|
export function maskPhone(phone) { |
|
|
|
|
|
return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2'); |
|
|
|
|
|
} |
|
|
/** |
|
|
/** |
|
|
* 省市区、自治区分割 |
|
|
* 省市区、自治区分割 |
|
|
*/ |
|
|
*/ |
|
|
@ -96,4 +128,3 @@ export function getArea(str) { |
|
|
|
|
|
|
|
|
return area; |
|
|
return area; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|