diff --git a/src/forge/Information/Pages/apply.jsx b/src/forge/Information/Pages/apply.jsx index 9f3515eab..5f020e6eb 100644 --- a/src/forge/Information/Pages/apply.jsx +++ b/src/forge/Information/Pages/apply.jsx @@ -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(
@@ -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, })( )}