updateFile切换关卡

dev_unstable
hjm 5 years ago
parent 6e7c302c9c
commit 26b78bcfb3

@ -230,6 +230,7 @@ class MainContentContainer extends Component {
&& prevProps.game.identifier !== game.identifier) {
// 切换关卡时,停止轮训
this.oldGameIdentifier = prevProps.game.identifier;
this.doFileUpdateRequestOnCodeMirrorBlur(prevProps)
}
}
@ -384,8 +385,8 @@ class MainContentContainer extends Component {
}
doFileUpdateRequestOnCodeMirrorBlur = () => {
var fileUpdatePromise = this.doFileUpdateRequest(true)
doFileUpdateRequestOnCodeMirrorBlur = (props) => {
var fileUpdatePromise = this.doFileUpdateRequest(true, undefined, props)
if (fileUpdatePromise) {
fileUpdatePromise.then((resData) => {
if (resData.status === -1) { // 保存文件出现异常
@ -494,7 +495,8 @@ class MainContentContainer extends Component {
}
// forTest true 是评测时触发的file_update
doFileUpdateRequest(checkIfCodeChanged, forTest) {
doFileUpdateRequest(checkIfCodeChanged, forTest, props) {
const _props = props || this.props;
const { codeStatus } = this.state;
if (!forTest && codeStatus !== UPDATED) { // 已修改状态才能保存
return;
@ -519,7 +521,7 @@ class MainContentContainer extends Component {
})
return null;
}
const { challenge, output_sets, onRunCodeTestFinish, myshixun } = this.props
const { challenge, output_sets, onRunCodeTestFinish, myshixun } = _props
// var url = `${locationPath}/file_update?path=${encodeURIComponent(challenge.path)}`
var url = `/myshixuns/${myshixun.identifier}/update_file.json`

Loading…
Cancel
Save