dev_aliyun2
杨树明 5 years ago committed by harry
parent c7d18c8931
commit ff1aa828e5

@ -144,22 +144,24 @@ const interceptorUrlArray = ['repository.json', 'commits.json', 'propaedeutics.j
, 'challenges.json', 'discusses.json', 'ranking_list.json', 'collaborators.json']
const cacheInterceptorUrlMap = {}
class TPMIndex extends Component {
constructor(props) {
super(props)
this.state = {
loadingContent: false,
power: false,
shixunsDetails: {},
shixunId: undefined,
star_info: [0, 0, 0, 0, 0, 0],
star_infos: [0, 0, 0, 0, 0, 0],
identity: undefined,
TPMRightSectionData: undefined,
PropaedeuticsList: undefined,
tpmindexjupyterbool: false,
is_jupyter: false,
selectedKeys: "",
openknows: false
constructor(props) {
super(props)
this.state = {
loadingContent: false,
power: false,
shixunsDetails: {},
shixunId: undefined,
star_info: [0, 0, 0, 0, 0, 0],
star_infos: [0, 0, 0, 0, 0, 0],
identity:undefined,
TPMRightSectionData:undefined,
PropaedeuticsList: undefined,
tpmindexjupyterbool:false,
is_jupyter:false,
selectedKeys:"",
openknows:false,
newathArray:[]
}
}
}
@ -379,23 +381,28 @@ class TPMIndex extends Component {
this.props.history.replace(`/shixuns/${id}/settings`);
}
}
render() {
let url = window.location.href;
let flag = false;
// url.indexOf("add_file")>-1;
return (
<div className="newMain clearfix">
{/*头部*/}
{
!flag &&
<TPMBanner
{...this.props}
{...this.state}
is_jupyter={this.state.is_jupyter}
></TPMBanner>
}
setpathArray=(list)=>{
this.setState({
newathArray:list
})
}
render() {
let url = window.location.href;
let flag =false;
// url.indexOf("add_file")>-1;
return (
<div className="newMain clearfix">
{/*头部*/}
{
!flag &&
<TPMBanner
{...this.props}
{...this.state}
is_jupyter={this.state. is_jupyter}
></TPMBanner>
}
<style>
@ -545,24 +552,24 @@ class TPMIndex extends Component {
}></Route>
<Route path="/shixuns/:shixunId/repository/master/shixun_show/:fileId" render={
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter} setpathArray={(value)=>this.setpathArray(value)}
/>)
}></Route>
<Route path="/shixuns/:shixunId/secret_repository/master/shixun_show/:fileId" render={
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} secret_repository_tab={true} is_jupyter={this.state.is_jupyter}
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} secret_repository_tab={true} is_jupyter={this.state.is_jupyter} setpathArray={(value)=>this.setpathArray(value)}
/>)
}></Route>
<Route path="/shixuns/:shixunId/repository" render={
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter} setpathArray={(value)=>this.setpathArray(value)}
/>)
}></Route>
<Route path="/shixuns/:shixunId/secret_repository" render={
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} secret_repository_tab={true} is_jupyter={this.state.is_jupyter}
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} secret_repository_tab={true} is_jupyter={this.state.is_jupyter} setpathArray={(value)=>this.setpathArray(value)}
/>)
}></Route>
@ -570,94 +577,97 @@ class TPMIndex extends Component {
{/* <Route exact path="/shixuns/:shixunId/propaedeutics" component={TPMPropaedeuticsComponent}></Route> */}
<Route path="/shixuns/:shixunId/shixun_discuss" render={
(props) => (<TPMShixunDiscussContainer {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
initForumState={(data) => this.initForumState(data)}
setSearchValue={this.setSearchValue}
setHotLabelIndex={this.setHotLabelIndex}
/>)
}></Route>
{/* <Route exact path="/shixuns/:shixunId/repository/:shixunId/" component={TPMRepositoryComponent}></Route> */}
<Route path="/shixuns/:shixunId/settings" render={
(props) => (<TPMsettings {...this.props} {...this.state} {...props} />)
}></Route>
{/*实训项目条目塞选*/}
<Route exact path="/shixuns/:shixunId/ranking_list" render={
(props) => (<TPMRanking_listComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
{/*合作者*/}
<Route exact path="/shixuns/:shixunId/dataset" render={
(props) => (<TPMDataset {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
<Route path="/shixuns/:shixunId/shixun_discuss" render={
(props) => (<TPMShixunDiscussContainer {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
initForumState={(data)=>this.initForumState(data)}
setSearchValue={this.setSearchValue}
setHotLabelIndex={this.setHotLabelIndex}
/>)
}></Route>
<Route exact path="/shixuns/:shixunId/audit_situation" render={
(props) => (<Audit_situationComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
<Route exact path="/shixuns/:shixunId/fork_list" render={
(props) => (<TPMFork_listComponent {...this.props} {...props}
/>)
}></Route>
<Route path="/shixuns/:shixunId/settings" render={
(props) => (<TPMsettings {...this.props} {...this.state} {...props} getcomponentdidmount={()=>this.getcomponentdidmount()} />)
}></Route>
<Route exact path="/shixuns/:shixunId/update_propaedeutics" render={
(props) => (<TPMUpdatepropaede {...this.props} {...props}
/>)
}></Route>
{/*实训项目条目塞选*/}
<Route exact path="/shixuns/:shixunId/ranking_list" render={
(props) => (<TPMRanking_listComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
{/*合作者*/}
<Route exact path="/shixuns/:shixunId/dataset" render={
(props) => (<TPMDataset {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
<Route exact path="/shixuns/:shixunId/audit_situation" render={
(props) => (<Audit_situationComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
<Route exact path="/shixuns/:shixunId/fork_list" render={
(props) => (<TPMFork_listComponent {...this.props} {...props}
/>)
}></Route>
{/*评测设置*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/tab=2" render={
(props) => (<TPMevaluation {...this.props} {...props} {...this.state} />)
}></Route>
<Route exact path="/shixuns/:shixunId/update_propaedeutics" render={
(props) => (<TPMUpdatepropaede {...this.props} {...props}
/>)
}></Route>
{/*评测设置*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/tab=2" render={
(props) => (<TPMevaluation {...this.props} {...props} {...this.state}/>)
}></Route>
{/*参考答案*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/tab=3" render={
(props) => (<TPManswer {...this.props} {...props} {...this.state} />)
}></Route>
{/*新建关卡*/}
<Route path="/shixuns/:shixunId/challenges/new" render={
(props) => (<TPMchallengesnew {...this.props} {...props} {...this.state} />)
}></Route>
{/*参考答案*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/tab=3" render={
(props) => (<TPManswer {...this.props} {...props} {...this.state}/>)
}></Route>
{/*编辑关卡*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/editcheckpoint" render={
(props) => (<TPMchallengesnew {...this.props} {...props} {...this.state} />)
}></Route>
{/*新建关卡*/}
<Route path="/shixuns/:shixunId/challenges/new" render={
(props) => (<TPMchallengesnew {...this.props} {...props} {...this.state}/>)
}></Route>
{/*新建选择题*/}
<Route path="/shixuns/:shixunId/challenges/newquestion" render={
(props) => (<TPMquestion {...this.props} {...props} {...this.state} />)
}></Route>
{/*编辑关卡*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/editcheckpoint" render={
(props) => (<TPMchallengesnew {...this.props} {...props} {...this.state} />)
}></Route>
{/*修改选择题*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/editquestion/:choose_id" render={
(props) => (<TPMquestion {...this.props} {...props} {...this.state} />)
}></Route>
{/*新建选择题*/}
<Route path="/shixuns/:shixunId/challenges/newquestion" render={
(props) => (<TPMquestion {...this.props} {...props} {...this.state} />)
}></Route>
{/*修改选择题*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/editquestion" render={
(props) => (<TPMquestion {...this.props} {...props} {...this.state} />)
}></Route>
{/*修改选择题*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/editquestion/:choose_id" render={
(props) => (<TPMquestion {...this.props} {...props} {...this.state}/>)
}></Route>
<Route exact path="/shixuns/:shixunId" render={
(props) => (<TPMChallengeComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
{/*修改选择题*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/editquestion" render={
(props) => (<TPMquestion {...this.props} {...props} {...this.state}/>)
}></Route>
<Route exact path="/shixuns/:shixunId" render={
(props) => (<TPMChallengeComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
{/*<Route exact path="/shixuns/:shixunId" component={TPMChallengeComponent}></Route>*/}
</Switch>
{/*<Route exact path="/shixuns/:shixunId" component={TPMChallengeComponent}></Route>*/}
</Switch>
</div>
);
}
</div>
);
}
}
export default SnackbarHOC()(TPMIndexHOC(TPMIndex));

@ -32,6 +32,7 @@ class TPMRepositoryComponent extends Component {
pathArray: pathArray,
isContentWidth100: this._isFileInPathArray(pathArray)
}
this.props.setpathArray(pathArray)
}
componentDidUpdate(prevProps, prevState) {
if (this.props.secret_repository_tab != prevProps.secret_repository_tab) {
@ -106,6 +107,7 @@ class TPMRepositoryComponent extends Component {
})
this.setState({ repositoryLoading: true, pathArray: newPathArray })
this.props.setpathArray(newPathArray)
this.setState({
fileContent: response.data.content,
repositoryLoading: false
@ -113,7 +115,7 @@ class TPMRepositoryComponent extends Component {
if(response.data.content){
this.props.history
.replace(`/shixuns/${id}/repository` +
.replace(`/shixuns/${id}/${this.props.secret_repository_tab ? 'secret_repository' : 'repository'}` +
(newPathArray.length ? `/master/shixun_show/${newPathArray.join('/')}` : ''))
// this.props.history.replace(`${this.props.match.url}/master/shixun_show/${newPathArray.join('/')}`)
}
@ -174,6 +176,7 @@ class TPMRepositoryComponent extends Component {
}
// https://testeduplus2.educoder.net/shixuns/3ozvy5f8/repository.json
this.setState({ repositoryLoading: true, pathArray: newPathArray })
this.props.setpathArray(newPathArray)
let urlNewPathArray = newPathArray;
let fileInPathArray = false;
if (newPathArray.length) {
@ -215,7 +218,7 @@ class TPMRepositoryComponent extends Component {
});
this.props.history
.replace(`/shixuns/${id}/repository` +
.replace(`/shixuns/${id}/${this.props.secret_repository_tab ? 'secret_repository' : 'repository'}` +
(newPathArray.length ? `/master/shixun_show/${newPathArray.join('/')}` : ''))
}
@ -237,16 +240,7 @@ class TPMRepositoryComponent extends Component {
}
render() {
const { listItemtypes } = this.state;
let matchpath =this.props.match.path;
let flag =false;
// if(matchpath==="/shixuns/:shixunId/repository"){
// flag =true;
// }else if(matchpath==="/shixuns/:shixunId/secret_repository"){
// flag =true;
// }
// 需要重构
return (
<React.Fragment>
{ listItemtypes===false? <TPMRepository

@ -54,6 +54,7 @@ export default class TPMsettings extends Component {
}
});
this.props.getcomponentdidmount()
//
// if(key==="3"&&this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter === true){
// window.location.href =`/shixuns/${this.props.match.params.shixunId}/challenges`;

@ -42,15 +42,15 @@ class TPMNav extends Component {
{ this.props.identity >4||this.props.identity===undefined ?"":
(this.props.is_jupyter===false?
<Link to={`/shixuns/${shixunId}/repository`}
className={`${match.url.indexOf('/repository') != -1 ? 'active' : ''} fl mr40`}>版本库</Link>
<a href={`/shixuns/${shixunId}/repository`}
className={`${match.url.indexOf('/repository') != -1 ? 'active' : ''} fl mr40`}>版本库</a>
:"")
}
{this.props.identity >4||this.props.identity===undefined ?"": secret_repository && <Link to={`/shixuns/${shixunId}/secret_repository`}
className={`${match.url.indexOf('secret_repository') != -1 ? 'active' : ''} fl mr40`}>私密版本库</Link>}
{this.props.identity >4||this.props.identity===undefined ?"": secret_repository && <a href={`/shixuns/${shixunId}/secret_repository`}
className={`${match.url.indexOf('secret_repository') != -1 ? 'active' : ''} fl mr40`}>私密版本库</a>}
<Link to={`/shixuns/${shixunId}/collaborators`}
className={`${match.url.indexOf('collaborators') != -1 ? 'active' : ''} fl mr40`}>合作者</Link>

@ -189,6 +189,7 @@ class Repository extends Component {
{this.state.evaluationvisible===true?<Repositoryfile
{...this.state}
{...this.props}
Repositoryflag={Repositoryflag}
hideNewFolder={()=>this.hideNewFolder()}
setfilepath={(path)=>this.setfilepath(path)}
/>:""}

@ -88,7 +88,7 @@ class RepositoryAddFile extends Component {
window.editor_tempCodeMirror = extend_editor;
this.extend_editor = extend_editor;
}
checkPath= (rule, value, callback) =>{
if(!value){
callback('文件名不能为空');
@ -179,6 +179,19 @@ class RepositoryAddFile extends Component {
{/* </Breadcrumb>*/}
{/*</p>*/}
<Form onSubmit={this.handleSubmit} className="formStyle">
<style>
{
`
.padding20-30{
padding:20px 30px 5px 30px;
}
.formStyle .ant-form-item{
margin-bottom:0px !important;
height:60px;
}
`
}
</style>
<div className="edu-back-white padding20-30">
<p className="ant-form-item-label">
<div className={"font-20 color-black"}>新建文件</div>
@ -195,15 +208,33 @@ class RepositoryAddFile extends Component {
<Input placeholder="必填描述主要修改内容相当于Git Commit message的Header" size="large" className="winput-300-35 fl "/>
)}
</Form.Item>
<div className={"mt20"}>
{getFieldDecorator('path')(
<div className={"mt50"}>
<Form.Item>
{getFieldDecorator('path', {
rules: [{
required: true, message: '请输入提交信息',
},{
whitespace: true, message: '请勿输入空格'
}],
})(
<span>
<span> </span><span><Input placeholder="文件名称或文件路径" className=" fl" style={{ width: 200 }} size="large"/></span><span className={"mt10 ml10 fl"}>提示:输入 / 可以将文件创建到新文件夹下</span>
<span> </span><span><Input placeholder="文件名称或文件路径" className=" fl" style={{ width: 200 }} size="large"/></span><span className={" ml10 fl"}>提示:输入 / 可以将文件创建到新文件夹下</span>
</span>
)}
</Form.Item>
</div>
</div>
<div className="edu-back-white padding30">
<style>
{
`
.padding30{
padding:0px 30px 30px 30px;
}
`
}
</style>
<div className="mt10 mb25 repoCMWrapper filecode">
<textarea className="" id="codemirror-file-edit" style={{display:'none'}} name="content"></textarea>

@ -25,11 +25,27 @@ class RepositoryAddFileupload_files extends Component {
}
componentDidMount(){
if(this.props.newathArray){
if(this.props.newathArray.length>0){
let newfilspath="";
let list=this.props.newathArray;
list.map((item,key)=>{
if(key===0){
newfilspath=item;
}else{
newfilspath=newfilspath+'/'+item;
}
})
this.setState({
filspath:newfilspath
})
}
}
}
handleChange = (info) => {
console.log(info)
if (info.file.status === 'done'||info.file.status === "uploading") {
@ -178,7 +194,7 @@ class RepositoryAddFileupload_files extends Component {
this.props.showNotification("上传文件请先填写提交信息")
return false
}
console.log(file)
this.props.showNotification("上传成功")
},
};
@ -285,7 +301,9 @@ class RepositoryAddFileupload_files extends Component {
</div>
</Form>
</div>
{/*<Bottomsubmit {...this.props} {...this.state} url={`/shixuns/${shixunId}/${Repositoryflag}${this.state.filspath===""?"":"/master/shixun_show/"+this.state.filspath}`} bottomvalue={"确定"}/>*/}
<Bottomsubmit {...this.props} {...this.state} url={`/shixuns/${shixunId}/${Repositoryflag}`} bottomvalue={"确定"}/>
</div>
)
}

@ -23,7 +23,64 @@ class Repositoryfile extends Component{
}
componentDidMount() {
this.goblakepath("")
let pathArrays;
if(this.props.pathArray){
pathArrays=this.props.pathArray;
}else{
pathArrays=this.props.newathArray;
}
let path='';
let ary=[];
if(pathArrays){
if(pathArrays.length>0){
pathArrays.map((item,key)=>{
if(key===0){
path=item;
ary.push({val:"根目录",path:""},{val:"/"+item,path:path});
}else{
path=path+'/'+item;
ary.push({val:"/"+item,path:path});
}
})
}
}
this.getdata(path,ary)
}
getdata(path,ary){
let matchpath =this.props.match.path;
let id = this.props.match.params.shixunId;
let url ="";
if( matchpath.indexOf("repository")>-1){
url ="/shixuns/"+id+"/repository.json";
}
if(matchpath.indexOf("secret_repository")>-1){
url ="/shixuns/"+id+"/secret_repository.json";
}
axios.post(url,{
path: path
}).then((response) => {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else {
this.setState({
trees: response.data.trees,
path: path,
main: ary,
// selectpath:selectpath
})
}
}).catch((error) => {
console.log(error)
});
}
goblakepath=(path,key)=>{
@ -127,6 +184,7 @@ class Repositoryfile extends Component{
if(matchpath.indexOf("secret_repository")>-1){
flag =true;
}
if(this.props.selectupfils===true){
this.props.selectupfilspath(path);
this.props.showNotification("选择文件目录成功")
@ -147,16 +205,18 @@ class Repositoryfile extends Component{
let url=`/shixuns/${this.props.match.params.shixunId}/upload_git_folder.json`;
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
let types=false;
trees.map((item,key)=>{
if(item.type==="tree"){
if(item.name===values.name){
types=true
return
if(trees){
trees.map((item,key)=>{
if(item.type==="tree"){
if(item.name===values.name){
types=true
return
}
}
}
})
})
}
if(types===true){
this.props.showNotification("请勿新建相同名字的文件夹")
@ -216,6 +276,7 @@ class Repositoryfile extends Component{
</style>
<div className="newupload_conbox clearfix">
<ul id="directory_file">
{console.log(main)}
{
main.length===0?"":main.map((item,key)=>{
return(

Loading…
Cancel
Save