Commit ba5b918c authored by limingzhe's avatar limingzhe

feat: 上报数据

parent 829edc41
...@@ -299,6 +299,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -299,6 +299,7 @@ export class PlayComponent implements OnInit, OnDestroy {
resultSv; resultSv;
uploadUrl; uploadUrl;
userData;
initData() { initData() {
...@@ -332,6 +333,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -332,6 +333,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this.uploadUrl = url; this.uploadUrl = url;
}; };
this.userData = {};
this.topArr = []; this.topArr = [];
...@@ -556,24 +559,20 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -556,24 +559,20 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
c.onEvent('game_start', (data, next) => {
this.gameStart();
if (next) {
next();
}
});
if (this.isTeacher) { if (this.isTeacher) {
return; return;
} }
c.onEvent('sendBtnClick', (data, next) => { c.onEvent('sendBtnClick', (data, next) => {
let infoText = '发题接收'// `sendBtnClick: data: ${JSON.stringify(data)}\n`
const durTime = new Date().getTime() - data.time const durTime = new Date().getTime() - data.time
infoText += ' 用时: ' + ( Math.round( durTime / 1000 * 1000) / 1000) + '' const useTime = ( Math.round( durTime / 1000 * 1000) / 1000) ;
const infoText = '发题 用时: ' + useTime + ''
this.infoLabel.text = infoText; this.infoLabel.text = infoText;
this.sendTestData('sendBtn', useTime, infoText);
next(); next();
}); });
c.onEvent('uploadAudioBtn1Click', (data, next) => { c.onEvent('uploadAudioBtn1Click', (data, next) => {
...@@ -581,37 +580,37 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -581,37 +580,37 @@ export class PlayComponent implements OnInit, OnDestroy {
//30秒 //30秒
const audioUrl = 'http://staging-teach.cdn.ireadabc.com/107582309ca6d5de35404bcf56af69bf.mp3' const audioUrl = 'http://staging-teach.cdn.ireadabc.com/107582309ca6d5de35404bcf56af69bf.mp3'
this.uploadTestAudio('30秒', audioUrl); this.uploadTestAudio('30秒', audioUrl, 30);
next(); next();
}); });
c.onEvent('uploadAudioBtn2Click', (data, next) => { c.onEvent('uploadAudioBtn2Click', (data, next) => {
this.infoLabel.text = `uploadAudioBtn2Click: data: ${JSON.stringify(data)}`; this.infoLabel.text = `uploadAudioBtn2Click: data: ${JSON.stringify(data)}`;
const audioUrl = 'http://staging-teach.cdn.ireadabc.com/7c1f608da28f4a42646724c4011bfd46.mp3' const audioUrl = 'http://staging-teach.cdn.ireadabc.com/7c1f608da28f4a42646724c4011bfd46.mp3'
this.uploadTestAudio('1分钟', audioUrl); this.uploadTestAudio('1分钟', audioUrl, 60);
next(); next();
}); });
c.onEvent('uploadAudioBtn3Click', (data, next) => { c.onEvent('uploadAudioBtn3Click', (data, next) => {
this.infoLabel.text = `uploadAudioBtn3Click: data: ${JSON.stringify(data)}`; this.infoLabel.text = `uploadAudioBtn3Click: data: ${JSON.stringify(data)}`;
const audioUrl = 'http://staging-teach.cdn.ireadabc.com/b1c832ecdd7e58632af6c48f37245b88.mp3' const audioUrl = 'http://staging-teach.cdn.ireadabc.com/b1c832ecdd7e58632af6c48f37245b88.mp3'
this.uploadTestAudio('1分半', audioUrl); this.uploadTestAudio('1分半', audioUrl, 90);
next(); next();
}); });
c.onEvent('uploadAudioBtn4Click', (data, next) => { c.onEvent('uploadAudioBtn4Click', (data, next) => {
this.infoLabel.text = `uploadAudioBtn4Click: data: ${JSON.stringify(data)}`; this.infoLabel.text = `uploadAudioBtn4Click: data: ${JSON.stringify(data)}`;
const audioUrl = 'http://staging-teach.cdn.ireadabc.com/3b6ea60055587e6d6fce27d179bf36eb.mp3' const audioUrl = 'http://staging-teach.cdn.ireadabc.com/3b6ea60055587e6d6fce27d179bf36eb.mp3'
this.uploadTestAudio('2分半', audioUrl); this.uploadTestAudio('2分半', audioUrl, 120);
next(); next();
}); });
c.onEvent('uploadAudioBtn5Click', (data, next) => { c.onEvent('uploadAudioBtn5Click', (data, next) => {
this.infoLabel.text = `uploadAudioBtn5Click: data: ${JSON.stringify(data)}`; this.infoLabel.text = `uploadAudioBtn5Click: data: ${JSON.stringify(data)}`;
const audioUrl = 'http://staging-teach.cdn.ireadabc.com/82b7cd5a8ac70b12d2b70229bae990ea.mp3' const audioUrl = 'http://staging-teach.cdn.ireadabc.com/82b7cd5a8ac70b12d2b70229bae990ea.mp3'
this.uploadTestAudio('3分钟', audioUrl); this.uploadTestAudio('3分钟', audioUrl, 180);
next(); next();
}); });
c.onEvent('uploadAudioBtn6Click', (data, next) => { c.onEvent('uploadAudioBtn6Click', (data, next) => {
this.infoLabel.text = `uploadAudioBtn6Click: data: ${JSON.stringify(data)}`; this.infoLabel.text = `uploadAudioBtn6Click: data: ${JSON.stringify(data)}`;
const audioUrl = 'http://staging-teach.cdn.ireadabc.com/811fad370642b71d21ed7f47f95a9d04.mp3' const audioUrl = 'http://staging-teach.cdn.ireadabc.com/811fad370642b71d21ed7f47f95a9d04.mp3'
this.uploadTestAudio('5分钟', audioUrl); this.uploadTestAudio('5分钟', audioUrl, 300);
next(); next();
}); });
...@@ -668,6 +667,36 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -668,6 +667,36 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
sendTestData(key, useTime, info) {
let testData = this.getStoreData('testData');
if (!testData) {
testData = {};
}
testData[key] = {
useTime,
info
}
this.setStoreData('testData', testData, false);
const sendAnswer = window['courseware'].sendAnswer;
if (!sendAnswer) {
this.infoLabel.text = '=-=-=-=-= 接口异常: sendAnswer';
return;
}
sendAnswer(testData);
console.log('testData: ', testData);
}
showSendAnswer() { showSendAnswer() {
const sendAnswer = window['courseware'].sendAnswer; const sendAnswer = window['courseware'].sendAnswer;
if (!sendAnswer) { if (!sendAnswer) {
...@@ -680,9 +709,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -680,9 +709,10 @@ export class PlayComponent implements OnInit, OnDestroy {
const endTime = new Date().getTime(); const endTime = new Date().getTime();
const durTime = endTime - startTime; const durTime = endTime - startTime;
this.infoLabel.text = '上报成绩 用时' + (Math.round(durTime / 1000 * 1000) / 1000 ) + '' const useTime = (Math.round(durTime / 1000 * 1000) / 1000 )
this.infoLabel.text = '上报成绩 用时' + useTime + ''
console.log('res: ', res); console.log('res: ', res);
this.sendTestData('lansiEvaluation', useTime, this.infoLabel.text);
}}) }})
} }
...@@ -699,8 +729,11 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -699,8 +729,11 @@ export class PlayComponent implements OnInit, OnDestroy {
// res 需要toJSON // res 需要toJSON
const endTime = new Date().getTime(); const endTime = new Date().getTime();
const durTime = endTime - startTime; const durTime = endTime - startTime;
this.infoLabel.text = '蓝思值 用时' + (Math.round(durTime / 1000 * 1000) / 1000 ) + '' const useTime = (Math.round(durTime / 1000 * 1000) / 1000 );
this.infoLabel.text = '蓝思值 用时' + useTime + ''
console.log('res: ', res); console.log('res: ', res);
this.sendTestData('lansiEvaluation', useTime, this.infoLabel.text);
}) })
} }
...@@ -716,8 +749,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -716,8 +749,10 @@ export class PlayComponent implements OnInit, OnDestroy {
// res 需要toJSON // res 需要toJSON
const endTime = new Date().getTime(); const endTime = new Date().getTime();
const durTime = endTime - startTime; const durTime = endTime - startTime;
this.infoLabel.text = '词性检查 用时' + (Math.round(durTime / 1000 * 1000) / 1000 ) + '' const useTime = (Math.round(durTime / 1000 * 1000) / 1000 );
this.infoLabel.text = '词性检查 用时' + useTime + ''
console.log('res: ', res); console.log('res: ', res);
this.sendTestData('greadPapersForCheck', useTime, this.infoLabel.text);
}) })
} }
...@@ -750,8 +785,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -750,8 +785,12 @@ export class PlayComponent implements OnInit, OnDestroy {
greadPapersForText({text: this.checkText}, (res) => { greadPapersForText({text: this.checkText}, (res) => {
const endTime = new Date().getTime(); const endTime = new Date().getTime();
const durTime = endTime - startTime; const durTime = endTime - startTime;
this.infoLabel.text = '文本纠错 用时' + (Math.round(durTime / 1000 * 1000) / 1000 ) + '' const useTime = (Math.round(durTime / 1000 * 1000) / 1000 );
this.infoLabel.text = '文本纠错 用时' + useTime + ''
console.log('res: ', res); console.log('res: ', res);
this.sendTestData('greadPapersForText', useTime, this.infoLabel.text);
}) })
...@@ -776,7 +815,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -776,7 +815,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}); });
} }
uploadTestAudio(text, url) { uploadTestAudio(text, url, key) {
this.url2Blob(url).then((res) => { this.url2Blob(url).then((res) => {
...@@ -795,7 +834,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -795,7 +834,10 @@ export class PlayComponent implements OnInit, OnDestroy {
const endTime = new Date().getTime(); const endTime = new Date().getTime();
const durTime = endTime - startTime; const durTime = endTime - startTime;
this.infoLabel.text = '音频'+text+'上传 用时' + (Math.round(durTime / 1000 * 1000) / 1000 ) + '' const useTime = (Math.round(durTime / 1000 * 1000) / 1000 )
this.infoLabel.text = '音频'+text+'上传 用时' + useTime + ''
this.sendTestData('uploadAudio-' + key, useTime, this.infoLabel.text);
} }
}); });
......
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