Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JM04-3
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
JM04-3
Commits
cef31024
Commit
cef31024
authored
Jul 22, 2021
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix
parent
d2e528a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
40 deletions
+61
-40
play.component.ts
src/app/play/play.component.ts
+61
-40
No files found.
src/app/play/play.component.ts
View file @
cef31024
...
...
@@ -601,7 +601,7 @@ export class PlayComponent implements OnInit, OnDestroy {
bgRight
.
ref
.
alpha
=
0
;
bgFocus
.
ref
.
alpha
=
1
;
bgWrong
.
ref
.
alpha
=
0
;
text
.
ref
.
fontColor
=
"
#
b17d5a
"
text
.
ref
.
fontColor
=
"
#
ffffff
"
break
;
case
"
wrong
"
:
bgInit
.
ref
.
alpha
=
0
;
...
...
@@ -616,11 +616,9 @@ export class PlayComponent implements OnInit, OnDestroy {
container
.
active
=
(
status
=
false
)
=>
{
if
(
status
)
{
if
(
container
.
getContentText
()
==
""
)
{
container
.
switchStatus
(
"
focus
"
)
}
container
.
switchStatus
(
"
focus
"
)
}
else
{
container
.
switchStatus
(
"
disable
"
)
container
.
switchStatus
(
"
right
"
)
}
if
(
status
)
{
this
.
m_currentInput
=
`block_
${
x
}
_
${
y
}
`
;
...
...
@@ -642,6 +640,10 @@ export class PlayComponent implements OnInit, OnDestroy {
container
.
setContentText
=
(
letter
)
=>
{
text
.
ref
.
text
=
letter
?
letter
:
""
;
if
(
!
this
.
checkAllFill
())
{
let
btnSub
=
this
.
g_cartoon
.
getCartoonElement
(
"
button_submit
"
)
btnSub
.
switchActive
(
true
)
}
}
container
.
getContentText
=
()
=>
{
...
...
@@ -673,32 +675,39 @@ export class PlayComponent implements OnInit, OnDestroy {
container
.
checkWhenSwitchQuestion
=
(
withRed
,
fromIndex
,
groupIndex
,
contentSaved
?)
=>
{
container
.
active
(
false
);
// 没有点击提交就切换,清空
if
(
!
this
.
m_submited
&&
questionIndex
==
fromIndex
)
{
container
.
setContentText
(
contentSaved
)
}
//
if(!this.m_submited && questionIndex==fromIndex) {
//
container.setContentText(contentSaved)
//
}
if
(
groupIndex
!=
this
.
m_currentQuestionIndex
)
{
if
(
container
.
getContentText
()
==
""
)
{
container
.
switchStatus
(
"
init
"
)
}
else
if
(
letter
!=
container
.
getContentText
())
{
container
.
switchStatus
(
"
wrong
"
)
}
else
{
container
.
switchStatus
(
"
right
"
)
container
.
switchStatus
(
"
disable
"
)
}
// if(container.getContentText() == "") {
// container.switchStatus("init")
// } else if(letter != container.getContentText()) {
// container.switchStatus("wrong")
// } else {
// container.switchStatus("right")
// }
}
else
{
if
(
container
.
getContentText
()
==
""
)
{
container
.
switchStatus
(
"
right
"
);
if
(
!
this
.
m_hasActiveBlock
)
{
this
.
m_hasActiveBlock
=
true
;
container
.
active
(
true
)
}
}
else
if
(
withRed
&&
(
letter
!=
container
.
getContentText
()))
{
this
.
m_hasErrorLetter
=
true
;
container
.
switchStatus
(
"
wrong
"
);
if
(
!
this
.
m_hasActiveBlock
)
{
this
.
m_hasActiveBlock
=
true
;
this
.
m_currentInputIndex
=
groupIndex
;
container
.
active
(
true
)
}
// if(container.getContentText() == "") {
// container.switchStatus("right");
// } else {
// container.switchStatus("right");
// this.m_hasErrorLetter = true;
// container.switchStatus("wrong");
// if(!this.m_hasActiveBlock) {
// this.m_hasActiveBlock = true;
// this.m_currentInputIndex = groupIndex;
// container.active(true)
// }
// }
container
.
switchStatus
(
"
right
"
)
if
(
!
this
.
m_hasActiveBlock
)
{
this
.
m_hasActiveBlock
=
true
;
container
.
active
(
true
)
}
}
}
...
...
@@ -708,6 +717,8 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
this
.
m_currentInput
)
{
let
currentAcitveNode
=
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_currentInput
)
currentAcitveNode
.
active
(
false
)
this
.
m_currentInputIndex
=
li
console
.
log
(
this
.
m_currentInputIndex
)
}
container
.
active
(
true
);
}
...
...
@@ -749,11 +760,12 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_blockFirstSubmit
[
i
]
=
true
;
}
let
indexArr
=
new
Array
(
this
.
g_formData
.
dataArray
.
length
).
fill
(
0
)
for
(
let
j
=
0
;
j
<
rolNum
;
j
++
)
{
for
(
let
i
=
0
;
i
<
colNum
;
i
++
)
{
let
qi
=
this
.
g_formData
.
grid
[
j
][
i
].
index
if
(
qi
>=
0
)
{
let
newBlock
=
createBlock
(
this
.
g_formData
.
grid
[
j
][
i
].
text
,
qi
,
i
,
sX
+
i
*
step
,
sY
+
j
*
step
,
900
/
colNum
-
5
,
900
/
colNum
-
5
)
let
newBlock
=
createBlock
(
this
.
g_formData
.
grid
[
j
][
i
].
text
,
qi
,
i
ndexArr
[
qi
]
++
,
sX
+
i
*
step
,
sY
+
j
*
step
,
900
/
colNum
-
5
,
900
/
colNum
-
5
)
this
.
m_wordAll
[
qi
]
+=
this
.
g_formData
.
grid
[
j
][
i
].
text
this
.
m_allBlocks
.
push
(
newBlock
)
element
.
ref
.
addChild
(
newBlock
.
ref
)
...
...
@@ -761,6 +773,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
}
console
.
log
(
indexArr
)
this
.
render
(
element
.
ref
)
}
...
...
@@ -830,7 +843,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_blockGroup
.
forEach
((
group
,
groupIndex
)
=>
{
group
.
forEach
((
block
,
index
)
=>
{
block
.
checkWhenSwitchQuestion
(
tru
e
,
fromIndex
,
groupIndex
,
this
.
m_wordLetterInputCatch
[
index
]?
this
.
m_wordLetterInputCatch
[
index
]:
""
)
block
.
checkWhenSwitchQuestion
(
fals
e
,
fromIndex
,
groupIndex
,
this
.
m_wordLetterInputCatch
[
index
]?
this
.
m_wordLetterInputCatch
[
index
]:
""
)
});
});
...
...
@@ -907,26 +920,34 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
this
.
m_currentInputIndex
>=
blocks
.
length
)
{
// 没有获取焦点的输入框,启用提交功能
if
(
!
this
.
m_hasActiveBlock
)
{
let
btn
=
this
.
g_cartoon
.
getCartoonElement
(
"
button_submit
"
)
btn
.
switchActive
(
true
);
}
//
if(!this.m_hasActiveBlock) {
//
let btn = this.g_cartoon.getCartoonElement("button_submit")
//
btn.switchActive(true);
//
}
// 切换当前输入从头开始
this
.
m_currentInputIndex
=
-
1
;
checkNextActive
();
// 判断是否需要激活(绿色不需要激活,红色或者蓝色没有文字需要激活)
if
(
blocks
[
this
.
m_currentInputIndex
].
canSetActive
())
{
blocks
[
this
.
m_currentInputIndex
].
active
(
true
)
}
}
else
{
// 判断是否需要激活(绿色不需要激活,红色或者蓝色没有文字需要激活)
if
(
blocks
[
this
.
m_currentInputIndex
].
canSetActive
())
{
blocks
[
this
.
m_currentInputIndex
].
active
(
true
)
}
}
// 判断是否需要激活(绿色不需要激活,红色或者蓝色没有文字需要激活)
if
(
blocks
[
this
.
m_currentInputIndex
].
canSetActive
())
{
blocks
[
this
.
m_currentInputIndex
].
active
(
true
)
}
}
checkAllFill
()
{
let
empty
=
false
;
this
.
m_blockGroup
.
forEach
(
group
=>
{
group
.
forEach
(
block
=>
{
if
(
!
empty
)
{
if
(
block
.
getContentText
()
==
""
)
{
empty
=
true
;
}
}
});
})
return
empty
;
}
...
...
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