diff --git a/public/react/src/forge/Main/CoderRootDirectory.js b/public/react/src/forge/Main/CoderRootDirectory.js index a2ff94b40..6ae882015 100644 --- a/public/react/src/forge/Main/CoderRootDirectory.js +++ b/public/react/src/forge/Main/CoderRootDirectory.js @@ -14,7 +14,9 @@ class CoderRootDirectory extends Component{ super(props); this.state={ address:"http", - ref:"master" + ref:"master", + + rootList:undefined } } @@ -26,8 +28,23 @@ class CoderRootDirectory extends Component{ componentDidMount=()=>{ this.getProjectRoot(); + this.getBranch(); + } + + // 获取分支列表 + getBranch=()=>{ + const { login } = this.props.current_user; + const { projectsId } = this.props.match.params; + + const url =`/projects/${login}/${projectsId}/branches.json`; + axios.get(url).then((result)=>{ + if(result){ + + } + }).catch((error)=>{}) } + // 获取分支文件 getProjectRoot=(ref)=>{ const { login } = this.props.current_user; const { projectsId } = this.props.match.params; @@ -38,12 +55,25 @@ class CoderRootDirectory extends Component{ ref } }).then((result)=>{ - if(result){ - + if(result && result.data && result.data.length > 0){ + this.renderData(result.data) } }).catch((error)=>{}) } + renderData=(data)=>{ + const rootList = []; + data && data.map((item,key)=>{ + rootList.push({ + key, + ...item + }) + }) + this.setState({ + rootList:rootList + }) + } + render(){ const menu = ( @@ -59,39 +89,11 @@ class CoderRootDirectory extends Component{ const columns = [ { dataIndex: 'name', - width:"33%", - render: text => {text}, - }, - { - className: 'column-money', - width:"34%", - dataIndex: 'money', - }, - { - dataIndex: 'address', - width:"33%", - className:"edu-txt-right color-grey-9" - }, - ]; - const data = [ - { - key: '1', - name: 'John Brown', - money: '¥300,000.00', - address: 'New York No. 1 Lake Park', - }, - { - key: '2', - name: 'Jim Green', - money: '¥1,256,000.00', - address: 'London No. 1 Lake Park', - }, - { - key: '3', - name: 'Joe Black', - money: '¥120,000.00', - address: 'Sidney No. 1 Lake Park', - }, + width:"100%", + render: (text,item) => ( + {text} + ), + } ]; const title = () =>{ @@ -106,7 +108,7 @@ class CoderRootDirectory extends Component{ ) } - const { address , ref } = this.state; + const { address , ref , rootList } = this.state; return(

@@ -139,7 +141,7 @@ class CoderRootDirectory extends Component{