| | |
| | | }) |
| | | } else if (item.regular === 'phone') { |
| | | item.rules.push({ |
| | | pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, |
| | | pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\s?\d{4}\s?\d{4}$/, |
| | | message: item.regularText || dict['phone_error'] || '请正确输入手机号' |
| | | }) |
| | | } else if (item.regular === 'email') { |
| | |
| | | } else if (['text', 'textarea', 'linkMain'].includes(item.type)) { |
| | | _item.value = _item.value + '' |
| | | _item.value = _item.value.replace(/\t+|\v+/g, '') // 去除制表符 |
| | | |
| | | |
| | | if (item.interception !== 'false') { // 去除首尾空格 |
| | | if (item.interception === 'func') { |
| | | try { |
| | |
| | | _item.value = _item.value.replace(/(^\s*|\s*$)/g, '') |
| | | } |
| | | } |
| | | if (item.type === 'text' && /@appkey@|@SessionUid@|@bid@/ig.test(_item.value)) { // 特殊字段替换 |
| | | _item.value = _item.value.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (this.props.BID || '')) |
| | | } |
| | | if (item.type === 'text' && item.lenControl && item.lenControl !== 'limit') { |
| | | if (item.lenControl === 'left') { |
| | | _item.value = _item.value.substr(0, item.fieldlength) |
| | | } else { |
| | | _item.value = _item.value.slice(-item.fieldlength) |
| | | if (item.type === 'text') { |
| | | if (/@appkey@|@SessionUid@|@bid@/ig.test(_item.value)) { // 特殊字段替换 |
| | | _item.value = _item.value.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (this.props.BID || '')) |
| | | } |
| | | if (item.lenControl && item.lenControl !== 'limit') { |
| | | if (item.lenControl === 'left') { |
| | | _item.value = _item.value.substr(0, item.fieldlength) |
| | | } else { |
| | | _item.value = _item.value.slice(-item.fieldlength) |
| | | } |
| | | } |
| | | if (item.regular === 'phone') { |
| | | _item.value = _item.value.replace(/\s+/g, '') |
| | | } |
| | | } |
| | | } else if (item.type === 'datemonth') { |