Commit eca5f827 authored by limingzhe's avatar limingzhe

fix: 调整上报学情时机

parent 23e158e9
...@@ -435,10 +435,7 @@ export default class NewClass extends middleLayerBase { ...@@ -435,10 +435,7 @@ export default class NewClass extends middleLayerBase {
onHomeworkFinish(d1 = null, d2 = null) { onHomeworkFinish(d1 = null, d2 = null) {
if (this.studyRecord) {
this.reportData();
}
if (this.isRunCamp) { if (this.isRunCamp) {
this.onHomeworkFinishRunCamp(d1, d2); this.onHomeworkFinishRunCamp(d1, d2);
return; return;
...@@ -598,19 +595,28 @@ export default class NewClass extends middleLayerBase { ...@@ -598,19 +595,28 @@ export default class NewClass extends middleLayerBase {
} }
} }
showSRResultByRecord() { showSRResultByRecord(isShowScore = false) {
if (this.studyRecord) { if (this.studyRecord) {
this.studyRecordModel.recordData = this.studyRecord.getAllAudioKeyData(); this.studyRecordModel.recordData = this.studyRecord.getAllAudioKeyData();
const score = this.studyRecord.getTotalAverageAudioScore(); const score = this.studyRecord.getTotalAverageAudioScore();
this.showSRResult(score)
this.reportData(score);
if (isShowScore) {
this.showSRResult(score)
}
} }
} }
showSRResultByQuestion() { showSRResultByQuestion(isShowScore = false) {
if (this.studyRecord) { if (this.studyRecord) {
this.studyRecordModel.recordData = this.studyRecord.getAllQuestionResults(); this.studyRecordModel.recordData = this.studyRecord.getAllQuestionResults();
const score = this.studyRecord.getAverageScore(); const score = this.studyRecord.getAverageScore();
this.showSRResult(score) this.reportData(score);
if (isShowScore) {
this.showSRResult(score)
}
} }
...@@ -637,11 +643,11 @@ export default class NewClass extends middleLayerBase { ...@@ -637,11 +643,11 @@ export default class NewClass extends middleLayerBase {
} }
reportData() { reportData(score) {
console.log('reportData 1'); console.log('reportData 1');
if (this.studyRecord) { if (this.studyRecord) {
console.log('reportData 2'); console.log('reportData 2');
const reportData = this.studyRecord.reportData(this.studyRecordModel); const reportData = this.studyRecord.reportData(this.studyRecordModel, score);
// 在这里处理网络请求 // 在这里处理网络请求
this.callNetworkApiPostNew(`insights/v1/study-analysis`, { this.callNetworkApiPostNew(`insights/v1/study-analysis`, {
......
...@@ -326,7 +326,7 @@ class StudyRecord { ...@@ -326,7 +326,7 @@ class StudyRecord {
} }
// ==================== 数据上报方法 ==================== // ==================== 数据上报方法 ====================
reportData(studyRecordModel) { reportData(studyRecordModel, score) {
// 注意:这个方法需要在使用时传入正确的上下文 // 注意:这个方法需要在使用时传入正确的上下文
// 因为 this.callNetworkApiPostNew 可能不存在于 StudyRecord 类中 // 因为 this.callNetworkApiPostNew 可能不存在于 StudyRecord 类中
console.log('reportData called with:', studyRecordModel); console.log('reportData called with:', studyRecordModel);
...@@ -339,7 +339,8 @@ class StudyRecord { ...@@ -339,7 +339,8 @@ class StudyRecord {
totalAudioDuration: this.getTotalAudioDuration(), totalAudioDuration: this.getTotalAudioDuration(),
totalQuestions: this.totalQuestions, totalQuestions: this.totalQuestions,
questionResults: this.getAllQuestionResults(), questionResults: this.getAllQuestionResults(),
averageScore: this.getAverageScore() averageScore: this.getAverageScore(),
totalScore: score
}; };
console.log('Prepared report data:', reportData); console.log('Prepared report data:', reportData);
......
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