dev_forge
caicai8 5 years ago
parent a7dd5275e1
commit 59c71c69b2

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

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

@ -5,17 +5,44 @@ import axios from 'axios';
const { Option } = AutoComplete; const { Option } = AutoComplete;
const MENU_LIST = ['管理员','可读权限','可写权限']; const MENU_LIST = ['管理员','可读权限','可写权限'];
const LIMIT = 15;
class Collaborator extends Component{ class Collaborator extends Component{
constructor(props){ constructor(props){
super(props); super(props);
this.state={ 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)=>{ changeInputUser=(e)=>{
console.log(e); this.setState({
user:e
})
const url = `/users/list.json`; const url = `/users/list.json`;
axios.get(url,{ axios.get(url,{
params:{ params:{
@ -35,8 +62,24 @@ class Collaborator extends Component{
changeOperaiton=(e,id)=>{ changeOperaiton=(e,id)=>{
console.log(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(){ render(){
const { userDataSource } = this.state; const { user , userDataSource } = this.state;
const menu =(id)=> ( const menu =(id)=> (
<Menu> <Menu>
@ -56,6 +99,7 @@ class Collaborator extends Component{
) )
}) })
return( return(
<div>
<div className="normalBox"> <div className="normalBox">
<div className="normalBox-title font-16"> <div className="normalBox-title font-16">
协作者 协作者
@ -75,6 +119,7 @@ class Collaborator extends Component{
</div> </div>
<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}
@ -83,6 +128,8 @@ class Collaborator extends Component{
<a className="small_submitBtn ml20" onClick={this.addCollaborator}>增加协作者</a> <a className="small_submitBtn ml20" onClick={this.addCollaborator}>增加协作者</a>
</div> </div>
</div> </div>
</div>
) )
} }
} }

@ -8,8 +8,6 @@ class Setting extends Component{
constructor(props){ constructor(props){
super(props); super(props);
this.state={ this.state={
Language:"1",
Category:"1",
CategoryList:undefined, CategoryList:undefined,
LanguageList:undefined, LanguageList:undefined,
} }
@ -78,13 +76,33 @@ class Setting extends Component{
const { projectsId } = this.props.match.params; const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}.json`; const url = `/projects/${projectsId}.json`;
axios.patch(url,{ axios.patch(url,{
params:{
name:values.project_name, name:values.project_name,
description:values.project_description, description:values.project_description,
...values ...values
}
}).then(result=>{ }).then(result=>{
if(result){ if(result){
this.props.showNotification(`仓库信息修改成功!`) this.props.showNotification(`仓库信息修改成功!`);
const { getDetail } = this.props;
getDetail && getDetail();
}
}).catch(error=>{
console.log(error);
})
}
})
} }
// 删除本仓库
deleteProject=()=>{
this.props.confirm({
content:"删除后无法恢复,是否确认删除本仓库?",
onOk:()=>{
const url = ``;
axios.delete(url).then(result=>{
this.props.showNotification("仓库删除成功!");
this.props.history.push("/projects");
}).catch(error=>{ }).catch(error=>{
console.log(error); console.log(error);
}) })
@ -95,8 +113,9 @@ class Setting extends Component{
render(){ render(){
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const { Category , Language , CategoryList , LanguageList } = this.state; const { CategoryList , LanguageList } = this.state;
return( return(
<div>
<div className="normalBox"> <div className="normalBox">
<div className="normalBox-title font-16"> <div className="normalBox-title font-16">
基本设置 基本设置
@ -165,6 +184,17 @@ class Setting extends Component{
</p> </p>
</Form> </Form>
</div> </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>
) )
} }
} }

@ -73,3 +73,32 @@
width: 200px; width: 200px;
height: 32px; 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