正则式统一类
This commit is contained in:
15
src/components/utils/regular.js
Normal file
15
src/components/utils/regular.js
Normal file
@@ -0,0 +1,15 @@
|
||||
export default {
|
||||
phone: /^((0\d{2,3}-\d{7,8})|((13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}))$/,
|
||||
password: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*,.?_-])[\da-zA-Z~!@#$%^&*,.?_-]{8,16}$/,
|
||||
money: /^([1-9]\d*|0)(\.\d{1,2})?$/,
|
||||
area: {
|
||||
village: /^\d{9}[^0]0{0,2}$/,
|
||||
town: /^\d{6}[^0]0{0,2}000$/,
|
||||
country: /^\d{4}[^0]0?0{6}$/,
|
||||
city: /^\d{2}[^0]0?0{8}$/,
|
||||
province: /^[^0]0?0{10}$/,
|
||||
},
|
||||
zh: /^[\u4e00-\u9fa5]+$/,
|
||||
email: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
|
||||
ip: /((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import $dayjs from './moment'
|
||||
import $dict from './dict'
|
||||
import $qs from 'query-string'
|
||||
import $coin from './coin'
|
||||
import $reg from "./regular"
|
||||
|
||||
const $toast = (obj) => {
|
||||
let params = {title: '', duration: 2000, icon: 'none'};
|
||||
@@ -92,7 +93,7 @@ const $getUserProfile = () => {
|
||||
success: (data) => {
|
||||
resolve(data);
|
||||
},
|
||||
fail: (err)=> {
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
@@ -347,5 +348,6 @@ export default {
|
||||
$dict,
|
||||
$getLoginCode,
|
||||
$qs,
|
||||
$coin
|
||||
$coin,
|
||||
$reg
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user