|
|
|
@ -207,12 +207,13 @@ class MainContentContainer extends Component {
|
|
|
|
|
if (newProps.game && newProps.st === 0) {
|
|
|
|
|
if (!this.props || !this.props.game
|
|
|
|
|
|| ( newProps.game.identifier !== this.props.game.identifier ) ) {
|
|
|
|
|
setTimeout(this.fetchRepositoryCode( newProps), 1500);
|
|
|
|
|
} else if ( this.props.challenge.pathIndex != newProps.challenge.pathIndex
|
|
|
|
|
&& newProps.challenge.pathIndex !== -1) { // 切换到只读文件
|
|
|
|
|
// pathIndex切换
|
|
|
|
|
setTimeout(this.fetchRepositoryCode( newProps), 1500);
|
|
|
|
|
}
|
|
|
|
|
// else if ( this.props.challenge.pathIndex != newProps.challenge.pathIndex
|
|
|
|
|
// && newProps.challenge.pathIndex !== -1) { // 切换到只读文件
|
|
|
|
|
// pathIndex切换
|
|
|
|
|
// setTimeout(this.fetchRepositoryCode( newProps), 1500);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
if (newProps.myshixun) {
|
|
|
|
|
var stageId = newProps.match.params.stageId;
|
|
|
|
@ -231,7 +232,11 @@ class MainContentContainer extends Component {
|
|
|
|
|
// 切换关卡时,停止轮训
|
|
|
|
|
this.oldGameIdentifier = prevProps.game.identifier;
|
|
|
|
|
this.doFileUpdateRequestOnCodeMirrorBlur(prevProps)
|
|
|
|
|
} else if (challenge && (challenge.pathIndex || prevProps.challenge.pathIndex) && challenge.pathIndex != prevProps.challenge.pathIndex) {
|
|
|
|
|
}
|
|
|
|
|
// else if (this.props.shixun && this.props.shixun.code_edit_permission && this.state.currentPath != prevState.currentPath) {
|
|
|
|
|
// this.doFileUpdateRequestOnCodeMirrorBlur(prevProps)
|
|
|
|
|
// }
|
|
|
|
|
else if (challenge && (challenge.pathIndex || prevProps.challenge.pathIndex) && challenge.pathIndex != prevProps.challenge.pathIndex) {
|
|
|
|
|
this.doFileUpdateRequestOnCodeMirrorBlur(prevProps)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -253,6 +258,9 @@ class MainContentContainer extends Component {
|
|
|
|
|
this.setState({ codeLoading: false });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (type && arg_path) {
|
|
|
|
|
this.doFileUpdateRequestOnCodeMirrorBlur(this.props)
|
|
|
|
|
}
|
|
|
|
|
const stageId = game.identifier
|
|
|
|
|
let path;
|
|
|
|
|
let isEditablePath = false;
|
|
|
|
@ -535,7 +543,9 @@ class MainContentContainer extends Component {
|
|
|
|
|
this.oldRepositoryCode = codeContent;
|
|
|
|
|
|
|
|
|
|
let argPath;
|
|
|
|
|
if (challenge.pathIndex === -1) { // 当前是只读文件
|
|
|
|
|
if (this.props.shixun && this.props.shixun.code_edit_permission == true) {
|
|
|
|
|
argPath = this.state.currentPath
|
|
|
|
|
} else if (challenge.pathIndex === -1) { // 当前是只读文件
|
|
|
|
|
argPath = challenge.multiPath === true ? challenge.path[0] : challenge.path
|
|
|
|
|
} else {
|
|
|
|
|
argPath = challenge.multiPath === true ? challenge.path[challenge.pathIndex] : challenge.path
|
|
|
|
@ -624,6 +634,11 @@ class MainContentContainer extends Component {
|
|
|
|
|
gameBuilding: false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
onPathChange = (index, isDropDown) => {
|
|
|
|
|
this.props.onPathChange(index, () => {
|
|
|
|
|
isDropDown && this.fetchRepositoryCode()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
onRunCodeTest() {
|
|
|
|
|
// tipContent(0, 100, 30, 360, 1)
|
|
|
|
|
// return; // for test
|
|
|
|
@ -634,7 +649,7 @@ class MainContentContainer extends Component {
|
|
|
|
|
showDialog({
|
|
|
|
|
contentText: '需要先切回可编辑的文件才可评测,确认要现在切换吗?',
|
|
|
|
|
callback: () => {
|
|
|
|
|
onPathChange(0)
|
|
|
|
|
this.onPathChange(0, true)
|
|
|
|
|
handleGdialogClose();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -957,7 +972,9 @@ class MainContentContainer extends Component {
|
|
|
|
|
onRepositoryCodeUpdate={this.onRepositoryCodeUpdate} onRunCodeTest={this.onRunCodeTest}
|
|
|
|
|
codemirrorDidMount={this.codemirrorDidMount} fetchRepositoryCode={this.fetchRepositoryCode}
|
|
|
|
|
showResetCodeDialog={this.showResetCodeDialog} showResetPassedCodeDialog={this.showResetPassedCodeDialog}
|
|
|
|
|
doFileUpdateRequestOnCodeMirrorBlur={this.doFileUpdateRequestOnCodeMirrorBlur} ></MainContent>
|
|
|
|
|
doFileUpdateRequestOnCodeMirrorBlur={this.doFileUpdateRequestOnCodeMirrorBlur}
|
|
|
|
|
onPathChange={this.onPathChange}
|
|
|
|
|
></MainContent>
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|