diff --git a/public/react/src/forge/Main/CoderRootDirectory.js b/public/react/src/forge/Main/CoderRootDirectory.js
index ba6e332a7..9da304d43 100644
--- a/public/react/src/forge/Main/CoderRootDirectory.js
+++ b/public/react/src/forge/Main/CoderRootDirectory.js
@@ -1,7 +1,8 @@
import React , { Component } from 'react';
import { Menu } from 'antd';
import { getImageUrl } from 'educoder';
-import {Link} from 'react-router-dom';
+import { Router , Route , Link } from 'react-router-dom';
+
import './list.css';
@@ -178,7 +179,7 @@ class CoderRootDirectory extends Component{
{
branchLastCommit.author ?
-
+
{branchLastCommit.author.login}
:""
@@ -203,6 +204,8 @@ class CoderRootDirectory extends Component{
)
}
}
+
+ const urlRoot = filePath && filePath.length > 0 ? `/${filePath[filePath.length - 1].path}` : "";
return(
@@ -239,7 +242,7 @@ class CoderRootDirectory extends Component{
{
subFileType !== "file" &&
- 新建文件
+ 新建文件
上传文件
}
diff --git a/public/react/src/forge/Main/Detail.js b/public/react/src/forge/Main/Detail.js
index 51fbc1a6a..269313948 100644
--- a/public/react/src/forge/Main/Detail.js
+++ b/public/react/src/forge/Main/Detail.js
@@ -74,7 +74,12 @@ class Detail extends Component{
- ()
+ }
+ >
+ ()
}
diff --git a/public/react/src/forge/Newfile/Index.js b/public/react/src/forge/Newfile/Index.js
index b7446071e..af2af9e4b 100644
--- a/public/react/src/forge/Newfile/Index.js
+++ b/public/react/src/forge/Newfile/Index.js
@@ -1,6 +1,7 @@
import React , { Component } from "react";
import Editor from "react-monaco-editor";
+import UserSubmitComponent from './UserSubmitComponent';
import { Input } from 'antd';
import './index.css';
@@ -8,9 +9,17 @@ class Index extends Component{
constructor(props){
super(props);
this.state={
- editorValue:""
+ editorValue:"",
+ filename:""
}
}
+
+ // 命名文件
+ changeFileName=(e)=>{
+ this.setState({
+ filename:e.target.value
+ })
+ }
// 取消,弹框询问
CancelAddFile=()=>{
@@ -23,13 +32,16 @@ class Index extends Component{
}
render(){
- const { editorValue } = this.state;
+ const { editorValue , filename } = this.state;
const { projectDetail } = this.props;
+
+ const { pathname } = this.props.location;
+ const urlroot = pathname.split("newfile")[1];
return(
@@ -42,9 +54,12 @@ class Index extends Component{
onChange={this.changeEditor}
/>
-
-
-
+
)
}
diff --git a/public/react/src/forge/Newfile/UserSubmitComponent.js b/public/react/src/forge/Newfile/UserSubmitComponent.js
new file mode 100644
index 000000000..3f4716b18
--- /dev/null
+++ b/public/react/src/forge/Newfile/UserSubmitComponent.js
@@ -0,0 +1,106 @@
+import React,{Component} from 'react';
+import { getImageUrl } from 'educoder';
+import { Form , Input , Button , Radio , Icon } from 'antd';
+
+import './index.css';
+
+import axios from 'axios';
+const TextArea = Input.TextArea;
+class UserSubmitComponent extends Component{
+ constructor(props){
+ super(props);
+ this.state={
+ submitType:"0"
+ }
+ }
+
+ changeSubmittype=(e)=>{
+ this.setState({
+ submitType:e.target.value
+ })
+ }
+
+ // 提交变更
+ subMitFrom=()=>{
+ const { current_user , filepath , content } = this.props;
+ const { branch , projectsId } = this.props.match.params;
+ const { submitType } = this.state;
+ let path = filepath.substr(1);
+ this.props.form.validateFieldsAndScroll((err, values) => {
+ if(!err){
+ const url = `/${current_user && current_user.login}/${projectsId}/contents.json`;
+ axios.post(url,{
+ filepath:path,
+ branch:submitType==="0" ? branch : undefined,
+ new_branch:submitType==="1" ? values.branchname:undefined,
+ content,
+ message:values.desc
+ }).then((result)=>{
+ if(result && result.data.name){
+ this.props.history.push(`/projects/${projectsId}/coder`);
+ }
+ }).catch(error=>{
+ console.log(error);
+ })
+ }
+ })
+ }
+ render(){
+ const { submitType } = this.state;
+ const { getFieldDecorator } = this.props.form;
+
+ const { branch } = this.props.match.params;
+
+ const { current_user , filepath , projectDetail } = this.props;
+
+ const changeSubmitBranch = ()=>{
+ if(submitType==="1"){
+ return(
+
+ {getFieldDecorator('branchname', {
+ rules: [{
+ required: true, message: '请输入分支名称'
+ }],
+ })(
+
+ )}
+
+ )
+ }
+ }
+ return(
+
+
![]({getImageUrl(`images/${current_user)
+
+
+ {getFieldDecorator('path', {
+ rules: [],
+ })(
+
+ )}
+
+
+ {getFieldDecorator('desc', {
+ rules: [],
+ })(
+
+
+ 直接提交至{branch}分支
+ 为此提交创建一个新的分支并发起合并请求
+
+ {changeSubmitBranch()}
+
+
+
+
+
+
+
+ )
+ }
+}
+const WrappedUserSubmitForm = Form.create({ name: 'UserSubmitForm' })(UserSubmitComponent);
+export default WrappedUserSubmitForm;
\ No newline at end of file
diff --git a/public/react/src/forge/Newfile/index.css b/public/react/src/forge/Newfile/index.css
index 133602c7f..7bf8b9aa7 100644
--- a/public/react/src/forge/Newfile/index.css
+++ b/public/react/src/forge/Newfile/index.css
@@ -9,6 +9,27 @@
border-right: none!important;
}
+.userScrew{
+ margin:20px 0px;
+ border:1px solid #f4f4f4;
+ border-radius: 5px;
+ display: flex;
+ padding:10px;
+}
+.screwImg{
+ width: 34px;
+ height: 34px;
+ border-radius: 50%;
+ margin-right:10px;
+}
+.screwPanel{
+ flex: 1;
+}
+
+.screwPanel .ant-radio-wrapper{
+ display: block;
+}
+
@media screen and (max-width: 400px){
.setInputAddon{
width: 100%;