This commit is contained in:
caishi 2021-05-06 17:12:42 +08:00
parent ba81f51e76
commit 138db0b0cb
11 changed files with 278 additions and 55 deletions

View File

@ -6703,4 +6703,10 @@ ul.count_ul li:not(:last-child):after {
}
input.ant-input-lg::placeholder{
font-size: 14px !important;
}
.toprightNum{
position: absolute;
right: 0px;
top:4px;
color: #999;
}

View File

@ -0,0 +1,174 @@
import React ,{ forwardRef, useEffect, useState } from 'react';
import { Modal , Form , Input , Radio , Select } from 'antd';
import SearchUser from '../Component/SearchUser';
import './Index.scss';
import Axios from 'axios';
const { Option } = Select;
function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){
const { getFieldDecorator, validateFields , setFieldsValue } = form;
const [ cate , setCate ] = useState(0);
const [ value , setValue ] = useState(undefined);
const [ organizations , setOrganizations ] = useState(undefined);
useEffect(()=>{
setFieldsValue({goal:cate})
},[])
useEffect(()=>{
if(owner && repo && visible===true){
getTeam();
}
if(!visible){
setFieldsValue({
owner_name:undefined,
identifier:undefined
})
setValue(undefined)
}
},[repo,owner,visible])
function getTeam(){
const url = `/${owner}/${repo}/applied_transfer_projects/organizations.json`;
Axios.get(url).then(result=>{
if(result){
setOrganizations(result.data.organizations);
}
}).catch(error=>{})
}
//
function onOk(){
validateFields((error,values)=>{
console.log(...values);
if(!error){
const url = `/${owner}/${repo}/applied_transfer_projects.json`;
Axios.post(url,{
...values
}).then(result=>{
if(result){
onSuccess(result.data && result.data.owner);
}
}).catch(error=>{})
}
})
}
function changeType(e){
setCate(e.target.value);
setFieldsValue({
owner_name:undefined
})
}
function checkIdentifier(rule, value, callback){
if(!value){
callback();
}
if (repo && value !== repo) {
callback("请输入当前项目的标识!");
}
callback();
}
const layout = {
labelCol: { span: 5 },
wrapperCol: { span: 18 },
};
function getUser(id){
setValue(id);
setFieldsValue({
owner_name:id
})
}
return(
<Modal
width="620px"
visible={visible}
title="转移仓库"
onCancel={onCancel}
onOk={onOk}
okText="确认转移"
cancelText={"取消"}
centered
>
<div className="diverModal">
{
cate === 0 ?
<ul className="descUl">
<li>转移需对方确认接受转移成功后你将被移出仓库其他已有成员权限不变</li>
<li>转移成功后仓库的地址将变更至目标用户的命名空间下</li>
<li>已有成员如需继续操作仓库需更新本地仓库的remote使之指向新的地址</li>
</ul>
:
<ul className="descUl">
<li>仓库仅可以转移到您已经加入的组织中不可以转移到未加入的组织中</li>
<li>涉及到仓库改名操作请提前做好仓库备份并且在转移后对本地仓库的remote进行修改</li>
<li>转移仓库到组织后你和组织创建者/管理员同时拥有对该仓库的管理操作</li>
</ul>
}
<Form {...layout} colon={false} layout={"horizontal"}>
<Form.Item label="转移给:" style={{marginBottom:"0px"}}>
{getFieldDecorator("goal",{
rules:[]
})(
<Radio.Group onChange={changeType}>
<Radio value={0}>个人</Radio>
<Radio value={1}>组织</Radio>
</Radio.Group>
)}
</Form.Item>
{
cate === 0 &&
<Form.Item label=" ">
{getFieldDecorator("owner_name",{
rules:[{required:true,message:"请输入目标用户名"}]
})(
// <Input placeholder="" autoComplete={"off"}/>
<SearchUser getUser={getUser} width={"100%"} placeholder="请输入目标用户" value={value}/>
)}
</Form.Item>
}
{
cate === 1 &&
<Form.Item label=" ">
{getFieldDecorator("owner_name",
{rules:[{required:true,message:"请选择目标组织"}]}
)(
<Select placeholder="请选择目标组织" getPopupContainer={trigger => trigger.parentNode}>
{
organizations && organizations.length > 0 ?
organizations.map((i,k)=>{
return(
<Option value={i.name}>{i.nickname}</Option>
)
})
:""
}
</Select>
)}
</Form.Item>
}
<Form.Item label="仓库名称:">
{getFieldDecorator("identifier",
{
rules:[
{required:true,message:"请输入仓库名称"},
{
validator:checkIdentifier
}
]
}
)(
<Input placeholder="请输入仓库名称" autoComplete={"off"}/>
)}
</Form.Item>
</Form>
</div>
</Modal>
)
}
export default Form.create()(forwardRef(DivertModal));

View File

