标识check

This commit is contained in:
caishi 2023-09-25 14:26:36 +08:00
parent 8f76525579
commit 2cf9642cfa
1 changed files with 16 additions and 2 deletions

View File

@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
import { Form , Input , Row , Col, Button } from 'antd';
import '../index.scss';
import { postCreateZone } from '../api';
import cookie from 'react-cookies';
import axios from 'axios';
const { TextArea } = Input;
const phonereg = /^([1][3456789])\d{9}$/
@ -45,6 +45,17 @@ function Apply(props){
callback();
}
function checkId(rule,value,callback){
value ? axios.post(`/accounts/check_keywords`, {
text:value
}).then(response => {
if(response && response.data.data===false){
callback("与系统标识重复,请更改标识");
}
callback();
}):callback();
}
return(
<div className="applyBox">
@ -94,7 +105,10 @@ function Apply(props){
rules:[
{ required: true,message:"请输入专区域名标识" },
{ pattern: /^[a-zA-Z][a-zA-Z0-9_-]{0,18}[a-zA-Z]$/, message: "长度2-20只能包含数字、字母、下划线、中划线必须以字母开头结尾"},
]
{ validator:checkId }
],
validateTrigger:"onBlur",
validateFirst: true,
})(
<Input placeholder="请输入专区域名标识" maxLength={20} style={{height:"36px"}}/>
)}