forked from Gitlink/forgeplus-react
新增组织账号,组织名称增加新的check条件
This commit is contained in:
parent
70ea6259ae
commit
bcaec7a2db
|
@ -1,15 +1,15 @@
|
|||
import React,{ forwardRef , useCallback , useEffect, useState } from 'react';
|
||||
import './Index.scss';
|
||||
import { Form , Input , Radio , Checkbox , Button, InputNumber } from "antd";
|
||||
import { Form , Input , Radio , Checkbox , Button } from "antd";
|
||||
import UploadImage from './Component/UploadImage';
|
||||
import axios from 'axios';
|
||||
|
||||
const port = window.location.port;
|
||||
const hostname = window.location.hostname;
|
||||
export default Form.create()(
|
||||
forwardRef(({ form , showNotification , history })=>{
|
||||
const [ image , setImage ] = useState(undefined);
|
||||
const [ imageFlag , setImageFlag] = useState(false);
|
||||
const { getFieldDecorator, validateFields , setFieldsValue } = form;
|
||||
|
||||
const radioStyle = {
|
||||
display: 'block',
|
||||
height: '30px',
|
||||
|
@ -60,19 +60,44 @@ export default Form.create()(
|
|||
})
|
||||
},[])
|
||||
|
||||
function checkname(rule, value, callback){
|
||||
if(!value){
|
||||
callback();
|
||||
}
|
||||
if(value && !value.match(/^[a-zA-Z][a-zA-Z\d]{3,14}$/)){
|
||||
callback("只能使用英文字母和数字,以字母开头,长度为4到15个字符");
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
return(
|
||||
<div className="main">
|
||||
<div className="teamBox">
|
||||
<p className="teamBox-title">新建组织</p>
|
||||
<Form className="teamBox-form">
|
||||
{helper(
|
||||
<span>组织名称:<span className="color-grey-8">(组织名称应该简单明了)</span></span>,
|
||||
<span>组织账号:</span>,
|
||||
"name",
|
||||
[
|
||||
{ required: true, message: "请输入组织账号" },
|
||||
{
|
||||
validator:checkname
|
||||
}
|
||||
],
|
||||
<Input
|
||||
addonBefore={`https://`+ port ? `${hostname}:${port}/organize`:`${hostname}/organize`}
|
||||
placeholder="组织账号"
|
||||
/>
|
||||
)}
|
||||
{helper(
|
||||
<span>组织名称:</span>,
|
||||
"nickname",
|
||||
[{ required: true, message: "请输入组织名称" }],
|
||||
<Input
|
||||
placeholder="请输入组织名称"
|
||||
/>
|
||||
)}
|
||||
|
||||
{helper(
|
||||
'组织描述',
|
||||
"description",
|
||||
|
|
|
@ -95,6 +95,15 @@ export default Form.create()(
|
|||
})
|
||||
setVisible(false);
|
||||
}
|
||||
function checkname(rule, value, callback){
|
||||
if(!value){
|
||||
callback();
|
||||
}
|
||||
if(value && !value.match(/^[a-zA-Z][a-zA-Z\d]{3,14}$/)){
|
||||
callback("只能使用英文字母和数字,以字母开头,长度为4到15个字符");
|
||||
}
|
||||
callback();
|
||||
}
|
||||
return(
|
||||
<div>
|
||||
<WhiteBack>
|
||||
|
@ -102,8 +111,19 @@ export default Form.create()(
|
|||
<Div>
|
||||
<Form>
|
||||
{helper(
|
||||
"组织名称:",
|
||||
"组织账号:",
|
||||
"name",
|
||||
[
|
||||
{ required: true, message: "请输入组织账号" },
|
||||
{
|
||||
validator:checkname
|
||||
}
|
||||
],
|
||||
<Input placeholder="请输入组织账号" />,true
|
||||
)}
|
||||
{helper(
|
||||
"组织名称:",
|
||||
"nickname",
|
||||
[{ required: true, message: "请输入组织名称" }],
|
||||
<Input placeholder="请输入组织名称" />,true
|
||||
)}
|
||||
|
|
|
@ -78,7 +78,7 @@ function Detail(props){
|
|||
detail &&
|
||||
<Cards
|
||||
src={`/organize/${detail.name}`}
|
||||
title={detail.name}
|
||||
title={detail.nickname}
|
||||
desc={!buttonflag && detail.description}
|
||||
img={detail.avatar_url}
|
||||
rightBtn={
|
||||
|
|
|
@ -56,7 +56,7 @@ export default ((props)=>{
|
|||
detail &&
|
||||
<Cards
|
||||
src={`/organize/${OIdentifier}/group/${groupId}`}
|
||||
title={detail.name}
|
||||
title={detail.nickname}
|
||||
rightBtn={
|
||||
flag && <span className="subNavs">
|
||||
<Link to={`/organize/${OIdentifier}/member`} className={pathname ===`/organize/${OIdentifier}/member` ? "active":""}><span>组织成员</span>{detail.num_users && <lable>{detail.num_users}</lable>}</Link>
|
||||
|
|
|
@ -1366,10 +1366,6 @@ samp {
|
|||
line-height: 40px;
|
||||
}
|
||||
|
||||
.courseForm .ant-input-group>.ant-input:first-child,
|
||||
.ant-input-group-addon:first-child {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.courseForm .ant-select-selection,
|
||||
.courseForm .ant-select-selection-selected-value {
|
||||
|
@ -1722,12 +1718,6 @@ samp {
|
|||
background-color: #fff !important;
|
||||
}
|
||||
|
||||
.ant-input-group-addon {
|
||||
color: #666 !important;
|
||||
font-size: 12px;
|
||||
border: 1px solid #d9d9d9 !important;
|
||||
border-left: none !important;
|
||||
}
|
||||
|
||||
.check_on {
|
||||
background: #4CACFF;
|
||||
|
|
Loading…
Reference in New Issue