@ -2,16 +2,14 @@ import React, { Component } from 'react';
import AccountProfile from "../../modules/user/AccountProfile";
import { getImageUrl } from 'educoder'
import axios from 'axios';
import { Modal, Input, message, notification , Dropdown , Menu ,Divider } from 'antd';
import { Modal, Input, message, notification , Dropdown , Menu } from 'antd';
import LoginDialog from '../../modules/login/LoginDialog';
import GotoQQgroup from '../../modal/GotoQQgroup'
// import 'antd/lib/modal/style/index.css';
// import 'antd/lib/checkbox/style/index.css';
// import 'antd/lib/radio/style/index.css';
// import 'antd/lib/input/style/index.css';
import '../../modules/tpm/TPMIndex.css';
import logo from '../../modules/tpm/images/logo.png';
import './header.scss';
const $ = window.$
// TODO 这部分脚本从公共脚本中直接调用

View File

@ -5,7 +5,13 @@
background:#fff;
border-radius: 3px;
.ant-menu-vertical > .ant-menu-item{
border:none
border:none;
height: 35px;
line-height: 35px;
margin:0px;
}
.ant-menu-vertical{
border:none;
}
}

View File

@ -43,7 +43,8 @@ class Index extends Component {
project_language_name: undefined,
project_category_name: undefined,
license_name: undefined,
ignore_name: undefined
ignore_name: undefined,
descNum:0
}
}
componentDidMount = () => {
@ -254,6 +255,13 @@ class Index extends Component {
}
}
changeDesc=(e)=>{
let value = e.target.value;
this.setState({
descNum:value ? value.length :0
})
}
render() {
const { getFieldDecorator } = this.props.form;
// 项目类型deposit-托管项目mirror-镜像项目
@ -273,7 +281,9 @@ class Index extends Component {
license_list,
ignore_list,
mirrorCheck
mirrorCheck,
descNum
} = this.state;
return (
<div className="main back-white" style={{padding:"0px",border:"none"}}>
@ -361,21 +371,23 @@ class Index extends Component {
required: true, message: '请填写项目名称'
}],
})(
<Input placeholder="例如:团队协作方法与研究" />
)}
</Form.Item>
<Form.Item
label="项目简介"
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请填写项目简介'
}],
})(
<Input.TextArea placeholder="项目的介绍" autoSize={{ minRows: 2, maxRows: 6 }} />
<Input placeholder="例如:团队协作方法与研究" maxLength={50}/>
)}
</Form.Item>
<div className="pr">
<span className="toprightNum">{descNum}/200</span>
<Form.Item
label="项目简介"
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请填写项目简介'
}],
})(
<Input.TextArea maxLength={200} placeholder="项目的介绍" autoSize={{ minRows: 2, maxRows: 6 }} onChange={this.changeDesc}/>
)}
</Form.Item>
</div>
<Form.Item
label="仓库名称"
>
@ -384,7 +396,7 @@ class Index extends Component {
required: true, message: '请填写仓库名称'
}],
})(
<Input placeholder="仓库名称请使用与项目相关的英文关键字" />
<Input placeholder="仓库名称请使用与项目相关的英文关键字" maxLength={100} />
)}
</Form.Item>
<Form.Item

View File

@ -320,7 +320,7 @@ class order_form extends Component {
message: "请填写易修标题",
},
]
})(<Input placeholder="标题" size="large" />)}
})(<Input placeholder="标题" size="large" maxLength={80}/>)}
</Form.Item>
<div className="quillContent">
<MDEditor

View File

