Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JM-07
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-07
Commits
a60035dd
Commit
a60035dd
authored
Aug 06, 2021
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 评测分析
parent
05373ff7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
4 deletions
+58
-4
index.css
play/index.css
+29
-1
index.js
play/index.js
+29
-3
No files found.
play/index.css
View file @
a60035dd
...
...
@@ -626,6 +626,7 @@ body {
}
#recorder-text
{
position
:
relative
;
width
:
98%
;
height
:
50%
;
overflow-x
:
inherit
;
...
...
@@ -664,7 +665,7 @@ body {
overflow-y
:
auto
;
margin-top
:
0.4rem
;
text-align
:
left
;
padding
:
0.2rem
0.
8
rem
;
padding
:
0.2rem
0.
4
rem
;
margin-left
:
5%
;
object-fit
:
contain
;
font-family
:
DroidSansFallback
;
...
...
@@ -677,4 +678,31 @@ body {
color
:
#ffffff
;
background-color
:
#2c8a1e
;
border-radius
:
0.3rem
;
}
.err-grammar-number
{
position
:
absolute
;
background
:
#dcc077
;
top
:
-0.01rem
;
width
:
0.3rem
;
height
:
0.3rem
;
font-size
:
0.10rem
;
border-radius
:
0.3rem
;
line-height
:
0.26rem
;
text-align
:
center
;
font-family
:
Aileron-Bold
;
transform
:
translate
(
-0.1rem
);
}
.err-grammar-index
{
display
:
inline-block
;
background
:
#dcc077
;
width
:
0.4rem
;
height
:
0.4rem
;
font-size
:
0.10rem
;
border-radius
:
0.4rem
;
line-height
:
0.35rem
;
text-align
:
center
;
font-family
:
Aileron-Bold
;
transform
:
translate
(
-0.1rem
,
-0.05rem
);
}
\ No newline at end of file
play/index.js
View file @
a60035dd
...
...
@@ -868,13 +868,36 @@ function drawResult(data, text) {
fontColor
=
'
nicetry
'
;
}
const
{
annotationHtml
,
evaluateHtml
}
=
annotation
(
text
,
temp
.
detail
);
$
(
"
.tips
"
).
empty
().
append
(
tips
).
addClass
(
fontColor
);
$
(
"
#medal
"
).
attr
(
'
src
'
,
imgSrc
);
$
(
"
#score
"
).
empty
().
append
(
score
);
$
(
"
#recorder-text
"
).
empty
().
append
(
text
);
$
(
"
#evaluation
"
).
empty
().
append
(
temp
.
evaluate
);
$
(
"
#recorder-text
"
).
html
(
annotationHtml
);
$
(
"
#evaluation
"
).
html
(
evaluateHtml
);
}
function
insertString
(
string
,
insert
,
index
){
return
string
.
substring
(
0
,
index
)
+
insert
+
string
.
substr
(
index
);
}
function
annotation
(
text
,
detail
){
let
annotationHtml
=
text
.
trim
();
const
allFeatureAdvice
=
detail
.
AllFeatureAdvice
;
let
evaluateHtml
=
`
${
allFeatureAdvice
.
WordDiversity
}
;
${
allFeatureAdvice
.
Structure
}
;
${
allFeatureAdvice
.
Spelling
}
;
${
allFeatureAdvice
.
Grammar
}
<br>`
;
const
errorPosInfos
=
detail
.
essayFeedback
.
sentsFeedback
[
0
].
errorPosInfos
;
for
(
let
i
=
errorPosInfos
.
length
-
1
;
i
>=
0
;
i
--
){
const
errPos
=
errorPosInfos
[
i
];
const
startPos
=
errPos
.
startPos
;
annotationHtml
=
insertString
(
annotationHtml
,
`<span class="err-grammar-number">
${
i
+
1
}
</span>`
,
startPos
);
}
for
(
let
i
=
0
;
i
<
errorPosInfos
.
length
;
i
++
){
const
errPos
=
errorPosInfos
[
i
];
const
reason
=
errPos
.
reason
;
evaluateHtml
+=
`<br><span class="err-grammar-index">
${
i
+
1
}
</span>
${
reason
}
`
;
}
return
{
annotationHtml
,
evaluateHtml
};
}
function
scoreByText
(
text
,
keyWords
,
timeLen
)
{
const
smallText
=
text
.
toLowerCase
();
...
...
@@ -926,5 +949,8 @@ function scoreByText(text, keyWords, timeLen) {
const
fluency
=
Math
.
round
(
rate2
*
100
)
/
100
;
// 流利度
return
{
integrity
,
fluency
};
return
{
integrity
:
integrity
||
0
,
fluency
:
fluency
||
0
};
}
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