|
|
@ -34,7 +34,12 @@ |
|
|
|
Result: null, |
|
|
|
CreateTime: new Date() |
|
|
|
}; |
|
|
|
this.SubmitTask(this.TaskInfo.Id); |
|
|
|
|
|
|
|
// Submit task
|
|
|
|
if (Config.InProductionMode) |
|
|
|
this.SubmitTask(this.TaskInfo.Id); |
|
|
|
else |
|
|
|
this.SubmitTest(this.TaskInfo.Id, 36.538, 64.850); |
|
|
|
}; |
|
|
|
|
|
|
|
this.OnResetButtonClick = function () { |
|
|
@ -70,7 +75,7 @@ |
|
|
|
$.ajax({ |
|
|
|
type: "GET", |
|
|
|
dataType: 'json', |
|
|
|
url: 'http://{0}/mg/check?num={1}'.format(Config.ApiRoot, this.TaskInfo.Id), |
|
|
|
url: this.getCheckUrl(this.TaskInfo.Id), |
|
|
|
success: function (result) { |
|
|
|
this.TaskInfo.Result = result; |
|
|
|
|
|
|
@ -87,8 +92,22 @@ |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
this.getCheckUrl = function (taskId) { |
|
|
|
if (Config.InProductionMode) |
|
|
|
return 'http://{0}/mg/check?num={1}'.format(Config.ApiRoot, taskId); |
|
|
|
else |
|
|
|
return '/Content/json/menggu/check.json'.format(taskId); |
|
|
|
}; |
|
|
|
|
|
|
|
this.getJsonUrl = function (taskId) { |
|
|
|
if (Config.InProductionMode) |
|
|
|
return "http://{0}/mg/getresult/{1}.json".format(Config.ApiRoot, taskId); |
|
|
|
else |
|
|
|
return '/Content/json/menggu/{0}.json'.format(taskId); |
|
|
|
}; |
|
|
|
|
|
|
|
this.LoadData = function (result) { |
|
|
|
$.getJSON("http://{0}/mg/getresult/{1}.json".format(Config.ApiRoot, result.num), function (data) { |
|
|
|
$.getJSON(this.getJsonUrl(result.num), function (data) { |
|
|
|
var param = this.GetTaskParams(this.TaskInfo.Id); |
|
|
|
this.Parent.Map.LoadAverageData('realtime-layer', { |
|
|
|
ReleaseTime: param.releaseTime, |
|
|
@ -191,6 +210,22 @@ |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
this.SubmitTest = function (taskId, lat, lon) { |
|
|
|
$.ajax({ |
|
|
|
type: "GET", |
|
|
|
dataType: 'json', |
|
|
|
url: this.getCheckUrl(taskId), |
|
|
|
success: function (result) { |
|
|
|
this.TaskInfo.Id = taskId; |
|
|
|
this.TaskInfo.Result = result; |
|
|
|
|
|
|
|
this.Parent.Map.CenterMap(lat, lon); |
|
|
|
this.AddTask(this.TaskInfo.Id); |
|
|
|
this.LoadData(result); |
|
|
|
}.bind(this) |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
this.AddTask = function (taskId) { |
|
|
|
$.ajax({ |
|
|
|
type: "POST", |
|
|
|