@ -24,6 +24,7 @@ export default Form.create()(
const [check_box, setCheckBox] = useState(false);
const [switch_box, setSwtichBox] = useState([]);
const [onwers, setOnwers] = useState(false);
const [ descNum , setDescNum ] = useState(0);
const [switch_box_code, setSwtichBoxCode] = useState(false);
const [switch_box_pull, setSwtichBoxPull] = useState(false);
const [switch_box_issue, setSwtichBoxIssue] = useState(false);
@ -39,6 +40,7 @@ export default Form.create()(
setFieldsValue({
...GroupDetail
})
setDescNum(GroupDetail.description ? GroupDetail.description.length : 0);
}
}, [GroupDetail])
@ -171,14 +173,19 @@ export default Form.create()(
[{ required: true, message: "请输入团队名称" }],
<Input placeholder="请输入团队名称"/>, true
)}
{helper(
<span className="mb5">团队描述<span className="color-grey-8">(描述团队的目的或作用)</span></span>,
"description",
[],
<TextArea
placeholder="请输入团队描述"
/>
)}
<div className="pr">
<span className="toprightNum">{descNum}/200</span>
{helper(
<span className="mb5">团队描述<span className="color-grey-8">(描述团队的目的或作用)</span></span>,
"description",
[],
<TextArea
placeholder="请输入团队描述"
maxLength={200}
onChange={(e)=>{setDescNum(e.target.value ? e.target.value.length :0)}}
/>
)}
</div>
{helper(
'项目权限:',

View File

@ -9,6 +9,8 @@ export default Form.create()(
forwardRef(({ form , showNotification , history })=>{
const [ image , setImage ] = useState(undefined);
const [ imageFlag , setImageFlag] = useState(false);
const [ descNum ,setDescNum ] = useState(0);
const { getFieldDecorator, validateFields , setFieldsValue } = form;
const radioStyle = {
display: 'block',
@ -86,7 +88,7 @@ export default Form.create()(
],
<Input
addonBefore={`https://`+ port ? `${hostname}:${port}/organize`:`${hostname}/organize`}
placeholder="组织账号"
placeholder="组织账号" maxLength={100}
/>
)}
{helper(
@ -94,24 +96,28 @@ export default Form.create()(
"nickname",
[{ required: true, message: "请输入组织名称" }],
<Input
placeholder="请输入组织名称"
placeholder="请输入组织名称" maxLength={100}
/>
)}
<div className="pr">
<span className="toprightNum">{descNum}/200</span>
{helper(
'组织描述',
"description",
[{ required: true, message: "请输入组织描述" }],
<Input.TextArea
autoSize={{ minRows: 3, maxRows: 5 }}
placeholder="请输入组织描述" maxLength={200}
onChange={(e)=>{setDescNum(e.target.value ? e.target.value.length :0)}}
/>
)}
</div>
{helper(
'组织描述',
"description",
[{ required: true, message: "请输入组织描述" }],
<Input.TextArea
autoSize={{ minRows: 3, maxRows: 5 }}
placeholder="请输入组织描述"
/>
)}
{helper(
'所在地区',
"location",
[],
<Input placeholder="请输入地址"/>,false
<Input placeholder="请输入地址" maxLength={50}/>,false
)}
{helper(
'可见性',

View File

@ -25,6 +25,7 @@ export default Form.create()(
const [ password , setPassword ] = useState(undefined);
const [ passwordFlag , setPasswordFlag ] = useState(false);
const [ visible , setVisible ] = useState(false);
const [ descNum , setDescNum ] = useState(0);
const { getFieldDecorator , validateFields , setFieldsValue } = form;
useEffect(()=>{
@ -33,6 +34,7 @@ export default Form.create()(
...organizeDetail
})
setImage(organizeDetail.avatar_url);
setDescNum(organizeDetail.description ? organizeDetail.description.length : 0);
}
},[organizeDetail])
@ -99,8 +101,8 @@ export default Form.create()(
if(!value){
callback();
}
if(value && !value.match(/^[a-zA-Z][a-zA-Z\d]{3,14}$/)){
callback("只能使用英文字母和数字以字母开头长度为4到15个字符");
if(value && !value.match(/^[a-zA-Z][a-zA-Z0-9_-]{3,19}$/)){
callback("只能使用以字母开头包含字母、数字、下划线、横杠等长度4到20个字符");
}
callback();
}
@ -119,20 +121,27 @@ export default Form.create()(
validator:checkname
}
],
<Input placeholder="请输入组织账号" />,true
<Input placeholder="请输入组织账号" maxLength={100} disabled/>,true
)}
{helper(
"组织名称:",
"nickname",
[{ required: true, message: "请输入组织名称" }],
<Input placeholder="请输入组织名称" />,true
)}
{helper(
"组织描述:",
"description",
[],
<TextArea placeholder="请输入组织名称" />
<Input placeholder="请输入组织名称" maxLength={100}/>,true
)}
<div className="pr">
<span className="toprightNum">{descNum}/200</span>
{helper(
"组织描述:",
"description",
[],
<TextArea
placeholder="请输入组织名称"
maxLength={200}
onChange={(e)=>{setDescNum(e.target.value ? e.target.value.length :0)}}
/>
)}
</div>
{helper(
"官方网站:",
"website",

View File

@ -29,7 +29,7 @@ $flex:flex;
& > div{
margin-bottom: 20px;
display: $flex;
align-items: flex-start;
align-items: center;
padding:20px 25px;
background-color:rgba(250,250,250,1);
.imgBox{
@ -52,6 +52,11 @@ $flex:flex;
font-size: 12px;
color: #888;
margin-top: 3px;
margin-bottom: 0px;
}
.teamdesc{
word-break: break-all;
line-height: 20px;
}
}
.infosType{

View File

@ -7,7 +7,7 @@ function TeamItem({item,history}){
<div className="imgBox"><img alt="" src={getImageUrl(`/${item.avatar_url}`)}/></div>
<div style={{flex:'1'}}>
<span className="mb5 font-18 color-grey-3 task-hide">{item.name}</span>
<div className="task-hide-2">
<div className="task-hide-2 teamdesc">
{item.description}
</div>
<p className="item-news">