From 736574c2ba4311b44cb7d83f161725dd9f211c70 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Thu, 9 Jan 2020 08:59:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=AE=E5=BD=95=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 240 +----------------- public/react/src/forge/Branch/SelectBranch.js | 2 +- .../react/src/forge/Main/CoderRootBranch.js | 9 +- .../src/forge/Main/CoderRootDirectory.js | 27 +- .../src/forge/Main/CoderRootFileDetail.js | 108 ++++++++ public/react/src/forge/Main/CoderRootIndex.js | 11 +- public/react/src/forge/Main/IndexItem.js | 2 +- public/react/src/forge/Main/RootTable.js | 19 ++ public/react/src/forge/Main/list.css | 27 +- public/react/src/forge/Redux/Reducer/index.js | 7 + public/react/src/forge/Redux/Store/index.js | 18 ++ 11 files changed, 207 insertions(+), 263 deletions(-) create mode 100644 public/react/src/forge/Main/CoderRootFileDetail.js create mode 100644 public/react/src/forge/Main/RootTable.js create mode 100644 public/react/src/forge/Redux/Reducer/index.js create mode 100644 public/react/src/forge/Redux/Store/index.js diff --git a/public/react/src/App.js b/public/react/src/App.js index e34ef8fb2..6a84a9708 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -495,9 +495,6 @@ class App extends Component { }; render() { - let{mygetHelmetapi}=this.state; - // console.log("appappapp"); - // console.log(mygetHelmetapi); return ( @@ -521,242 +518,13 @@ class App extends Component { return () } }> - {/*题库*/} - { - - return () - } - }> - {/*题库*/} - { - - return () - } - }> - {/*/!*众包创新*!/*/} - {/**/} - {/*竞赛*/} - { - - return () - } - }> - - {/*黑客松定制竞赛*/} - { - return( - - ) - } - } - /> - - {/*认证*/} - - - {/*403*/} - - - - - {/*404*/} - - - - { - - return () - } - } - /> - { - - return () - } - } - /> - - - - { - - return () - } - }> - - { - return () - } - }> - {/* ()*/} - {/*}*/} - {/*/>*/} - { - - return () - } - } - /> - {/**/} - - - () - }/> - {/* jupyter */} - { - return () - } - } - /> - - - - {/**/} - {/**/} - - () - } - > - {/*列表页 实训项目列表*/} - {/**/} - - - () - } - > - - - - - - {/*实训课程(原实训路径)*/} - - - () - } - > - - {/*课堂*/} - - - {/* - */} - {/* 教学案例 */} - () - }/> - - () - } - > - - - {/**/} - {/**/} - {/**/} - {/**/} - {/**/} - {/* ()*/} - {/*}*/} - {/*/>*/} - - () - } - > - () - }/> - () - }/> - - { - return () - } - } - /> - - () - } /> - () + (props)=>() } /> - () - } /> - - () - }/> - - () - } - /> diff --git a/public/react/src/forge/Branch/SelectBranch.js b/public/react/src/forge/Branch/SelectBranch.js index a3fcff973..6169fb59d 100644 --- a/public/react/src/forge/Branch/SelectBranch.js +++ b/public/react/src/forge/Branch/SelectBranch.js @@ -19,7 +19,7 @@ class SelectBranch extends Component{ ); return( -
+
分支: diff --git a/public/react/src/forge/Main/CoderRootBranch.js b/public/react/src/forge/Main/CoderRootBranch.js index 464d3e0c9..95e4bb02e 100644 --- a/public/react/src/forge/Main/CoderRootBranch.js +++ b/public/react/src/forge/Main/CoderRootBranch.js @@ -1,9 +1,9 @@ import React , { Component } from 'react'; import { Link } from "react-router-dom"; -import { Dropdown , Menu , Icon } from 'antd'; +import { Dropdown , Menu , Icon , Tooltip } from 'antd'; import './list.css' -import axios from 'axios'; +import { branch } from 'recompose'; class CoderRootBranch extends Component { constructor(porps){ @@ -24,7 +24,7 @@ class CoderRootBranch extends Component { return(
  • - {item.name} + {item.name}

    {item.last_commit && item.last_commit.id} {item.last_commit && item.last_commit.message} @@ -33,9 +33,10 @@ class CoderRootBranch extends Component {

    创建合并请求 +
    - + diff --git a/public/react/src/forge/Main/CoderRootDirectory.js b/public/react/src/forge/Main/CoderRootDirectory.js index 4693a8cb6..3f65b20eb 100644 --- a/public/react/src/forge/Main/CoderRootDirectory.js +++ b/public/react/src/forge/Main/CoderRootDirectory.js @@ -1,5 +1,5 @@ import React , { Component } from 'react'; -import { Menu , Table } from 'antd'; +import { Menu } from 'antd'; import { getImageUrl } from 'educoder'; import {Link} from 'react-router-dom'; @@ -7,6 +7,7 @@ import './list.css'; import SelectBranch from '../Branch/SelectBranch'; import CloneAddress from '../Branch/CloneAddress'; +import RootTable from './RootTable'; import axios from 'axios'; class CoderRootDirectory extends Component{ @@ -65,7 +66,7 @@ class CoderRootDirectory extends Component{ changeBranch=(value)=>{ const { branchList } = this.state; let branchLastCommit = branchList[parseInt(value.key)]; - + this.getProjectRoot(branchLastCommit.name); this.setState({ branch:branchLastCommit.name, branchLastCommit, @@ -73,15 +74,19 @@ class CoderRootDirectory extends Component{ }) } render(){ - const { rootList } = this.state; + const { rootList , branch } = this.state; + + const { branchLastCommit , http_url } = this.props; + const { projectsId } = this.props.match.params; - const { branchs , branch , branchLastCommit , http_url } = this.props; const columns = [ { dataIndex: 'name', width:"100%", render: (text,item) => ( - {text} + + {text} + ), } ]; @@ -119,18 +124,10 @@ class CoderRootDirectory extends Component{ return(
    - +
    - title()} - /> + title()}> ) } diff --git a/public/react/src/forge/Main/CoderRootFileDetail.js b/public/react/src/forge/Main/CoderRootFileDetail.js new file mode 100644 index 000000000..77d70cf1c --- /dev/null +++ b/public/react/src/forge/Main/CoderRootFileDetail.js @@ -0,0 +1,108 @@ +import React , { Component } from "react"; +import SelectBranch from '../Branch/SelectBranch'; +import { getImageUrl } from 'educoder'; + +import {Link} from 'react-router-dom'; + +import RootTable from './RootTable'; +import './list.css'; +import axios from 'axios'; + +class CoderRootFileDetail extends Component{ + constructor(props){ + super(props); + this.state={ + branch:undefined, + subRootData:undefined + } + } + + componentDidMount=()=>{ + const { branch } = this.props.match.params; + this.getFileDetail(branch); + } + + componentDidUpdate=(prevProps)=>{ + } + + getFileDetail=(branch)=>{ + const { current_user } = this.props; + const { fileurl , projectsId } = this.props.match.params; + const url =`/${current_user.login}/${projectsId}/sub_entries.json`; + + axios.get(url,{ + params:{ + filepath:fileurl, + ref:branch + } + }).then((result)=>{ + if(result){ + this.setState({ + subRootData:result.data + }) + } + }).catch((error)=>{ + console.log(error); + }) + + } + + changeBranch=(value)=>{ + + } + + + render(){ + const { branch , projectsId , fileurl } = this.props.match.params; + const { branchLastCommit , http_url } = this.props; + + const { subRootData } = this.state; + const columns =[ + { + dataIndex: 'name', + width:"100%", + render: (text,item) => ( + + {text} + + ), + } + ]; + + const title = () =>{ + if(branchLastCommit && branchLastCommit.last_commit){ + return( +
    + { + branchLastCommit.author ? + + + {branchLastCommit.author.login} + + :"" + } + {branchLastCommit.last_commit.id} + {branchLastCommit.last_commit.message} + {branchLastCommit.last_commit.time_from_now} +
    + ) + }else{ + return undefined; + } + } + return( +
    +
    + + + iSulad + {fileurl} + +
    + title()}> +
    + ) + } +} + +export default CoderRootFileDetail; \ No newline at end of file diff --git a/public/react/src/forge/Main/CoderRootIndex.js b/public/react/src/forge/Main/CoderRootIndex.js index 1c66a8cb1..b9139f821 100644 --- a/public/react/src/forge/Main/CoderRootIndex.js +++ b/public/react/src/forge/Main/CoderRootIndex.js @@ -15,6 +15,10 @@ const CoderRootCommit = Loadable({ loader: () => import('./CoderRootCommit'), loading: Loading, }) +const CoderRootFileDetail = Loadable({ + loader: () => import('./CoderRootFileDetail'), + loading: Loading, +}) const CoderRootBranch = Loadable({ loader: () => import('./CoderRootBranch'), loading: Loading, @@ -57,7 +61,7 @@ class CoderRootIndex extends Component{ }).catch((error)=>{}) } render(){ - const {projectDetail} = this.props + const {projectDetail} = this.props; const { projectsId } = this.props.match.params; const { pathname } = this.props.location; return( @@ -79,6 +83,11 @@ class CoderRootIndex extends Component{ (props) => () } > + () + } + >
    -

    {item.description}

    +

    {item.description}

    diff --git a/public/react/src/forge/Main/RootTable.js b/public/react/src/forge/Main/RootTable.js new file mode 100644 index 000000000..708f0f0b8 --- /dev/null +++ b/public/react/src/forge/Main/RootTable.js @@ -0,0 +1,19 @@ +import React , { Component } from 'react'; +import { Table } from 'antd'; +class RootTable extends Component{ + render(){ + const { columns , data , title }=this.props; + return( +
    title()} + /> + ) + } +} +export default RootTable; \ No newline at end of file diff --git a/public/react/src/forge/Main/list.css b/public/react/src/forge/Main/list.css index 41567e34e..b58fff0ff 100644 --- a/public/react/src/forge/Main/list.css +++ b/public/react/src/forge/Main/list.css @@ -277,7 +277,7 @@ body,#root{ .operationBtn{ border:1px solid #f4f4f4; border-radius: 3px; - padding:0px 4px; + padding:0px 6px; background-color:#fff; color:#666!important; display: inline-block; @@ -292,14 +292,31 @@ body,#root{ .leftPoint::before{ position: absolute; left: -10px; - top:3px; + top:8px; border-radius: 50%; - width: 5px; - height: 5px; - background-color: #f4f4f4; + width: 4px; + height: 4px; + background-color: #dadada; content: ''; } +/* 文件目录、文件内容 */ +.subFileName{ + position: relative; + margin-left: 15px; + height: 22px; +} +.subFileName::before{ + position: absolute; + content: '/'; + left: -10px; + top: 0px; + color: #999; + height: 22px; + line-height: 22px; +} + + @media screen and (max-width: 750px){ .list-left,.list-right{ diff --git a/public/react/src/forge/Redux/Reducer/index.js b/public/react/src/forge/Redux/Reducer/index.js new file mode 100644 index 000000000..76f7f571a --- /dev/null +++ b/public/react/src/forge/Redux/Reducer/index.js @@ -0,0 +1,7 @@ + + +import { combineReducers } from 'redux'; + +export default combineReducers({ + +}) \ No newline at end of file diff --git a/public/react/src/forge/Redux/Store/index.js b/public/react/src/forge/Redux/Store/index.js new file mode 100644 index 000000000..329863a30 --- /dev/null +++ b/public/react/src/forge/Redux/Store/index.js @@ -0,0 +1,18 @@ +/* + * @Description: 指定容器并绑定 reducers + * @Author: tangjiang + * @Date: 2019-11-13 20:13:21 + * @Last Modified by: tangjiang + * @Last Modified time: 2019-11-14 19:20:44 + */ + +import { createStore, applyMiddleware } from 'redux'; +import thunk from 'redux-thunk'; +import rootReducer from '../reducers'; + +const configureStore = () => createStore( + rootReducer, + applyMiddleware(thunk) +); + +export default configureStore; \ No newline at end of file