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
17ba377f
Commit
17ba377f
authored
Jul 22, 2021
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
808f229f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
21 deletions
+70
-21
package.json
package.json
+1
-1
play.component.ts
src/app/play/play.component.ts
+69
-20
No files found.
package.json
View file @
17ba377f
...
...
@@ -2,7 +2,7 @@
"name"
:
"ng-template-generator"
,
"version"
:
"0.0.1"
,
"scripts"
:
{
"start"
:
"ng serve"
,
"start"
:
"ng serve
--host 0.0.0.0
"
,
"build"
:
"ng build --build--optimizer --aot --base-href /JGT/v3/"
,
"publish"
:
"node ./bin/publish.js"
,
"ng"
:
"ng"
,
...
...
src/app/play/play.component.ts
View file @
17ba377f
...
...
@@ -411,6 +411,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let
le
=
createWord
(
letttes
[
i
-
1
],
baseX
,
baseY
)
this
.
subscribeMapDownEvent
(
le
.
id
,
async
()
=>
{
if
(
!
this
.
m_canInput
)
{
this
.
g_enableMapDown
=
true
;
return
}
let
target
=
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_currentInput
)
...
...
@@ -579,7 +580,8 @@ export class PlayComponent implements OnInit, OnDestroy {
bgRight
.
ref
.
alpha
=
0
;
bgFocus
.
ref
.
alpha
=
0
;
bgWrong
.
ref
.
alpha
=
0
;
text
.
ref
.
fontColor
=
"
#b17d5a
"
text
.
ref
.
fontColor
=
"
#b17d5a
"
;
container
.
modified
=
false
;
break
;
case
"
disable
"
:
bgInit
.
ref
.
alpha
=
0
;
...
...
@@ -587,7 +589,8 @@ export class PlayComponent implements OnInit, OnDestroy {
bgRight
.
ref
.
alpha
=
0
;
bgFocus
.
ref
.
alpha
=
0
;
bgWrong
.
ref
.
alpha
=
0
;
text
.
ref
.
fontColor
=
"
#b17d5a
"
text
.
ref
.
fontColor
=
"
#b17d5a
"
;
container
.
modified
=
false
;
break
;
case
"
right
"
:
bgInit
.
ref
.
alpha
=
0
;
...
...
@@ -603,7 +606,8 @@ export class PlayComponent implements OnInit, OnDestroy {
bgRight
.
ref
.
alpha
=
0
;
bgFocus
.
ref
.
alpha
=
1
;
bgWrong
.
ref
.
alpha
=
0
;
text
.
ref
.
fontColor
=
"
#ffffff
"
text
.
ref
.
fontColor
=
"
#ffffff
"
;
container
.
modified
=
false
;
break
;
case
"
wrong
"
:
bgInit
.
ref
.
alpha
=
0
;
...
...
@@ -611,7 +615,8 @@ export class PlayComponent implements OnInit, OnDestroy {
bgRight
.
ref
.
alpha
=
0
;
bgFocus
.
ref
.
alpha
=
0
;
bgWrong
.
ref
.
alpha
=
1
;
text
.
ref
.
fontColor
=
"
#ffffff
"
text
.
ref
.
fontColor
=
"
#ffffff
"
;
container
.
modified
=
false
;
break
;
}
}
...
...
@@ -620,6 +625,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
status
)
{
container
.
switchStatus
(
"
focus
"
)
}
else
{
console
.
log
(
"
3f
"
)
container
.
switchStatus
(
"
right
"
)
}
if
(
status
)
{
...
...
@@ -633,13 +639,15 @@ export class PlayComponent implements OnInit, OnDestroy {
}
return
true
}
container
.
modified
=
false
;
container
.
setContentText
=
(
letter
)
=>
{
text
.
ref
.
text
=
letter
?
letter
:
""
;
if
(
!
this
.
checkAllFill
())
{
let
btnSub
=
this
.
g_cartoon
.
getCartoonElement
(
"
button_submit
"
)
btnSub
.
switchActive
(
true
)
}
container
.
modified
=
true
;
}
container
.
getContentText
=
()
=>
{
...
...
@@ -650,32 +658,70 @@ export class PlayComponent implements OnInit, OnDestroy {
container
.
active
(
false
);
if
(
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
)
console
.
log
(
this
.
m_currentQuestionIndex
,
groupIndex
)
if
(
this
.
m_currentQuestionIndex
==
groupIndex
)
{
if
(
!
this
.
m_hasActiveBlock
)
{
container
.
switchStatus
(
"
focus
"
);
this
.
m_hasActiveBlock
=
true
;
this
.
m_currentInputIndex
=
groupIndex
;
container
.
active
(
true
)
}
else
{
console
.
log
(
"
R
"
)
container
.
switchStatus
(
"
wrong
"
);
}
}
else
{
container
.
switchStatus
(
"
wrong
"
);
}
}
else
{
container
.
isCorrect
=
true
;
container
.
switchStatus
(
"
right
"
)
if
(
this
.
m_currentInputIndex
==
groupIndex
)
{
console
.
log
(
"
V
"
)
container
.
switchStatus
(
"
right
"
)
}
else
{
container
.
switchStatus
(
"
disable
"
)
}
}
}
container
.
checkWhenSwitchQuestion
=
(
withRed
,
fromIndex
,
groupIndex
,
contentSaved
?)
=>
{
container
.
active
(
false
);
// container.active(false);
console
.
log
(
groupIndex
,
this
.
m_currentQuestionIndex
)
if
(
groupIndex
!=
this
.
m_currentQuestionIndex
)
{
if
(
container
.
getContentText
()
==
""
)
{
container
.
switchStatus
(
"
init
"
)
}
else
{
container
.
switchStatus
(
"
disable
"
)
if
(
this
.
m_submitedTimes
==
0
)
{
console
.
log
(
"
DVDVDVDV
"
)
container
.
switchStatus
(
"
disable
"
)
}
else
{
console
.
log
(
"
modified
"
,
container
.
modified
)
if
(
container
.
isCorrect
||
container
.
modified
)
{
container
.
switchStatus
(
"
disable
"
)
}
else
{
container
.
switchStatus
(
"
wrong
"
)
}
}
}
}
else
{
container
.
switchStatus
(
"
right
"
)
if
(
!
this
.
m_hasActiveBlock
)
{
this
.
m_hasActiveBlock
=
true
;
container
.
active
(
true
)
console
.
log
(
"
A
"
)
if
(
this
.
m_submitedTimes
==
0
)
{
container
.
switchStatus
(
"
right
"
)
if
(
!
this
.
m_hasActiveBlock
)
{
this
.
m_hasActiveBlock
=
true
;
container
.
active
(
true
)
}
}
else
{
if
(
container
.
isCorrect
)
{
container
.
switchStatus
(
"
right
"
)
}
else
{
container
.
switchStatus
(
"
wrong
"
)
}
if
(
!
this
.
m_hasActiveBlock
&&
!
container
.
isCorrect
)
{
this
.
m_hasActiveBlock
=
true
;
container
.
active
(
true
)
}
}
}
}
...
...
@@ -762,10 +808,10 @@ export class PlayComponent implements OnInit, OnDestroy {
submit
.
switchActive
=
(
status
)
=>
{
if
(
status
)
{
submit
.
ref
.
alpha
=
1
;
this
.
m_canInput
=
false
;
//
this.m_canInput = false;
}
else
{
submit
.
ref
.
alpha
=
0
;
this
.
m_canInput
=
true
;
//
this.m_canInput = true;
}
}
...
...
@@ -851,9 +897,10 @@ export class PlayComponent implements OnInit, OnDestroy {
// submit响应事件,会标红错误
updateStatusByGroupIndex
(
index
)
{
console
.
log
(
"
DVDVDVVVVVVVVVVVVVVVVV
"
)
let
blocks
=
this
.
m_blockGroup
[
index
];
this
.
m_hasErrorLetter
=
false
;
blocks
.
forEach
((
item
,
i
ndex
)
=>
{
blocks
.
forEach
((
item
,
i
)
=>
{
item
.
checkStatus
(
true
,
index
)
});
...
...
@@ -875,6 +922,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
!
blocks
[
this
.
m_currentInputIndex
])
{
return
;
}
let
checkNextActive
=
()
=>
{
// 当遇到绿色块 或者 索引小于题目数量时,循环
let
count
=
0
;
...
...
@@ -883,6 +931,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_currentInput
=
null
;
this
.
m_currentInputIndex
++
;
count
++
;
console
.
log
(
blocks
[
this
.
m_currentInputIndex
]?
blocks
[
this
.
m_currentInputIndex
].
isCorrect
:
"
-
"
)
}
while
(
count
<
blocks
.
length
&&
this
.
m_currentInputIndex
<
blocks
.
length
&&
blocks
[
this
.
m_currentInputIndex
].
isCorrect
)
}
...
...
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