From bcaec7a2db78e42dbfa6c96a84530917332fd5db Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 6 Apr 2021 18:40:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BB=84=E7=BB=87=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=EF=BC=8C=E7=BB=84=E7=BB=87=E5=90=8D=E7=A7=B0=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=96=B0=E7=9A=84check=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Team/New.jsx | 33 +++++++++++++++++--- src/forge/Team/Setting/TeamSettingCommon.jsx | 22 ++++++++++++- src/forge/Team/Sub/Detail.jsx | 2 +- src/forge/Team/Sub/SubDetail.jsx | 2 +- src/modules/courses/css/Courses.css | 10 ------ 5 files changed, 52 insertions(+), 17 deletions(-) diff --git a/src/forge/Team/New.jsx b/src/forge/Team/New.jsx index f314cfa8..cd3de57c 100644 --- a/src/forge/Team/New.jsx +++ b/src/forge/Team/New.jsx @@ -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(

新建组织

{helper( - 组织名称:(组织名称应该简单明了), + 组织账号:, "name", + [ + { required: true, message: "请输入组织账号" }, + { + validator:checkname + } + ], + + )} + {helper( + 组织名称:, + "nickname", [{ required: true, message: "请输入组织名称" }], )} + {helper( '组织描述', "description", diff --git a/src/forge/Team/Setting/TeamSettingCommon.jsx b/src/forge/Team/Setting/TeamSettingCommon.jsx index b161e5a1..1c44a150 100644 --- a/src/forge/Team/Setting/TeamSettingCommon.jsx +++ b/src/forge/Team/Setting/TeamSettingCommon.jsx @@ -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(
@@ -102,8 +111,19 @@ export default Form.create()(
{helper( - "组织名称:", + "组织账号:", "name", + [ + { required: true, message: "请输入组织账号" }, + { + validator:checkname + } + ], + ,true + )} + {helper( + "组织名称:", + "nickname", [{ required: true, message: "请输入组织名称" }], ,true )} diff --git a/src/forge/Team/Sub/Detail.jsx b/src/forge/Team/Sub/Detail.jsx index 3979c4c4..bba0b7de 100644 --- a/src/forge/Team/Sub/Detail.jsx +++ b/src/forge/Team/Sub/Detail.jsx @@ -78,7 +78,7 @@ function Detail(props){ detail && { detail && 组织成员{detail.num_users && {detail.num_users}} diff --git a/src/modules/courses/css/Courses.css b/src/modules/courses/css/Courses.css index 0e1eb09d..f23de670 100644 --- a/src/modules/courses/css/Courses.css +++ b/src/modules/courses/css/Courses.css @@ -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;