|
@@ -1,8 +1,23 @@
|
|
|
-module.exports.queryStr = function (str) {
|
|
|
+/* 去除字符串中的特殊符号 */
|
|
|
+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;
|
|
|
+}
|
|
|
+module.exports = {
|
|
|
+ queryStr,
|
|
|
+ CheckPhoneNumber
|
|
|
}
|