Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JM_network_test
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
JM_network_test
Commits
ba5b918c
Commit
ba5b918c
authored
Oct 25, 2021
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 上报数据
parent
829edc41
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
22 deletions
+64
-22
play.component.ts
src/app/play/play.component.ts
+64
-22
No files found.
src/app/play/play.component.ts
View file @
ba5b918c
...
...
@@ -299,6 +299,7 @@ export class PlayComponent implements OnInit, OnDestroy {
resultSv
;
uploadUrl
;
userData
;
initData
()
{
...
...
@@ -332,6 +333,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
uploadUrl
=
url
;
};
this
.
userData
=
{};
this
.
topArr
=
[];
...
...
@@ -556,24 +559,20 @@ export class PlayComponent implements OnInit, OnDestroy {
}
c
.
onEvent
(
'
game_start
'
,
(
data
,
next
)
=>
{
this
.
gameStart
();
if
(
next
)
{
next
();
}
});
if
(
this
.
isTeacher
)
{
return
;
}
c
.
onEvent
(
'
sendBtnClick
'
,
(
data
,
next
)
=>
{
let
infoText
=
'
发题接收
'
// `sendBtnClick: data: ${JSON.stringify(data)}\n`
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
.
sendTestData
(
'
sendBtn
'
,
useTime
,
infoText
);
next
();
});
c
.
onEvent
(
'
uploadAudioBtn1Click
'
,
(
data
,
next
)
=>
{
...
...
@@ -581,37 +580,37 @@ export class PlayComponent implements OnInit, OnDestroy {
//30秒
const
audioUrl
=
'
http://staging-teach.cdn.ireadabc.com/107582309ca6d5de35404bcf56af69bf.mp3
'
this
.
uploadTestAudio
(
'
30秒
'
,
audioUrl
);
this
.
uploadTestAudio
(
'
30秒
'
,
audioUrl
,
30
);
next
();
});
c
.
onEvent
(
'
uploadAudioBtn2Click
'
,
(
data
,
next
)
=>
{
this
.
infoLabel
.
text
=
`uploadAudioBtn2Click: data:
${
JSON
.
stringify
(
data
)}
`
;
const
audioUrl
=
'
http://staging-teach.cdn.ireadabc.com/7c1f608da28f4a42646724c4011bfd46.mp3
'
this
.
uploadTestAudio
(
'
1分钟
'
,
audioUrl
);
this
.
uploadTestAudio
(
'
1分钟
'
,
audioUrl
,
60
);
next
();
});
c
.
onEvent
(
'
uploadAudioBtn3Click
'
,
(
data
,
next
)
=>
{
this
.
infoLabel
.
text
=
`uploadAudioBtn3Click: data:
${
JSON
.
stringify
(
data
)}
`
;
const
audioUrl
=
'
http://staging-teach.cdn.ireadabc.com/b1c832ecdd7e58632af6c48f37245b88.mp3
'
this
.
uploadTestAudio
(
'
1分半
'
,
audioUrl
);
this
.
uploadTestAudio
(
'
1分半
'
,
audioUrl
,
90
);
next
();
});
c
.
onEvent
(
'
uploadAudioBtn4Click
'
,
(
data
,
next
)
=>
{
this
.
infoLabel
.
text
=
`uploadAudioBtn4Click: data:
${
JSON
.
stringify
(
data
)}
`
;
const
audioUrl
=
'
http://staging-teach.cdn.ireadabc.com/3b6ea60055587e6d6fce27d179bf36eb.mp3
'
this
.
uploadTestAudio
(
'
2分半
'
,
audioUrl
);
this
.
uploadTestAudio
(
'
2分半
'
,
audioUrl
,
120
);
next
();
});
c
.
onEvent
(
'
uploadAudioBtn5Click
'
,
(
data
,
next
)
=>
{
this
.
infoLabel
.
text
=
`uploadAudioBtn5Click: data:
${
JSON
.
stringify
(
data
)}
`
;
const
audioUrl
=
'
http://staging-teach.cdn.ireadabc.com/82b7cd5a8ac70b12d2b70229bae990ea.mp3
'
this
.
uploadTestAudio
(
'
3分钟
'
,
audioUrl
);
this
.
uploadTestAudio
(
'
3分钟
'
,
audioUrl
,
180
);
next
();
});
c
.
onEvent
(
'
uploadAudioBtn6Click
'
,
(
data
,
next
)
=>
{
this
.
infoLabel
.
text
=
`uploadAudioBtn6Click: data:
${
JSON
.
stringify
(
data
)}
`
;
const
audioUrl
=
'
http://staging-teach.cdn.ireadabc.com/811fad370642b71d21ed7f47f95a9d04.mp3
'
this
.
uploadTestAudio
(
'
5分钟
'
,
audioUrl
);
this
.
uploadTestAudio
(
'
5分钟
'
,
audioUrl
,
300
);
next
();
});
...
...
@@ -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
()
{
const
sendAnswer
=
window
[
'
courseware
'
].
sendAnswer
;
if
(
!
sendAnswer
)
{
...
...
@@ -680,9 +709,10 @@ export class PlayComponent implements OnInit, OnDestroy {
const
endTime
=
new
Date
().
getTime
();
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
);
this
.
sendTestData
(
'
lansiEvaluation
'
,
useTime
,
this
.
infoLabel
.
text
);
}})
}
...
...
@@ -699,8 +729,11 @@ export class PlayComponent implements OnInit, OnDestroy {
// res 需要toJSON
const
endTime
=
new
Date
().
getTime
();
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
);
this
.
sendTestData
(
'
lansiEvaluation
'
,
useTime
,
this
.
infoLabel
.
text
);
})
}
...
...
@@ -716,8 +749,10 @@ export class PlayComponent implements OnInit, OnDestroy {
// res 需要toJSON
const
endTime
=
new
Date
().
getTime
();
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
);
this
.
sendTestData
(
'
greadPapersForCheck
'
,
useTime
,
this
.
infoLabel
.
text
);
})
}
...
...
@@ -750,8 +785,12 @@ export class PlayComponent implements OnInit, OnDestroy {
greadPapersForText
({
text
:
this
.
checkText
},
(
res
)
=>
{
const
endTime
=
new
Date
().
getTime
();
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
);
this
.
sendTestData
(
'
greadPapersForText
'
,
useTime
,
this
.
infoLabel
.
text
);
})
...
...
@@ -776,7 +815,7 @@ export class PlayComponent implements OnInit, OnDestroy {
});
}
uploadTestAudio
(
text
,
url
)
{
uploadTestAudio
(
text
,
url
,
key
)
{
this
.
url2Blob
(
url
).
then
((
res
)
=>
{
...
...
@@ -795,7 +834,10 @@ export class PlayComponent implements OnInit, OnDestroy {
const
endTime
=
new
Date
().
getTime
();
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
);
}
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment