Commit 2af6a8e3 authored by 李维's avatar 李维

feat: 更新作业完成上报数据结构

parent 327b071d
...@@ -1233,16 +1233,27 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -1233,16 +1233,27 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 准备提交的数据 // 准备提交的数据
let data: any = {}; let data: any = {};
data.total = Game.getIns().getTotal; // 总题目数 const voices = Game.getIns().player.voices
data.right = Game.getIns().player.right; // 正确题目数 const details = []
data.scores = Game.getIns().player.voices; // 语音记录 let totalScore = 0;
data.stone = Math.floor(10 * data.right / data.total); // 计算得分 for(let i = 0; i < voices.length; i++) {
details.push({
recorder_url: voices[i].audioUrl,
score: voices[i].result.overall
})
totalScore += Number.parseInt(voices[i].result.overall) || 0;
}
// 计算平均分
data.score = Math.ceil(totalScore / voices.length);
// 记录录音数据
data.details = details;
// 模板名称
data.templateName = "SSAPP2502";
// 记录日志 // 记录日志
this.log("total: " + data.total + " right: " + data.right + " stone: " + data.stone); console.log(data)
// 提交作业完成数据 // 提交作业完成数据
// onHomeworkFinish(data) onHomeworkFinish(data)
// 显示重新开始 // 显示重新开始
this.showRestart(); this.showRestart();
} }
......
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