/* 去除字符串中的特殊符号 */
const queryStr = (str) => {
    const pattern = new RegExp(/[`$%^&()\=<>"{}|\/;'\\[\]·￥%……&——\={}|]/g);
    if (pattern.test(str) == true) wx.showToast({
        title: '该符号不可输入!',
        icon: "none"
    })
    return str.replace(pattern, '');
}
/* 校验手机号码 */
const CheckPhoneNumber = (num) => {
    const reg = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/;
    let isAllow = reg.test(num);
    if (!isAllow) wx.showToast({
        title: '请输入正确的11位手机号码!',
        icon: "none"
    })
    return isAllow;
}
/* 校验邮箱 */
const CheckEmail = (num) => {
    const reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    let isAllow = reg.test(num);
    if (!isAllow) wx.showToast({
        title: '请输入正确的邮箱格式!',
        icon: "none"
    })
    return isAllow;
}
module.exports = {
    queryStr,
    CheckPhoneNumber,
    CheckEmail
}