diff --git a/public/react/src/common/UrlTool.js b/public/react/src/common/UrlTool.js
index d50aef505..e44ee2d56 100644
--- a/public/react/src/common/UrlTool.js
+++ b/public/react/src/common/UrlTool.js
@@ -106,6 +106,14 @@ export function getUploadActionUrlthree() {
let anewopens=md5(newopens+newtimestamp);
return `${getUrlmys()}/api/jupyters/import_with_tpm.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`
}
+
+export function getupload_git_file(id) {
+ Railsgettimes()
+ let anewopens=md5(newopens+newtimestamp);
+ return `${getUrlmys()}/api/shixuns/${id}/upload_git_file.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`
+}
+
+
export function getUploadActionUrlOfAuth(id) {
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js
index 126a42e87..3a6058214 100644
--- a/public/react/src/common/educoder.js
+++ b/public/react/src/common/educoder.js
@@ -3,7 +3,7 @@
// export { default as OrderStateUtil } from '../routes/Order/components/OrderStateUtil';
export { getImageUrl as getImageUrl, getUrl as getUrl, getRandomcode as getRandomcode,getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl
- , getUploadActionUrl as getUploadActionUrl,getUploadActionUrltwo as getUploadActionUrltwo ,getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth
+ , getupload_git_file as getupload_git_file,getUploadActionUrl as getUploadActionUrl,getUploadActionUrltwo as getUploadActionUrltwo ,getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth
, getTaskUrlById as getTaskUrlById, TEST_HOST ,htmlEncode as htmlEncode } from './UrlTool';
export { default as queryString } from './UrlTool2';
diff --git a/public/react/src/modules/courses/coursesPublic/sendResource.js b/public/react/src/modules/courses/coursesPublic/sendResource.js
index cc7ecc03a..de34e831c 100644
--- a/public/react/src/modules/courses/coursesPublic/sendResource.js
+++ b/public/react/src/modules/courses/coursesPublic/sendResource.js
@@ -70,6 +70,8 @@ class Sendresource extends Component{
}
// 附件相关 START
handleChange = (info) => {
+ console.log(info)
+
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
if (info.file.status != "removed") {
diff --git a/public/react/src/modules/tpm/TPMRepositoryComponentdetails.js b/public/react/src/modules/tpm/TPMRepositoryComponentdetails.js
index 9783882dd..20dcce107 100644
--- a/public/react/src/modules/tpm/TPMRepositoryComponentdetails.js
+++ b/public/react/src/modules/tpm/TPMRepositoryComponentdetails.js
@@ -1,16 +1,7 @@
import React, { Component } from 'react';
-import { Redirect } from 'react-router';
-
-import PropTypes from 'prop-types';
-
-import TPMRepository from './TPMRepository'
-
import axios from 'axios';
-
-import { trace_collapse, info } from 'educoder'
-
-import RepositoryCodeEditor from './shixunchild/Repository/RepositoryCodeEditor'
-
+import { trace_collapse, info } from 'educoder';
+import RepositoryCodeEditor from './shixunchild/Repository/RepositoryCodeEditor';
class TPMRepositoryComponentdetails extends Component {
constructor(props) {
@@ -205,10 +196,9 @@ class TPMRepositoryComponentdetails extends Component {
{ flag ? ""
:
-
+
{/* 可能会影响到其他页面的样式,需要测试、协商 */}
-
+
}
@@ -242,12 +243,12 @@ class Repository extends Component {
})}
-
- }>
- } />
- }/>
-
-
+ {/*
*/}
+ {/* }>*/}
+ {/* } />*/}
+ {/* }/>*/}
+ {/* */}
+ {/**/}
diff --git a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFile.js b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFile.js
index 3dc19d0dd..cdf616275 100644
--- a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFile.js
+++ b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFile.js
@@ -100,6 +100,16 @@ class RepositoryAddFile extends Component {
}
handleSubmit = () =>{
+ let matchpath =this.props.match.path;
+
+ let Repositoryflag =false;
+
+ if( matchpath.indexOf("repository")>-1){
+ Repositoryflag =false;
+ }
+ if(matchpath.indexOf("secret_repository")>-1){
+ Repositoryflag =true;
+ }
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
let shixunId = this.props.match.params.shixunId;
@@ -107,10 +117,11 @@ class RepositoryAddFile extends Component {
axios.post(url,{
path:values.path,
message:values.message,
- content:this.extend_editor.getValue()
+ content:this.extend_editor.getValue(),
+ secret_repository:Repositoryflag
}).then((result)=>{
if(result){
- this.props.history.push(`${result.data.url}`)
+ this.props.history.push(Repositoryflag===true?`/shixuns/${shixunId}/secret_repository`:`/shixuns/${shixunId}/repository`)
}
}).catch((error)=>{
console.log(error);
@@ -121,9 +132,18 @@ class RepositoryAddFile extends Component {
render(){
const {getFieldDecorator} = this.props.form;
let { shixunId } = this.props.match.params;
+
+ let matchpath =this.props.match.path;
+ let Repositoryflag ="";
+ if( matchpath.indexOf("repository")>-1){
+ Repositoryflag ="repository";
+ }
+ if(matchpath.indexOf("secret_repository")>-1){
+ Repositoryflag ="secret_repository";
+ }
return(
-
+
-
-
- 实训项目
- 版本库
- 添加新文件
-
-
+ {/*
*/}
+ {/* */}
+ {/* 实训项目*/}
+ {/* 版本库*/}
+ {/* 添加新文件*/}
+ {/* */}
+ {/*
*/}
)
}
diff --git a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFileupload_file.js b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFileupload_file.js
index aec19fb4e..6a9207bf2 100644
--- a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFileupload_file.js
+++ b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFileupload_file.js
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
-import { Form , Upload , Input , Icon, message } from 'antd';
+import { Form , Upload , Input , notification, message } from 'antd';
import axios from 'axios';
-import { getUploadActionUrl } from 'educoder';
+import { getupload_git_file } from 'educoder';
import Bottomsubmit from "../../../modals/Bottomsubmit";
import "./Repository.css"
const { Dragger } = Upload;
@@ -10,6 +10,7 @@ class RepositoryAddFileupload_files extends Component {
super(props);
this.state={
filspath:"",
+ message:undefined,
fileList: [
// {
// uid: '-1',
@@ -45,27 +46,18 @@ class RepositoryAddFileupload_files extends Component {
})
}
handleChange = (info) => {
+ console.log(info)
+ console.log(info.file)
- const { status } = info.file;
- if (status !== 'uploading') {
- console.log(info.file, info.fileList);
- }
- if (status === 'done') {
- message.success(`${info.file.name} file uploaded successfully.`);
- } else if (status === 'error') {
- message.error(`${info.file.name} file upload failed.`);
- }
-
-
+ //
+ // notification.open({
+ // message: '提示',
+ // description: result.data.messages,
+ // });
let fileList = [...info.fileList];
-
-
fileList = fileList.slice(-2);
-
-
fileList = fileList.map(file => {
if (file.response) {
-
file.url = file.response.url;
}
return file;
@@ -73,31 +65,109 @@ class RepositoryAddFileupload_files extends Component {
this.setState({ fileList });
- console.log(fileList)
+
};
+
onAttachmentRemove=(info)=>{
+ let shixunId = this.props.match.params.shixunId;
+ let {message,filspath}=this.state;
+ if(message===""||message===undefined){
+ notification.open({
+ message: '提示',
+ description: '删除文件请先填写提交信息',
+ });
+ return
+ }
+
+ let matchpath =this.props.match.path;
+ let Repositoryflag =false;
+
+ if( matchpath.indexOf("repository")>-1){
+ Repositoryflag =false;
+ }
+ if(matchpath.indexOf("secret_repository")>-1){
+ Repositoryflag =true;
+ }
+ const url = `/shixuns//${shixunId}/delete_git_file.json`;
+ axios.delete(url, { data: {
+ path:filspath+info.name,
+ message:message,
+ secret_repository:Repositoryflag
+ }})
+ .then((response) => {
+ if (response.data.status == 0) {
+
+ }
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+ }
+
+ FormInput=(e)=>{
+ this.setState({
+ message:e.target.value
+ })
}
render(){
const {getFieldDecorator} = this.props.form;
let { shixunId } = this.props.match.params;
+ // const props = {
+ // height:300,
+ // // name: 'file',
+ // multiple: true,
+ //
+ // action: `${getUploadActionUrl()}`,
+ // onChange: this.handleChange,
+ // onRemove: this.onAttachmentRemove,
+ // // beforeUpload: (file) => {
+ // // console.log('beforeUpload', file.name);
+ // // const isLt150M = file.size / 1024 / 1024 < 150;
+ // // if (!isLt150M) {
+ // // this.props.showNotification('文件大小必须小于150MB!');
+ // // }
+ // // return isLt150M;
+ // // },
+ // };
+ let matchpath =this.props.match.path;
+
+ let Repositoryflagtype =false;
+ let Repositoryflag ="";
+
+ if( matchpath.indexOf("repository")>-1){
+ Repositoryflag ="repository";
+ Repositoryflagtype =false;
+ }
+ if(matchpath.indexOf("secret_repository")>-1){
+ Repositoryflag ="secret_repository";
+ Repositoryflagtype =true;
+ }
const props = {
height:300,
- name: 'file',
multiple: true,
- fileList:this.state.fileList,
- action: getUploadActionUrl(),
+ data:{
+ path:this.state.filspath,
+ message:this.state.message,
+ secret_repository:Repositoryflagtype
+ },
+ // fileList:this.state.fileList,
+ // showUploadList:false,
+ action: `${getupload_git_file(shixunId)}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
- // beforeUpload: (file) => {
- // console.log('beforeUpload', file.name);
- // const isLt150M = file.size / 1024 / 1024 < 150;
- // if (!isLt150M) {
- // this.props.showNotification('文件大小必须小于150MB!');
- // }
- // return isLt150M;
- // },
+ beforeUpload: (file) => {
+ let {message}=this.state;
+ if(message===""||message===undefined){
+ notification.open({
+ message: '提示',
+ description: '上传文件请先填写提交信息',
+ });
+ return false
+ }
+ },
};
+
return(
@@ -149,12 +219,12 @@ class RepositoryAddFileupload_files extends Component {
{getFieldDecorator('message', {
rules: [{
- required: true, message: '请输入名称',
+ required: true, message: '请输入提交信息',
},{
whitespace: true, message: '请勿输入空格'
}],
})(
-
+
)}
@@ -170,12 +240,12 @@ class RepositoryAddFileupload_files extends Component {
-
+
-
+
拖拽文件或 点击此处上传
@@ -191,7 +261,7 @@ class RepositoryAddFileupload_files extends Component {
-
this.handleSubmit()}/>
+ this.handleSubmit()}/>
)
}
diff --git a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryCodeEditor.js b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryCodeEditor.js
index 51f6e35f2..e6ac314e2 100644
--- a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryCodeEditor.js
+++ b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryCodeEditor.js
@@ -18,6 +18,7 @@ import Popconfirm from 'antd/lib/popconfirm';
import 'antd/lib/popconfirm/style/css';
import { message } from 'antd';
+import Bottomsubmit from "../../../modals/Bottomsubmit";
require('codemirror/lib/codemirror.css');
@@ -124,7 +125,7 @@ class RepositoryCodeEditor extends Component {
secret_repository: this.props.secret_repository_tab,
content: this.extend_editor.getValue(),
// type: forTest === true ? 1 : 0,
- path: path
+ path: path,
}
).then((response) => {
if (response.data.content) {
@@ -134,49 +135,61 @@ class RepositoryCodeEditor extends Component {
})
}
render() {
- const { fileContent, match, saveCode } = this.props;
+ const { fileContent, shixunId, saveCode } = this.props;
const { codeSaving } = this.state;
+ let matchpath =this.props.match.path;
+ let Repositoryflag ="";
+ if( matchpath.indexOf("repository")>-1){
+ Repositoryflag ="repository";
+ }
+ if(matchpath.indexOf("secret_repository")>-1){
+ Repositoryflag ="secret_repository";
+ }
return (
-
-
-
-
-
-
-
-
- { codeSaving ?
-
保存中...
- :
this.saveCode(this.extend_editor.getValue())}
- okText="确定" cancelText="取消">
- {/* onClick={this.saveCode}
- onClick={() => saveCode(this.extend_editor.getValue())}
- */}
- 保存
- }
-
-
-
-
-
-
+
+
+ style={{display:'none'}}
+ name="content">{fileContent}
+
+
+
-
+ this.saveCode(this.extend_editor.getValue())}/>
);
diff --git a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryCombinePath.js b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryCombinePath.js
index 8bc66acc8..932c6a94f 100644
--- a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryCombinePath.js
+++ b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryCombinePath.js
@@ -61,9 +61,9 @@ class RepositoryCombinePath extends Component {
margin-left: 24px;
}
`}
-
第一版本库合并路径
+
-
+ {!isEdit?"源路径:":"目标路径:"}
{!isEdit && 修改}
{isEdit && 保存}
diff --git a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryDirectories.js b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryDirectories.js
index 7c6eca37a..ea88cdfb8 100644
--- a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryDirectories.js
+++ b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryDirectories.js
@@ -31,27 +31,28 @@ class RepositoryDirectories extends Component {
{ pathArray.length !== 0 &&
-