Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
ym008
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
ym008
Commits
68f7a736
Commit
68f7a736
authored
Feb 16, 2020
by
chaiyajie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首次提交
parent
a7e92ed4
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
827 additions
and
72 deletions
+827
-72
form.component.html
src/app/form/form.component.html
+226
-39
form.component.scss
src/app/form/form.component.scss
+4
-0
form.component.ts
src/app/form/form.component.ts
+77
-2
Unit.ts
src/app/play/Unit.ts
+76
-0
play.component.ts
src/app/play/play.component.ts
+443
-31
resources.js
src/app/play/resources.js
+1
-0
newpage.mp3
src/assets/play/music/newpage.mp3
+0
-0
No files found.
src/app/form/form.component.html
View file @
68f7a736
This diff is collapsed.
Click to expand it.
src/app/form/form.component.scss
View file @
68f7a736
...
@@ -6,3 +6,7 @@
...
@@ -6,3 +6,7 @@
height
:
100%
;
height
:
100%
;
}
}
nz-select
{
width
:
100%
;
}
src/app/form/form.component.ts
View file @
68f7a736
...
@@ -10,10 +10,11 @@ import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, Ap
...
@@ -10,10 +10,11 @@ import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, Ap
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
// 储存数据用
// 储存数据用
saveKey
=
"
test_00
11
"
;
saveKey
=
"
test_00
8
"
;
// 储存对象
// 储存对象
item
;
item
;
wordArr
=
[];
constructor
(
private
appRef
:
ApplicationRef
)
{
constructor
(
private
appRef
:
ApplicationRef
)
{
...
@@ -31,6 +32,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -31,6 +32,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this
.
item
=
data
;
this
.
item
=
data
;
}
}
if
(
!
this
.
item
.
wordArr
)
{
this
.
item
.
wordArr
=
[];
}
this
.
init
();
this
.
init
();
this
.
refresh
();
this
.
refresh
();
...
@@ -48,7 +53,12 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -48,7 +53,12 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
init
()
{
init
()
{
if
(
this
.
item
.
wordArr
)
{
this
.
wordArr
=
this
.
item
.
wordArr
;
}
else
{
this
.
wordArr
=
this
.
getDefaultWordArr
();
this
.
item
.
wordArr
=
this
.
wordArr
;
}
}
}
...
@@ -91,5 +101,70 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -91,5 +101,70 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
},
1
);
},
1
);
}
}
deleteItem
(
index
)
{
if
(
index
!==
-
1
)
{
this
.
wordArr
.
splice
(
index
,
1
);
}
// this.update.emit(this.item);
this
.
save
();
}
addItem
()
{
let
item
=
this
.
wordItemData
();
this
.
wordArr
.
push
(
item
);
this
.
saveItem
();
}
addLetterItem
(
letters
){
let
letter
=
this
.
letterData
();
letters
.
push
(
letter
);
this
.
save
();
}
deleteLetterItem
(
letters
,
index
){
console
.
log
(
letters
);
if
(
index
!==
-
1
)
{
letters
.
splice
(
index
,
1
);
}
this
.
save
();
}
wordItemData
()
{
return
{
left
:
{
word_val
:
''
,
word_audio_url
:
''
,
letters
:
[]
},
right
:
{
word_val
:
''
,
word_audio_url
:
''
,
letters
:
[]
}
};
}
letterData
()
{
return
{
letter_val
:
''
,
letter_color
:
'
C04
'
};
}
saveItem
()
{
this
.
save
();
}
getDefaultWordArr
()
{
let
arr
=
[];
return
arr
;
}
}
}
src/app/play/Unit.ts
View file @
68f7a736
...
@@ -864,8 +864,84 @@ export class ShapeRect extends MySprite {
...
@@ -864,8 +864,84 @@ export class ShapeRect extends MySprite {
}
}
}
}
export
class
ShapeRectNew
extends
MySprite
{
radius
=
0
;
fillColor
=
'
#ffffff
'
;
strokeColor
=
'
#000000
'
;
fill
=
true
;
stroke
=
false
;
lineWidth
=
1
;
setSize
(
w
,
h
,
r
)
{
this
.
width
=
w
;
this
.
height
=
h
;
this
.
radius
=
r
;
}
setOutLine
(
color
,
lineWidth
)
{
this
.
stroke
=
true
;
this
.
strokeColor
=
color
;
this
.
lineWidth
=
lineWidth
;
}
drawShape
()
{
const
ctx
=
this
.
ctx
;
const
width
=
this
.
width
;
const
height
=
this
.
height
;
const
radius
=
this
.
radius
;
ctx
.
save
();
ctx
.
beginPath
(
0
);
// 从右下角顺时针绘制,弧度从0到1/2PI
ctx
.
arc
(
width
-
radius
,
height
-
radius
,
radius
,
0
,
Math
.
PI
/
2
);
// 矩形下边线
ctx
.
lineTo
(
radius
,
height
);
// 左下角圆弧,弧度从1/2PI到PI
ctx
.
arc
(
radius
,
height
-
radius
,
radius
,
Math
.
PI
/
2
,
Math
.
PI
);
// 矩形左边线
ctx
.
lineTo
(
0
,
radius
);
// 左上角圆弧,弧度从PI到3/2PI
ctx
.
arc
(
radius
,
radius
,
radius
,
Math
.
PI
,
Math
.
PI
*
3
/
2
);
// 上边线
ctx
.
lineTo
(
width
-
radius
,
0
);
// 右上角圆弧
ctx
.
arc
(
width
-
radius
,
radius
,
radius
,
Math
.
PI
*
3
/
2
,
Math
.
PI
*
2
);
// 右边线
ctx
.
lineTo
(
width
,
height
-
radius
);
ctx
.
closePath
();
if
(
this
.
fill
)
{
ctx
.
fillStyle
=
this
.
fillColor
;
ctx
.
fill
();
}
if
(
this
.
stroke
)
{
ctx
.
lineWidth
=
this
.
lineWidth
;
ctx
.
strokeStyle
=
this
.
strokeColor
;
ctx
.
stroke
();
}
ctx
.
restore
();
}
drawSelf
()
{
super
.
drawSelf
();
this
.
drawShape
();
}
}
export
class
ShapeCircle
extends
MySprite
{
export
class
ShapeCircle
extends
MySprite
{
fillColor
=
'
#FF0000
'
;
fillColor
=
'
#FF0000
'
;
...
...
src/app/play/play.component.ts
View file @
68f7a736
This diff is collapsed.
Click to expand it.
src/app/play/resources.js
View file @
68f7a736
...
@@ -12,6 +12,7 @@ const res = [
...
@@ -12,6 +12,7 @@ const res = [
const
resAudio
=
[
const
resAudio
=
[
[
'
click
'
,
"
assets/play/music/click.mp3
"
],
[
'
click
'
,
"
assets/play/music/click.mp3
"
],
[
'
newpage
'
,
"
assets/play/music/newpage.mp3
"
]
];
];
...
...
src/assets/play/music/newpage.mp3
0 → 100644
View file @
68f7a736
File added
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