Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM4-11
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
YM4-11
Commits
5c94e0b4
Commit
5c94e0b4
authored
Sep 15, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
5c63c1e3
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
464 additions
and
283 deletions
+464
-283
background-upload.component.html
...common/background-upload/background-upload.component.html
+49
-47
background-upload.component.scss
...common/background-upload/background-upload.component.scss
+7
-0
custom-hot-zone.component.html
...app/common/custom-hot-zone/custom-hot-zone.component.html
+183
-189
custom-hot-zone.component.ts
src/app/common/custom-hot-zone/custom-hot-zone.component.ts
+3
-2
form.component.ts
src/app/form/form.component.ts
+10
-32
play.component.ts
src/app/play/play.component.ts
+11
-11
defaultData.js
src/assets/default/formData/defaultData.js
+201
-2
No files found.
src/app/common/background-upload/background-upload.component.html
View file @
5c94e0b4
<nz-form-item>
<nz-form-label
[
nzSpan
]="
2
"
>
左上
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
leftTop
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
leftTop
')"
></app-upload-image-with-preview>
</nz-form-control>
<nz-form-label
[
nzSpan
]="
2
"
>
中上
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
middleTop
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
middleTop
')"
></app-upload-image-with-preview>
</nz-form-control>
<nz-form-label
[
nzSpan
]="
2
"
>
右上
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
rightTop
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
rightTop
')"
></app-upload-image-with-preview>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
2
"
>
左中
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
leftMiddle
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
leftMiddle
')"
></app-upload-image-with-preview>
</nz-form-control>
<div
nz-col
nzSpan=
"8"
></div>
<nz-form-label
[
nzSpan
]="
2
"
>
右中
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
rightMiddle
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
rightMiddle
')"
></app-upload-image-with-preview>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
2
"
>
左下
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
leftBottom
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
leftBottom
')"
></app-upload-image-with-preview>
</nz-form-control>
<nz-form-label
[
nzSpan
]="
2
"
>
中下
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
middleBottom
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
middleBottom
')"
></app-upload-image-with-preview>
</nz-form-control>
<nz-form-label
[
nzSpan
]="
2
"
>
右下
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
rightBottom
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
rightBottom
')"
></app-upload-image-with-preview>
</nz-form-control>
</nz-form-item>
\ No newline at end of file
<div
class=
"content-border"
>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
2
"
>
左上
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
leftTop
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
leftTop
')"
></app-upload-image-with-preview>
</nz-form-control>
<nz-form-label
[
nzSpan
]="
2
"
>
中上
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
middleTop
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
middleTop
')"
></app-upload-image-with-preview>
</nz-form-control>
<nz-form-label
[
nzSpan
]="
2
"
>
右上
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
rightTop
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
rightTop
')"
></app-upload-image-with-preview>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
2
"
>
左中
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
leftMiddle
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
leftMiddle
')"
></app-upload-image-with-preview>
</nz-form-control>
<div
nz-col
nzSpan=
"8"
></div>
<nz-form-label
[
nzSpan
]="
2
"
>
右中
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
rightMiddle
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
rightMiddle
')"
></app-upload-image-with-preview>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
2
"
>
左下
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
leftBottom
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
leftBottom
')"
></app-upload-image-with-preview>
</nz-form-control>
<nz-form-label
[
nzSpan
]="
2
"
>
中下
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
middleBottom
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
middleBottom
')"
></app-upload-image-with-preview>
</nz-form-control>
<nz-form-label
[
nzSpan
]="
2
"
>
右下
</nz-form-label>
<nz-form-control
[
nzSpan
]="
6
"
>
<app-upload-image-with-preview
style=
"width: 100%"
[
picUrl
]="
items
.
rightBottom
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
items
,
'
rightBottom
')"
></app-upload-image-with-preview>
</nz-form-control>
</nz-form-item>
</div>
\ No newline at end of file
src/app/common/background-upload/background-upload.component.scss
View file @
5c94e0b4
.content-border
{
width
:
100%
;
height
:
100%
;
border-radius
:
0
.5rem
;
min-width
:
1200px
;
border
:
2px
solid
#ddd
;
}
\ No newline at end of file
src/app/common/custom-hot-zone/custom-hot-zone.component.html
View file @
5c94e0b4
This diff is collapsed.
Click to expand it.
src/app/common/custom-hot-zone/custom-hot-zone.component.ts
View file @
5c94e0b4
...
...
@@ -346,6 +346,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
number
:
2
,
combin
:
[
0
,
0
]
})
this
.
autoSave
()
}
handleCombinLength
(
item
)
{
...
...
@@ -561,8 +562,8 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
}
handlePartChange
(
e
,
item
,
index
)
{
item
.
combin
[
index
]
=
e
console
.
log
(
item
.
combin
,
index
)
item
.
combin
[
index
]
=
Number
(
e
)
this
.
autoSave
(
)
}
hideAllLineDash
()
{
...
...
src/app/form/form.component.ts
View file @
5c94e0b4
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
}
from
'
@angular/core
'
;
import
{
defaultData
}
from
'
../../assets/default/formData/defaultData.js
'
@
Component
({
selector
:
'
app-form
'
,
...
...
@@ -40,10 +41,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this
.
item
=
{};
}
if
(
!
this
.
item
.
contentObj
)
{
this
.
item
.
contentObj
=
{
"
version
"
:
"
1.0
"
,
"
dataKey
"
:
"
DataKey_YM4-11
"
,
};
this
.
item
.
contentObj
=
{};
}
this
.
init
();
this
.
refresh
();
...
...
@@ -67,39 +65,19 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
init
()
{
if
(
this
.
item
.
contentObj
.
dataArray
)
{
this
.
dataArray
=
this
.
item
.
contentObj
.
dataArray
;
if
(
typeof
(
this
.
item
.
contentObj
.
hotZoneItemArr
)
==
undefined
||
typeof
(
this
.
item
.
contentObj
.
bgItem
)
==
undefined
||
typeof
(
this
.
item
.
contentObj
.
bgImages
)
==
undefined
||
this
.
item
.
contentObj
.
version
!=
defaultData
.
version
)
{
console
.
log
(
"
Init defalue data
"
)
this
.
item
.
contentObj
=
defaultData
this
.
hotZoneItemArr
=
defaultData
.
hotZoneItemArr
this
.
bgItem
=
defaultData
.
bgItem
this
.
bgImages
=
defaultData
.
bgImages
}
else
{
this
.
dataArray
=
this
.
getDefaultPicArr
();
this
.
item
.
contentObj
.
dataArray
=
this
.
dataArray
;
}
if
(
this
.
item
.
contentObj
.
hotZoneItemArr
)
{
console
.
log
(
"
Data loaded
"
)
this
.
hotZoneItemArr
=
this
.
item
.
contentObj
.
hotZoneItemArr
;
}
else
{
this
.
hotZoneItemArr
=
this
.
getDefaultPicArr
();
this
.
item
.
contentObj
.
hotZoneItemArr
=
this
.
hotZoneItemArr
;
}
if
(
this
.
item
.
contentObj
.
bgItem
)
{
this
.
bgItem
=
this
.
item
.
contentObj
.
bgItem
;
}
else
{
this
.
bgItem
=
{
url
:
'
assets/play/hotZooCard/defalut_bg.png
'
}
this
.
item
.
contentObj
.
bgItem
=
this
.
bgItem
;
}
if
(
this
.
item
.
contentObj
.
bgImages
)
{
this
.
bgImages
=
this
.
item
.
contentObj
.
bgImages
;
}
else
{
this
.
bgImages
=
{
leftTop
:
''
,
middleTop
:
''
,
rightTop
:
''
,
leftMiddle
:
''
,
rightMiddle
:
''
,
leftBottom
:
''
,
middleBottom
:
''
,
rightBottom
:
''
,
}
this
.
item
.
contentObj
.
bgImages
=
this
.
bgImages
;
}
}
cardItemData
(){
...
...
src/app/play/play.component.ts
View file @
5c94e0b4
...
...
@@ -42,8 +42,7 @@ import { Subject } from "rxjs";
import
{
debounceTime
,
map
,
takeWhile
,
retry
}
from
"
rxjs/operators
"
;
import
*
as
_
from
"
lodash
"
;
import
TWEEN
from
"
@tweenjs/tween.js
"
;
import
defauleFormData
from
'
../../assets/default/formData/defaultData.js
'
import
{
element
}
from
'
protractor
'
;
import
{
demoData
as
defaultData
}
from
'
../../assets/default/formData/defaultData.js
'
const
zIndexMap
=
{
mainBackground
:
0
,
...
...
@@ -341,11 +340,11 @@ export class PlayComponent implements OnInit, OnDestroy {
}
})
element
.
originX
=
element
.
ref
.
x
-
960
*
this
.
g_mapScale
/
2
element
.
originY
=
element
.
ref
.
y
-
155
*
this
.
g_mapScale
/
2
let
contentImageWidth
=
0
let
element_t
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
"
window-image-container
"
,
this
.
g_formData
.
bgItem
.
url
,
(
w
,
h
)
=>
{
let
s
=
Math
.
min
(
960
/
w
,
155
/
h
)
contentImageWidth
=
(
w
*
s
)
/
2
return
{
sx
:
s
,
sy
:
s
...
...
@@ -357,6 +356,9 @@ export class PlayComponent implements OnInit, OnDestroy {
}
})
element
.
originX
=
element
.
ref
.
x
-
contentImageWidth
*
element
.
ref
.
scaleX
element
.
originY
=
element
.
ref
.
y
-
155
*
this
.
g_mapScale
/
2
element
.
ref
.
addChild
(
element_t
.
ref
)
this
.
render
(
element
.
ref
)
...
...
@@ -379,21 +381,19 @@ export class PlayComponent implements OnInit, OnDestroy {
element
.
initY
=
element
.
ref
.
y
element
.
margin
=
0
element
.
hotZooIndex
=
index
;
element
.
ref
.
alpha
=
0
;
let
elementDrag
=
null
elementDrag
=
this
.
g_cartoon
.
createCartoonElementLabel
(
"
text-puzzle-
"
+
index
,
"
"
+
item
.
media
.
text
+
"
"
,
"
MMTextBook-Bold
"
,
"
#000
"
,
48
*
this
.
g_mapScale
,
-
500
,
-
500
)
this
.
render
(
element
.
ref
)
this
.
render
(
elementDrag
.
ref
)
this
.
subscribeMapDragEvent
(
element
.
id
,
()
=>
{
element
.
ref
.
alpha
=
0.5
;
item
.
media
.
audio_url
&&
this
.
g_cartoon
.
playAudio
(
item
.
media
.
audio_url
)
console
.
log
(
item
.
media
.
audio_url
)
},
()
=>
{
elementDrag
.
ref
.
x
=
this
.
g_clickX
,
elementDrag
.
ref
.
y
=
this
.
g_clickY
},
()
=>
{
element
.
ref
.
alpha
=
1
;
elementDrag
.
ref
.
x
=
elementDrag
.
initX
,
elementDrag
.
ref
.
y
=
elementDrag
.
initY
this
.
m_elementDraged
=
element
.
id
;
...
...
@@ -876,9 +876,9 @@ export class PlayComponent implements OnInit, OnDestroy {
// 初始化默认数据
// ----------------------------------
initDefaultData
()
{
if
(
Object
.
keys
(
this
.
g_formData
).
length
===
0
||
this
.
g_formData
.
version
!=
defaul
eForm
Data
.
version
)
{
this
.
g_formData
=
defaul
eForm
Data
;
console
.
log
(
"
Use default data.
"
)
if
(
Object
.
keys
(
this
.
g_formData
).
length
===
0
||
this
.
g_formData
.
version
!=
defaul
t
Data
.
version
)
{
this
.
g_formData
=
defaul
t
Data
;
console
.
log
(
"
Use default data.
"
,
this
.
g_formData
)
}
}
...
...
src/assets/default/formData/defaultData.js
View file @
5c94e0b4
export
default
{
export
const
defaultData
=
{
"
version
"
:
"
1.0
"
,
"
dataKey
"
:
"
DataKey_YM4-11
"
,
"
dataArray
"
:
[
...
...
@@ -8,7 +8,7 @@ export default {
],
"
bgItem
"
:
{
"
url
"
:
"
demo
"
,
"
url
"
:
""
,
"
questions
"
:
[
],
...
...
@@ -29,4 +29,203 @@ export default {
"
bgImages
"
:
{
"
leftTop
"
:
''
,
"
middleTop
"
:
''
,
"
rightTop
"
:
''
,
"
leftMiddle
"
:
''
,
"
rightMiddle
"
:
''
,
"
leftBottom
"
:
''
,
"
middleBottom
"
:
''
,
"
rightBottom
"
:
''
,
}
}
export
const
demoData
=
{
version
:
"
1.0
"
,
dataKey
:
"
DataKey_YM4-11
"
,
dataArray
:
[],
hotZoneItemArr
:
[
{
index
:
0
,
rect
:
{
x
:
8.769469387755102
,
y
:
20.163265306122447
,
width
:
72.12244897959184
,
height
:
39.5029387755102
,
},
media
:
{
image_url
:
"
assets/play/hotZooCard/bg_70_40_1.png
"
,
text
:
"
p
"
,
type
:
"
text
"
,
audio_url
:
""
,
},
scale
:
0.7755102040816326
,
},
{
index
:
1
,
rect
:
{
x
:
14.19804081632653
,
y
:
96.89069387755102
,
width
:
54.285714285714285
,
height
:
31.020408163265305
,
},
media
:
{
image_url
:
"
assets/play/hotZooCard/bg_70_40_2.png
"
,
text
:
"
t
"
,
type
:
"
text
"
,
audio_url
:
""
,
},
scale
:
0.7755102040816326
,
},
{
index
:
2
,
rect
:
{
x
:
138.27967346938775
,
y
:
57.339673469387755
,
width
:
54.285714285714285
,
height
:
31.020408163265305
,
},
media
:
{
image_url
:
"
assets/play/hotZooCard/bg_70_40_3.png
"
,
text
:
"
d
"
,
type
:
"
text
"
,
audio_url
:
""
,
},
scale
:
0.7755102040816326
,
},
{
index
:
3
,
rect
:
{
x
:
246.8511020408163
,
y
:
20.115183673469385
,
width
:
54.285714285714285
,
height
:
31.020408163265305
,
},
media
:
{
image_url
:
"
assets/play/hotZooCard/bg_70_40_4.png
"
,
text
:
"
w
"
,
type
:
"
text
"
,
audio_url
:
""
,
},
scale
:
0.7755102040816326
,
},
{
index
:
4
,
rect
:
{
x
:
235.99395918367347
,
y
:
96.11518367346939
,
width
:
54.285714285714285
,
height
:
31.020408163265305
,
},
media
:
{
image_url
:
"
assets/play/hotZooCard/bg_70_40_5.png
"
,
text
:
"
st
"
,
type
:
"
text
"
,
audio_url
:
""
,
},
scale
:
0.7755102040816326
,
},
{
index
:
5
,
rect
:
{
x
:
360.85110204081633
,
y
:
59.714285714285715
,
width
:
89.95918367346938
,
height
:
32.52334693877551
,
},
media
:
{
image_url
:
"
assets/play/hotZooCard/bg_70_40_6.png
"
,
text
:
"
eam
"
,
type
:
"
text
"
,
audio_url
:
""
,
},
scale
:
0.7755102040816326
,
},
{
index
:
6
,
rect
:
{
x
:
496.565387755102
,
y
:
20.115183673469385
,
width
:
54.285714285714285
,
height
:
31.020408163265305
,
},
media
:
{
image_url
:
"
assets/play/hotZooCard/bg_70_40_7.png
"
,
text
:
"
o
"
,
type
:
"
text
"
,
audio_url
:
""
,
},
scale
:
0.7755102040816326
,
},
{
index
:
7
,
rect
:
{
x
:
487.2592653061224
,
y
:
101.59183673469387
,
width
:
77.55102040816327
,
height
:
30.196816326530612
,
},
media
:
{
image_url
:
"
assets/play/hotZooCard/bg_70_40_8.png
"
,
text
:
"
one
"
,
type
:
"
text
"
,
audio_url
:
""
,
},
scale
:
0.7755102040816326
,
},
{
index
:
8
,
rect
:
{
x
:
735.4225306122448
,
y
:
21.714285714285715
,
width
:
79.87755102040816
,
height
:
32.52334693877551
,
},
media
:
{
image_url
:
"
assets/play/hotZooCard/bg_70_40_9.png
"
,
text
:
"
m
"
,
type
:
"
text
"
,
audio_url
:
""
,
},
scale
:
0.7755102040816326
,
},
{
index
:
9
,
rect
:
{
x
:
723.0143673469388
,
y
:
93.83673469387755
,
width
:
94.61224489795919
,
height
:
41.05395918367347
,
},
media
:
{
image_url
:
"
assets/play/hotZooCard/bg_70_40_10.png
"
,
text
:
"
eet
"
,
type
:
"
text
"
,
audio_url
:
""
,
},
scale
:
0.7755102040816326
,
},
],
bgItem
:
{
url
:
"
assets/play/demo.png
"
,
questions
:
[],
NO
:
"
C
"
,
mainText
:
"
Listen, circle and write.
"
,
mainTextAudio
:
""
,
wordLeft_text
:
"
ear
"
,
wordLeft_audio_url
:
""
,
wordRight_text
:
"
pl
"
,
wordRight_audio_url
:
""
,
questions
:
[
{
number
:
2
,
combin
:
[
0
,
-
1
]},
{
number
:
2
,
combin
:
[
0
,
-
1
]}
],
rect
:
{
x
:
43.691666666666606
,
y
:
0
,
width
:
1088.6166666666668
,
height
:
189.875
,
},
},
bgImages
:
{
leftTop
:
""
,
middleTop
:
""
,
rightTop
:
""
,
leftMiddle
:
""
,
rightMiddle
:
""
,
leftBottom
:
""
,
middleBottom
:
""
,
rightBottom
:
""
,
},
}
\ No newline at end of file
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