Commit eec2dac2 authored by limingzhe's avatar limingzhe

fix: 今日作业上报

parent 08c5db95
......@@ -58,11 +58,11 @@ export default class NewClass extends middleLayerBase {
this.token = bundleInfo.token;
this.course_id = bundleInfo.course_id;
this.courseware_id = bundleInfo.courseware_id;
if (bundleInfo.homework_id != null && bundleInfo.syllabus_id != null && bundleInfo.user_id != null) {
this.setCurHomeworkData( bundleInfo.homework_id, bundleInfo.syllabus_id, bundleInfo.user_id);
this.initExitPanel();
this.initNetworkLoading();
}
// if (bundleInfo.homework_id != null && bundleInfo.syllabus_id != null && bundleInfo.user_id != null) {
// this.setCurHomeworkData( bundleInfo.homework_id, bundleInfo.syllabus_id, bundleInfo.user_id);
// this.initExitPanel();
// this.initNetworkLoading();
// }
cc.sys.localStorage.setItem('student_token', bundleInfo.token);
......@@ -211,11 +211,11 @@ export default class NewClass extends middleLayerBase {
console.log(' in exitGame data: ', data);
console.log(' this.token: ', this.token);
if (this.curHomeworkId != null) {
// if (this.curHomeworkId != null) {
this.showExitPanel();
return;
}
// this.showExitPanel();
// return;
// }
// if (this.node) {
......@@ -401,7 +401,7 @@ export default class NewClass extends middleLayerBase {
curHomeworkId;
curSyllabusId;
curUserId;
setCurHomeworkData(homework_id, syllabus_id, user_id) {
setCurHomeworkData(homework_id, syllabus_id, user_id = null) {
this.curHomeworkId = homework_id;
this.curSyllabusId = syllabus_id;
this.curUserId = user_id;
......@@ -418,6 +418,36 @@ export default class NewClass extends middleLayerBase {
callback = d1;
}
if (this.curHomeworkId == null || this.curSyllabusId == null) {
callback && callback();
return;
}
this.callNetworkApiPostNew(`api/app_source/v1/student/homework/finished`, {
syllabus_id: this.curSyllabusId,
homework_id: this.curHomeworkId,
result: JSON.stringify(data || {}),
}, res => {
this.curSyllabusId = null;
this.curHomeworkId = null;
callback && callback(res);
});
}
onHomeworkFinish2(d1 = null, d2 = null) {
console.log('in onHomeworkFinish');
let data = d1;
let callback = null;
if (typeof(d1) == 'function') {
data = d2;
callback = d1;
}
if (this.curHomeworkId == null || this.curSyllabusId == null || this.curUserId == null) {
callback && callback();
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment