dev_forge
caicai8 5 years ago
parent f9bdbdc549
commit bffbed9742

@ -278,7 +278,7 @@ class Detail extends Component{
isManager && isManager &&
<li className={url.indexOf("setting")>0 ? "active" : ""}><Link to={`/projects/${projectsId}/setting`}>仓库设置</Link></li> <li className={url.indexOf("setting")>0 ? "active" : ""}><Link to={`/projects/${projectsId}/setting`}>仓库设置</Link></li>
} }
{/* <li className={url.indexOf("setting")>0 ? "active" : ""}><Link to={`/projects/${projectsId}/setting`}>仓库设置</Link></li> */} <li className={url.indexOf("setting")>0 ? "active" : ""}><Link to={`/projects/${projectsId}/setting`}>仓库设置</Link></li>
</ul> </ul>
</div> </div>
</div> </div>

@ -60,26 +60,16 @@ class Collaborator extends Component{
console.log(error); console.log(error);
}) })
} }
// 选择用户 // 输入用户
changeInputUser=(e)=>{ changeInputUser=(e)=>{
console.log(e);
this.setState({
user:e
})
this.getUserList(e); this.getUserList(e);
} }
changeUser=(e)=>{ // 选择用户
console.log("click",e); selectInputUser=(e,option)=>{
this.setState({
user_id:e,
})
}
serachUser=(e)=>{
console.log("select",e);
this.setState({ this.setState({
user:e.item.props.children user_id:e
}) })
this.getUserList(option.props.children);
} }
getUserList=(e)=>{ getUserList=(e)=>{
const url = `/users/list.json`; const url = `/users/list.json`;
@ -98,6 +88,22 @@ class Collaborator extends Component{
}) })
} }
// 增加协作者
addCollaborator=()=>{
const { project_id } = this.props;
const { user_id } = this.state;
const url = `/projects/${project_id}/members.json`;
axios.post(url,{
user_id
}).then(result=>{
if(result){
this.getMember(project_id);
}
}).catch(error=>{
console.log(error);
})
}
// 修改权限 // 修改权限
changeOperaiton=(e,id)=>{ changeOperaiton=(e,id)=>{
const { project_id } = this.props; const { project_id } = this.props;
@ -120,23 +126,6 @@ class Collaborator extends Component{
console.log(error); console.log(error);
}) })
} }
// 增加协作者
addCollaborator=()=>{
const { projectsId } = this.props.match.params;
const { project_id } = this.props;
const { user_id } = this.state;
const url = `/projects/${projectsId}/members.json`;
axios.post(url,{
user_id
}).then(result=>{
if(result){
this.getMember(project_id);
}
}).catch(error=>{
console.log(error);
})
}
render(){ render(){
const { user , userDataSource , listData , isSpin } = this.state; const { user , userDataSource , listData , isSpin } = this.state;
@ -154,7 +143,7 @@ class Collaborator extends Component{
const source = userDataSource && userDataSource.map((item,key)=>{ const source = userDataSource && userDataSource.map((item,key)=>{
return( return(
<Option key={key} value={`${item.user_id}`} onClick={this.serachUser}>{item.username}</Option> <Option key={key} value={`${item.user_id}`}>{item.username}</Option>
) )
}) })
return( return(
@ -189,12 +178,11 @@ class Collaborator extends Component{
</Spin> </Spin>
<div className="addPanel"> <div className="addPanel">
<AutoComplete <AutoComplete
value={user}
dataSource={source} dataSource={source}
style={{ width: 200 }} style={{ width: 200 }}
onChange={this.changeInputUser} onChange={this.changeInputUser}
onSelect={this.selectInputUser}
placeholder="搜索用户" placeholder="搜索用户"
onSelect={this.changeUser}
/> />
<a className="small_submitBtn ml20" onClick={this.addCollaborator}>增加协作者</a> <a className="small_submitBtn ml20" onClick={this.addCollaborator}>增加协作者</a>
</div> </div>

@ -97,7 +97,8 @@ class Setting extends Component{
this.props.confirm({ this.props.confirm({
content:"删除后无法恢复,是否确认删除本仓库?", content:"删除后无法恢复,是否确认删除本仓库?",
onOk:()=>{ onOk:()=>{
const url = ``; const { project_id } = this.props;
const url = `/projects/${project_id}.json`;
axios.delete(url).then(result=>{ axios.delete(url).then(result=>{
this.props.showNotification("仓库删除成功!"); this.props.showNotification("仓库删除成功!");
this.props.history.push("/projects"); this.props.history.push("/projects");

@ -90,7 +90,7 @@
line-height: 38px; line-height: 38px;
border:1px solid #db2828; border:1px solid #db2828;
border-radius: 4px; border-radius: 4px;
color: #db2828; color: #db2828!important;
padding:0px 15px; padding:0px 15px;
font-size: 16px; font-size: 16px;
} }

Loading…
Cancel
Save