Commit f214cf03 authored by limingzhe's avatar limingzhe

fix: debug

parent 9a505f25
...@@ -58,8 +58,8 @@ export default class NewClass extends middleLayerBase { ...@@ -58,8 +58,8 @@ export default class NewClass extends middleLayerBase {
this.token = bundleInfo.token; this.token = bundleInfo.token;
this.course_id = bundleInfo.course_id; this.course_id = bundleInfo.course_id;
this.courseware_id = bundleInfo.courseware_id; this.courseware_id = bundleInfo.courseware_id;
if (bundleInfo.homework_id != null && bundleInfo.syllabus_id != null) { if (bundleInfo.homework_id != null && bundleInfo.syllabus_id != null && bundleInfo.user_id != null) {
this.setCurHomeworkData( bundleInfo.homework_id, bundleInfo.syllabus_id); this.setCurHomeworkData( bundleInfo.homework_id, bundleInfo.syllabus_id, bundleInfo.user_id);
} }
cc.sys.localStorage.setItem('student_token', bundleInfo.token); cc.sys.localStorage.setItem('student_token', bundleInfo.token);
...@@ -340,14 +340,15 @@ export default class NewClass extends middleLayerBase { ...@@ -340,14 +340,15 @@ export default class NewClass extends middleLayerBase {
curHomeworkId; curHomeworkId;
curSyllabusId; curSyllabusId;
setCurHomeworkData(homework_id, syllabus_id) { curUserId;
setCurHomeworkData(homework_id, syllabus_id, user_id) {
this.curHomeworkId = homework_id; this.curHomeworkId = homework_id;
this.curSyllabusId = syllabus_id; this.curSyllabusId = syllabus_id;
this.curUserId = user_id;
} }
onHomeworkFinish(d1 = null, d2 = null) { onHomeworkFinish(d1 = null, d2 = null) {
console.log('onHomeworkFinish');
let data = d1; let data = d1;
let callback = null; let callback = null;
if (typeof(d1) == 'function') { if (typeof(d1) == 'function') {
...@@ -355,32 +356,21 @@ export default class NewClass extends middleLayerBase { ...@@ -355,32 +356,21 @@ export default class NewClass extends middleLayerBase {
callback = d1; callback = d1;
} }
if (this.curHomeworkId == null || this.curSyllabusId == null) { if (this.curHomeworkId == null || this.curSyllabusId == null || this.curUserId == null) {
callback && callback(); callback && callback();
return; return;
} }
if (!global.userInfo) { this.callNetworkApiPostNew(`learning-camp/finish/${this.curUserId}/${this.curHomeworkId}`, {
return; syllabus_id: this.curSyllabusId,
} homework_id: this.curHomeworkId,
result: JSON.stringify(data || {}),
console.log("global.userInfo:" + global.userInfo); }, res => {
console.log("this.curHomeworkId:" + this.curHomeworkId);
console.log("this.curSyllabusId:" + this.curSyllabusId);
callback && callback();
// 'learning-camp/finish/$userId/$homeworkId';
// this.callNetworkApiPostNew(`learning-camp/finish/${userId}/${this.curHomeworkId}`, {
// syllabus_id: this.curSyllabusId,
// homework_id: this.curHomeworkId,
// result: JSON.stringify(data || {}),
// }, res => {
// this.curSyllabusId = null; this.curSyllabusId = null;
// this.curHomeworkId = null; this.curHomeworkId = null;
// callback && callback(res); callback && callback(res);
// }); });
} }
......
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