Commit 51bc723b authored by 李维's avatar 李维

feat: 修改作业完成上报数据格式

parent e6bde9b9
......@@ -1298,16 +1298,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 准备提交的数据
let data: any = {};
data.total = Game.getIns().getTotal; // 总题目数
data.right = Game.getIns().player.right; // 正确题目数
data.scores = Game.getIns().player.voices; // 语音记录
data.stone = Math.floor(10 * data.right / data.total); // 计算得分
const voices = Game.getIns().player.voices
const details = []
let totalScore = 0;
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 = "SSAPP2501";
// 记录日志
this.log("total: " + data.total + " right: " + data.right + " stone: " + data.stone);
console.log(data)
// 提交作业完成数据
// onHomeworkFinish(data)
onHomeworkFinish(data)
// 显示重新开始
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