Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM-22
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
YM-22
Commits
cc34407c
Commit
cc34407c
authored
Apr 23, 2020
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善
parent
80eba6ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
36 deletions
+39
-36
Exercises.ts
src/app/play/Exercises.ts
+2
-2
play.component.ts
src/app/play/play.component.ts
+37
-34
No files found.
src/app/play/Exercises.ts
View file @
cc34407c
...
...
@@ -28,10 +28,10 @@ export class Exercises {
wordSplitPic
:
ShapeRect
=
null
;
/**单词发音 */
wordAudio
Url
:
''
;
wordAudio
Key
;
/**字母(组合)发音 */
letterAudio
Url
:
''
;
letterAudio
Key
;
/**单词拆分的字母(组合) */
letterArr
=
[];
...
...
src/app/play/play.component.ts
View file @
cc34407c
...
...
@@ -72,6 +72,8 @@ export class PlayComponent implements OnInit, OnDestroy {
/**音频播放状态 */
playStatus
=
false
;
isListenAudio
=
false
;
/**当前播放的curAudio */
curAudio
;
...
...
@@ -548,19 +550,19 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
addUrlToAudioObj
(
'
click
'
,
this
.
rawAudios
.
get
(
'
click
'
),
0.3
);
//标题发音
this
.
addUrlToAudioObj
(
this
.
data
.
title
.
audioUrl
);
this
.
addUrlToAudioObj
(
'
titleAudio
'
,
this
.
data
.
title
.
audioUrl
);
//听力材料
this
.
addUrlToAudioObj
(
this
.
data
.
listenAudioUrl
);
this
.
addUrlToAudioObj
(
'
listenAudio
'
,
this
.
data
.
listenAudioUrl
);
//单词音效
for
(
let
i
=
0
;
i
<
this
.
data
.
exercisesArr
.
length
;
++
i
)
{
let
exercises
=
this
.
data
.
exercisesArr
[
i
];
this
.
addUrlToAudioObj
(
exercises
.
audioUrl
);
this
.
addUrlToAudioObj
(
'
exercises
'
+
i
,
exercises
.
audioUrl
);
this
.
addUrlToAudioObj
(
exercises
.
letterCombinations
.
audioUrl
);
this
.
addUrlToAudioObj
(
'
exercises_letter
'
+
i
,
exercises
.
letterCombinations
.
audioUrl
);
}
}
...
...
@@ -757,6 +759,10 @@ export class PlayComponent implements OnInit, OnDestroy {
exercisesObj
.
bg
=
exercisesBg
;
exercisesObj
.
wordAudioKey
=
"
exercises
"
+
i
;
exercisesObj
.
letterAudioKey
=
'
exercises_letter
'
+
i
;
//单词图片
this
.
initWordPic
(
this
.
data
.
exercisesArr
[
i
],
exercisesObj
);
...
...
@@ -769,9 +775,6 @@ export class PlayComponent implements OnInit, OnDestroy {
initWordPic
(
exercises
,
exercisesObj
:
Exercises
)
{
exercisesObj
.
wordAudioUrl
=
exercises
.
audioUrl
;
exercisesObj
.
letterAudioUrl
=
exercises
.
letterCombinations
.
audioUrl
;
//最短
let
sWidth
=
120
;
...
...
@@ -863,7 +866,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const
answerBg
=
new
MySprite
();
answerBg
.
init
(
this
.
images
.
get
(
'
answer
'
));
answerBg
.
setScaleXY
(
this
.
mapScale
);
answerBg
.
x
=
-
wordBg
.
width
/
2
+
answerBg
.
width
/
2
+
13
;
answerBg
.
y
=
-
5
*
this
.
mapScale
;
answerBg
.
alpha
=
0
;
...
...
@@ -878,10 +881,10 @@ export class PlayComponent implements OnInit, OnDestroy {
answerIndex
.
fontColor
=
"
#000000
"
;
answerIndex
.
refreshSize
();
answerIndex
.
alpha
=
0
;
answerIndex
.
setMaxSize
(
80
*
this
.
mapScale
);
answerIndex
.
y
=
0
;
answerIndex
.
x
=
-
answerIndex
.
getBoundingBox
().
width
/
2
+
13
;
answerIndex
.
x
=
-
answerIndex
.
getBoundingBox
().
width
/
2
+
5
*
this
.
mapScale
;
answerBg
.
addChild
(
answerIndex
);
//answerBg.setScaleXY(this.mapScale);
exercisesObj
.
answerIndexLabel
=
answerIndex
;
}
...
...
@@ -962,6 +965,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
this
.
curAudio
){
this
.
curAudio
.
pause
();
}
this
.
isListenAudio
=
true
;
this
.
setListenPlayStatus
();
}
...
...
@@ -977,14 +981,16 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
this
.
playStatus
){
this
.
playStatus
=
false
;
this
.
pauseAudio
(
this
.
data
.
listenAudioUrl
);
this
.
pauseAudio
(
'
listenAudio
'
);
this
.
btnPlay
.
alpha
=
1
;
this
.
btnStop
.
alpha
=
0
;
}
else
{
this
.
playAudio
(
this
.
data
.
listenAudioUrl
,
false
,
()
=>
{
this
.
playAudio
(
'
listenAudio
'
,
false
,
()
=>
{
this
.
playStatus
=
false
;
...
...
@@ -1011,10 +1017,13 @@ export class PlayComponent implements OnInit, OnDestroy {
}
//如果不是播放听力材料,则暂停当前播放音频
if
(
!
this
.
playStatus
){
if
(
this
.
curAudio
){
if
(
this
.
curAudio
){
if
(
!
this
.
isListenAudio
){
this
.
curAudio
.
pause
();
this
.
curAudio
.
currentTime
=
0
;
}
}
if
(
this
.
checkClickTarget
(
this
.
btnPlay
)
&&
!
this
.
playStatus
)
{
...
...
@@ -1030,12 +1039,8 @@ export class PlayComponent implements OnInit, OnDestroy {
//点击标题
if
(
this
.
checkClickTarget
(
this
.
titleBg
))
{
if
(
this
.
playStatus
){
this
.
setListenPlayStatus
();
}
//播放发音
this
.
play
Audio
(
this
.
data
.
title
.
audioUrl
);
this
.
play
OtherAudio
(
'
titleAudio
'
);
return
;
}
...
...
@@ -1048,22 +1053,14 @@ export class PlayComponent implements OnInit, OnDestroy {
//点击图片
if
(
this
.
checkClickTarget
(
exercises
.
wordPic
)){
if
(
this
.
playStatus
){
this
.
setListenPlayStatus
();
}
this
.
playAudio
(
exercises
.
wordAudioUrl
);
this
.
playOtherAudio
(
exercises
.
wordAudioKey
);
return
;
}
//点击圆圈
if
(
this
.
checkClickTarget
(
exercises
.
letterCombinations
)){
if
(
this
.
playStatus
){
this
.
setListenPlayStatus
();
}
this
.
playAudio
(
exercises
.
letterAudioUrl
);
this
.
playOtherAudio
(
exercises
.
letterAudioKey
);
return
;
}
...
...
@@ -1073,11 +1070,7 @@ export class PlayComponent implements OnInit, OnDestroy {
//如果未加载,则加载
if
(
exercises
.
showed
){
if
(
this
.
playStatus
){
this
.
setListenPlayStatus
();
}
this
.
playAudio
(
exercises
.
wordAudioUrl
);
this
.
playOtherAudio
(
exercises
.
wordAudioKey
);
return
;
}
else
{
...
...
@@ -1113,6 +1106,16 @@ export class PlayComponent implements OnInit, OnDestroy {
}
playOtherAudio
(
key
,
callback
=
null
){
if
(
this
.
playStatus
){
this
.
setListenPlayStatus
();
}
this
.
isListenAudio
=
false
;
this
.
playAudio
(
key
,
callback
);
}
update
()
{
...
...
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