|
|
|
@ -129,7 +129,8 @@ class TPIContextProvider extends Component {
|
|
|
|
|
tpm_cases_modified,
|
|
|
|
|
tpm_modified,
|
|
|
|
|
tpm_script_modified,
|
|
|
|
|
showUpdateDialog: false
|
|
|
|
|
showUpdateDialog: false,
|
|
|
|
|
initTime: 0
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -145,7 +146,6 @@ class TPIContextProvider extends Component {
|
|
|
|
|
|
|
|
|
|
window.__fetchAllFlag = false;
|
|
|
|
|
this.fetchAll(stageId);
|
|
|
|
|
|
|
|
|
|
this.costTimeInterval = window.setInterval(()=> {
|
|
|
|
|
const { game } = this.state;
|
|
|
|
|
if (!game || game.status === 2) { // 已完成的任务不需要计时
|
|
|
|
@ -167,7 +167,7 @@ class TPIContextProvider extends Component {
|
|
|
|
|
}
|
|
|
|
|
// force 评测通过后,异步执行该方法,强制同步costTime到服务端
|
|
|
|
|
_updateCostTime(async = false, force) {
|
|
|
|
|
const { game, loading } = this.state;
|
|
|
|
|
const { game, loading, initTime = 0 } = this.state;
|
|
|
|
|
// TODO 还有一种情况,通关后cost_time计时停止,没法通过这个判断
|
|
|
|
|
if (!force && (loading || !game || game.status === 2)) {
|
|
|
|
|
return; // 已完成的任务不需要处理
|
|
|
|
@ -178,12 +178,13 @@ class TPIContextProvider extends Component {
|
|
|
|
|
}
|
|
|
|
|
// var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time`
|
|
|
|
|
var url = `${testPath}/api/tasks/${ game.identifier }/cost_time`
|
|
|
|
|
const disTime = Math.abs(game.cost_time - initTime);
|
|
|
|
|
window.$.ajax({
|
|
|
|
|
type: 'get',
|
|
|
|
|
url: url,
|
|
|
|
|
async: async, //IMPORTANT, the call will be synchronous
|
|
|
|
|
data: {
|
|
|
|
|
time: game.cost_time
|
|
|
|
|
time: disTime
|
|
|
|
|
}
|
|
|
|
|
}).done((data) => {
|
|
|
|
|
console.log('complete');
|
|
|
|
@ -406,7 +407,6 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
|
}
|
|
|
|
|
resData.game = game;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { tpm_cases_modified, tpm_modified, tpm_script_modified, myshixun } = resData;
|
|
|
|
|
if (myshixun.system_tip) {
|
|
|
|
|
// system_tip为true的时候 不弹框提示用户更新
|
|
|
|
@ -440,7 +440,7 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
...resData,
|
|
|
|
|
|
|
|
|
|
initTime: game.cost_time,
|
|
|
|
|
currentGamePassed: false,
|
|
|
|
|
loading: false,
|
|
|
|
|
testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0),
|
|
|
|
@ -519,7 +519,6 @@ pop_box_new(htmlvalue, 480, 182);
|
|
|
|
|
|
|
|
|
|
// var url = `/api/v1/games/${stageId}`
|
|
|
|
|
var url = `/tasks/${stageId}.json`
|
|
|
|
|
|
|
|
|
|
// {"status":1,"message":"undefined method `authenticate!' for #<Grape::Endpoint:0xc8c91c0>"}
|
|
|
|
|
window.__fetchAllFlag = true;
|
|
|
|
|
|
|
|
|
|