dev_forge
caicai8 5 years ago
parent a7dd5275e1
commit 59c71c69b2

@ -44,22 +44,22 @@ class CoderRootDirectory extends Component{
})
}
getUserInfo=()=>{
const url = `/users/me.json`;
axios.get(url).then(result=>{
if(result && result.data.login){
this.setState({
current_user:result.data
})
this.getProjectRoot();
}
}).catch(error=>{
console.log(error)
})
}
// getUserInfo=()=>{
// const url = `/users/me.json`;
// axios.get(url).then(result=>{
// if(result && result.data.login){
// this.setState({
// current_user:result.data
// })
// this.getProjectRoot();
// }
// }).catch(error=>{
// console.log(error)
// })
// }
componentDidMount=()=>{
this.getUserInfo();
// this.getUserInfo();
let { search } = this.props.history.location;
let branchName = undefined;
if(search && search.indexOf("branch")>-1){

@ -277,7 +277,7 @@ class Detail extends Component{
{/* 仓库设置 */}
<Route path="/projects/:projectsId/setting"
render={
(props) => (<Setting {...this.props} {...props} {...this.state}/>)
(props) => (<Setting {...this.props} {...props} {...this.state} getDetail={this.getDetail}/>)
}
></Route>
{/* 工单详情 */}

@ -5,17 +5,44 @@ import axios from 'axios';
const { Option } = AutoComplete;
const MENU_LIST = ['管理员','可读权限','可写权限'];
const LIMIT = 15;
class Collaborator extends Component{
constructor(props){
super(props);
this.state={
userDataSource:undefined
user:undefined,
userDataSource:undefined,
page:1
}
}
componentDidMount=()=>{
this.getMember();
}
// 获取项目协作者
getMember=()=>{
const { page } = this.state;
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/members.json`;
axios.get(url,{
params:{
page,limit:LIMIT
}
}).then(result=>{
if(result){
}
}).catch(error=>{
console.log(error);
})
}
// 选择用户
changeInputUser=(e)=>{
console.log(e);
this.setState({
user:e
})
const url = `/users/list.json`;
axios.get(url,{
params:{
@ -35,8 +62,24 @@ class Collaborator extends Component{
changeOperaiton=(e,id)=>{
console.log(e,id);
}
// 增加协作者
addCollaborator=()=>{
const { projectsId } = this.props.match.params;
const { user } = this.state;
const url = `/projects/${projectsId}/members.json`;
axios.post(url,{
user_id:user
}).then(result=>{
if(result){
this.changeInputUser();
}
}).catch(error=>{
console.log(error);
})
}
render(){
const { userDataSource } = this.state;
const { user , userDataSource } = this.state;
const menu =(id)=> (
<Menu>
@ -56,32 +99,36 @@ class Collaborator extends Component{
)
})
return(
<div className="normalBox">
<div className="normalBox-title font-16">
协作者
</div>
<div className="collaboratorList">
<div className="collaboratorItem">
<span><Link to={``} className="color-blue">caicai</Link></span>
<span>
<Dropdown overlay={menu(1)} placement={"bottomCenter"}>
<span>管理员<Icon type="down" /></span>
</Dropdown>
</span>
<span style={{justifyContent:"center"}}>
<a className="red_btn">删除</a>
</span>
<div>
<div className="normalBox">
<div className="normalBox-title font-16">
协作者
</div>
<div className="collaboratorList">
<div className="collaboratorItem">
<span><Link to={``} className="color-blue">caicai</Link></span>
<span>
<Dropdown overlay={menu(1)} placement={"bottomCenter"}>
<span>管理员<Icon type="down" /></span>
</Dropdown>
</span>
<span style={{justifyContent:"center"}}>
<a className="red_btn">删除</a>
</span>
</div>
</div>
<div className="addPanel">
<AutoComplete
value={user}
dataSource={source}
style={{ width: 200 }}
onChange={this.changeInputUser}
placeholder="搜索用户"
/>
<a className="small_submitBtn ml20" onClick={this.addCollaborator}>增加协作者</a>
</div>
</div>
<div className="addPanel">
<AutoComplete
dataSource={source}
style={{ width: 200 }}
onChange={this.changeInputUser}
placeholder="搜索用户"
/>
<a className="small_submitBtn ml20" onClick={this.addCollaborator}>增加协作者</a>
</div>
</div>
)
}

@ -8,8 +8,6 @@ class Setting extends Component{
constructor(props){
super(props);
this.state={
Language:"1",
Category:"1",
CategoryList:undefined,
LanguageList:undefined,
}
@ -78,12 +76,16 @@ class Setting extends Component{
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}.json`;
axios.patch(url,{
name:values.project_name,
description:values.project_description,
...values
params:{
name:values.project_name,
description:values.project_description,
...values
}
}).then(result=>{
if(result){
this.props.showNotification(`仓库信息修改成功!`)
this.props.showNotification(`仓库信息修改成功!`);
const { getDetail } = this.props;
getDetail && getDetail();
}
}).catch(error=>{
console.log(error);
@ -92,78 +94,106 @@ class Setting extends Component{
})
}
// 删除本仓库
deleteProject=()=>{
this.props.confirm({
content:"删除后无法恢复,是否确认删除本仓库?",
onOk:()=>{
const url = ``;
axios.delete(url).then(result=>{
this.props.showNotification("仓库删除成功!");
this.props.history.push("/projects");
}).catch(error=>{
console.log(error);
})
}
})
}
render(){
const { getFieldDecorator } = this.props.form;
const { Category , Language , CategoryList , LanguageList } = this.state;
const { CategoryList , LanguageList } = this.state;
return(
<div className="normalBox">
<div className="normalBox-title font-16">
基本设置
</div>
<Form className="baseForm">
<Form.Item
label="项目名称"
>
{getFieldDecorator('project_name', {
rules: [{
required: true, message: '请输入项目名称'
}],
})(
<Input placeholder="请输入项目名称"/>
)}
</Form.Item >
<div className="df" style={{alignItems:"center"}}>
<span className="mr20 mb15 font-16">可见性</span>
<Form.Item
label=""
>
{getFieldDecorator('private', {
rules: [],
})(
<Checkbox >将仓库设为私有</Checkbox>
)}
</Form.Item >
<div>
<div className="normalBox">
<div className="normalBox-title font-16">
基本设置
</div>
<Form.Item
label="仓库描述"
>
{getFieldDecorator('project_description', {
rules: [],
})(
<TextArea placeholder="请输入仓库描述" style={{height:"80px"}}/>
)}
</Form.Item >
<Form.Item
label="项目类别"
>
{getFieldDecorator('project_category_id', {
<Form className="baseForm">
<Form.Item
label="项目名称"
>
{getFieldDecorator('project_name', {
rules: [{
required: true, message: '请选择大类别'
required: true, message: '请输入项目名称'
}],
})(
<Select>
{CategoryList}
</Select>
<Input placeholder="请输入项目名称"/>
)}
</Form.Item>
<Form.Item
label="项目语言"
>
{getFieldDecorator('project_language_id', {
rules: [{
required: true, message: '请选择项目语言'
}],
</Form.Item >
<div className="df" style={{alignItems:"center"}}>
<span className="mr20 mb15 font-16">可见性</span>
<Form.Item
label=""
>
{getFieldDecorator('private', {
rules: [],
})(
<Checkbox >将仓库设为私有</Checkbox>
)}
</Form.Item >
</div>
<Form.Item
label="仓库描述"
>
{getFieldDecorator('project_description', {
rules: [],
})(
<Select>
{LanguageList}
</Select>
<TextArea placeholder="请输入仓库描述" style={{height:"80px"}}/>
)}
</Form.Item>
<p className="clearfix">
<a className="submitBtn" onClick={this.resetSetting}>更新仓库设置</a>
</p>
</Form>
</Form.Item >
<Form.Item
label="项目类别"
>
{getFieldDecorator('project_category_id', {
rules: [{
required: true, message: '请选择大类别'
}],
})(
<Select>
{CategoryList}
</Select>
)}
</Form.Item>
<Form.Item
label="项目语言"
>
{getFieldDecorator('project_language_id', {
rules: [{
required: true, message: '请选择项目语言'
}],
})(
<Select>
{LanguageList}
</Select>
)}
</Form.Item>
<p className="clearfix">
<a className="submitBtn" onClick={this.resetSetting}>更新仓库设置</a>
</p>
</Form>
</div>
<div className="dangerousBox">
<div className="dangerousTitle">危险操作区</div>
<div className="flex-a-center padding15-10">
<div>
<p className="font-bd font-16">删除本仓库</p>
<p className="mt10">删除仓库是永久性的, 无法撤消</p>
</div>
<a onClick={this.deleteProject} className="red_deleteBtn">删除本仓库</a>
</div>
</div>
</div>
)
}

@ -72,4 +72,33 @@
.branchSelect{
width: 200px;
height: 32px;
}
.dangerousBox{
border:1px solid #efc16b;
border-radius: 4px;
margin-top: 20px;
}
.dangerousTitle{
padding:10px;
background: #f9edbe;
line-height: 18px;
}
.red_deleteBtn{
display: block;
height: 38px;
line-height: 38px;
border:1px solid #db2828;
border-radius: 4px;
color: #db2828;
padding:0px 15px;
font-size: 16px;
}
.flex-a-center{
display: flex;
justify-content: space-between;
align-items: center;
}
.padding15-10{
padding:15px 10px;
}
Loading…
Cancel
Save