Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DF-L211
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
DF-L211
Commits
cb223069
Commit
cb223069
authored
May 28, 2020
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
d7e354d2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
26 deletions
+38
-26
form.component.html
src/app/form/form.component.html
+4
-4
form.component.ts
src/app/form/form.component.ts
+0
-2
Exercises.ts
src/app/play/Exercises.ts
+21
-15
play.component.ts
src/app/play/play.component.ts
+13
-5
No files found.
src/app/form/form.component.html
View file @
cb223069
...
@@ -54,10 +54,10 @@
...
@@ -54,10 +54,10 @@
<tr
*
ngFor=
"let data of answersTable.data;let j = index"
>
<tr
*
ngFor=
"let data of answersTable.data;let j = index"
>
<td>
{{j+1}}
</td>
<td>
{{j+1}}
</td>
<td>
<td>
<nz-
select
[(
ngModel
)]="
data
.
contentType
"
nzPlaceHolder=
"请选择
"
(
ngModelChange
)="
setAnswerType
($
event
,
data
)"
>
<nz-
radio-group
[(
ngModel
)]="
data
.
contentType
"
(
ngModelChange
)="
setAnswerType
($
event
,
data
)"
>
<
nz-option
nzValue=
"T"
nzLabel=
"文字"
></nz-option
>
<
label
nz-radio
nzValue=
"T"
>
文字
</label
>
<
nz-option
nzValue=
"P"
nzLabel=
"图片"
></nz-option
>
<
label
nz-radio
nzValue=
"P"
>
图片
</label
>
</nz-
select
>
</nz-
radio-group
>
</td>
</td>
<td>
<td>
<div
*
ngIf=
"data.contentType == 'P'"
>
<div
*
ngIf=
"data.contentType == 'P'"
>
...
...
src/app/form/form.component.ts
View file @
cb223069
...
@@ -83,8 +83,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -83,8 +83,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
*/
*/
save
()
{
save
()
{
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
saveKey
);
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
saveKey
);
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
this
.
refresh
();
}
}
...
...
src/app/play/Exercises.ts
View file @
cb223069
...
@@ -5,7 +5,7 @@ import {
...
@@ -5,7 +5,7 @@ import {
Label
Label
}
from
'
./Unit
'
;
}
from
'
./Unit
'
;
export
class
Exercise
{
export
class
Exercise
{
exercise
;
exercise
;
...
@@ -13,24 +13,30 @@ export class Exercise{
...
@@ -13,24 +13,30 @@ export class Exercise{
answers
=
[];
answers
=
[];
constructor
(
exercise
){
constructor
(
exercise
)
{
this
.
exercise
=
exercise
;
this
.
exercise
=
exercise
;
}
}
addAnswer
(
answer
:
Answer
)
{
addAnswer
(
answer
:
Answer
)
{
this
.
answers
.
push
(
answer
);
this
.
answers
.
push
(
answer
);
}
}
set
listeningAudio
(
audio
){
set
listeningAudio
(
audio
)
{
this
.
_listeningAudio
=
audio
;
this
.
_listeningAudio
=
audio
;
}
}
get
listeningAudio
(){
get
listeningAudio
()
{
return
this
.
_listeningAudio
;
return
this
.
_listeningAudio
;
}
}
reset
()
{
for
(
let
i
=
0
;
i
<
this
.
answers
.
length
;
++
i
)
{
this
.
answers
[
i
].
reset
();
}
}
}
}
export
class
Answer
{
export
class
Answer
{
bg
;
bg
;
...
@@ -54,7 +60,7 @@ export class Answer{
...
@@ -54,7 +60,7 @@ export class Answer{
selected
=
false
;
selected
=
false
;
constructor
(
images
,
answerContent
){
constructor
(
images
,
answerContent
)
{
this
.
images
=
images
;
this
.
images
=
images
;
...
@@ -100,7 +106,7 @@ export class Answer{
...
@@ -100,7 +106,7 @@ export class Answer{
let
scale
=
Math
.
min
((
parItem
.
height
-
15
*
this
.
scaleX
)
/
h
,
(
parItem
.
width
-
15
*
this
.
scaleY
)
/
w
);
let
scale
=
Math
.
min
((
parItem
.
height
-
15
*
this
.
scaleX
)
/
h
,
(
parItem
.
width
-
15
*
this
.
scaleY
)
/
w
);
//如果小于1,则缩放图片
//如果小于1,则缩放图片
if
(
scale
<
1
)
{
if
(
scale
<
1
)
{
content_pic
.
setScaleXY
(
scale
);
content_pic
.
setScaleXY
(
scale
);
}
}
...
@@ -140,11 +146,11 @@ export class Answer{
...
@@ -140,11 +146,11 @@ export class Answer{
}
}
getWidth
(){
getWidth
()
{
return
234
*
this
.
scaleX
;
return
234
*
this
.
scaleX
;
}
}
getHeight
(){
getHeight
()
{
return
178
*
this
.
scaleY
;
return
178
*
this
.
scaleY
;
}
}
...
@@ -181,21 +187,21 @@ export class Answer{
...
@@ -181,21 +187,21 @@ export class Answer{
* @param callback
* @param callback
*/
*/
moveOut
(
toX
,
toY
,
callback
=
null
)
{
moveOut
(
toX
,
toY
,
callback
=
null
)
{
if
(
this
.
contentType
==
'
T
'
)
{
if
(
this
.
contentType
==
'
T
'
)
{
this
.
bg
.
x
=
toX
;
this
.
bg
.
x
=
toX
;
this
.
bg
.
y
=
toY
;
this
.
bg
.
y
=
toY
;
tweenChange
(
this
.
contentSprite
,
{
alpha
:
0
},
0.3
,
callback
);
tweenChange
(
this
.
contentSprite
,
{
alpha
:
0
},
0.3
,
callback
);
}
}
else
if
(
this
.
contentType
==
'
P
'
)
{
else
if
(
this
.
contentType
==
'
P
'
)
{
this
.
bg
.
x
=
toX
;
this
.
bg
.
x
=
toX
;
this
.
bg
.
y
=
toY
;
this
.
bg
.
y
=
toY
;
tweenChange
(
this
.
contentSprite
,
{
alpha
:
0
},
0.3
,
callback
);
tweenChange
(
this
.
contentSprite
,
{
alpha
:
0
},
0.3
,
callback
);
}
}
}
}
reset
(){
reset
()
{
this
.
selected
=
false
;
this
.
selected
=
false
;
}
}
}
}
\ No newline at end of file
src/app/play/play.component.ts
View file @
cb223069
...
@@ -713,16 +713,18 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -713,16 +713,18 @@ export class PlayComponent implements OnInit, OnDestroy {
return
box
;
return
box
;
}
}
const
midBox
=
initBox
(
'
mid
'
);
midBox
.
boxBg
.
x
=
(
this
.
canvasWidth
-
midBox
.
boxBg
.
width
)
/
2
;
this
.
midBox
=
midBox
;
const
rightBox
=
initBox
(
'
right
'
);
const
rightBox
=
initBox
(
'
right
'
);
rightBox
.
boxBg
.
x
=
869
*
this
.
mapScale
;
rightBox
.
boxBg
.
x
=
midBox
.
boxBg
.
x
+
99
*
this
.
mapScale
+
midBox
.
boxBg
.
width
;
this
.
rightBox
=
rightBox
;
this
.
rightBox
=
rightBox
;
const
midBox
=
initBox
(
'
mid
'
);
midBox
.
boxBg
.
x
=
506
*
this
.
mapScale
;
this
.
midBox
=
midBox
;
const
leftBox
=
initBox
(
'
left
'
);
const
leftBox
=
initBox
(
'
left
'
);
leftBox
.
boxBg
.
x
=
133
*
this
.
mapScale
;
leftBox
.
boxBg
.
x
=
midBox
.
boxBg
.
x
-
99
*
this
.
mapScale
-
rightBox
.
boxBg
.
width
;
this
.
leftBox
=
leftBox
;
this
.
leftBox
=
leftBox
;
}
}
...
@@ -809,6 +811,10 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -809,6 +811,10 @@ export class PlayComponent implements OnInit, OnDestroy {
initGame
()
{
initGame
()
{
for
(
let
i
=
0
;
i
<
this
.
exerciseArr
.
length
;
++
i
)
{
this
.
exerciseArr
[
i
].
reset
();
}
this
.
tempExerciseArr
=
randomSortByArr
(
this
.
exerciseArr
);
this
.
tempExerciseArr
=
randomSortByArr
(
this
.
exerciseArr
);
this
.
lemonArr
=
[];
this
.
lemonArr
=
[];
...
@@ -905,6 +911,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -905,6 +911,8 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
if
(
this
.
checkClickTarget
(
this
.
restartBtn
.
bg
))
{
if
(
this
.
checkClickTarget
(
this
.
restartBtn
.
bg
))
{
this
.
canTouch
=
false
;
this
.
restartBtn
.
click
(()
=>
{
this
.
restartBtn
.
click
(()
=>
{
this
.
player
.
reset
();
this
.
player
.
reset
();
...
...
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