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
a65352ba
Commit
a65352ba
authored
Sep 12, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Almost completed form page
parent
4d304e3f
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
312 additions
and
99 deletions
+312
-99
Unit.ts
src/app/common/custom-hot-zone/Unit.ts
+6
-6
custom-hot-zone.component.html
...app/common/custom-hot-zone/custom-hot-zone.component.html
+164
-40
custom-hot-zone.component.scss
...app/common/custom-hot-zone/custom-hot-zone.component.scss
+3
-0
custom-hot-zone.component.ts
src/app/common/custom-hot-zone/custom-hot-zone.component.ts
+83
-28
form.component.ts
src/app/form/form.component.ts
+3
-1
filename.txt
src/assets/play/filename.txt
+13
-24
creatJsonProfile.py
src/assets/play/hotZooCard/creatJsonProfile.py
+13
-0
defalut_bg.png
src/assets/play/hotZooCard/defalut_bg.png
+0
-0
filename.txt
src/assets/play/hotZooCard/filename.txt
+27
-0
No files found.
src/app/common/custom-hot-zone/Unit.ts
View file @
a65352ba
...
...
@@ -437,10 +437,10 @@ export class HotZoneImageItem extends MySprite {
arrowRight
;
init
(
image_url
=
null
,
text
?,
type
?,
callback
?,
handleSave
?){
let
change
=
true
;
if
(
type
==
this
.
type
){
change
=
false
}
//
let change = true;
//
if(type == this.type){
//
change = false
//
}
if
(
type
&&
type
==
"
Text
"
){
image_url
=
"
assets/default/images/bg_50_50.png
"
;
...
...
@@ -475,9 +475,9 @@ export class HotZoneImageItem extends MySprite {
}
this
.
drawArrow
()
}
if
(
change
){
//
if(change){
this
.
showLineDash
()
}
//
}
})
}
...
...
src/app/common/custom-hot-zone/custom-hot-zone.component.html
View file @
a65352ba
This diff is collapsed.
Click to expand it.
src/app/common/custom-hot-zone/custom-hot-zone.component.scss
View file @
a65352ba
...
...
@@ -72,6 +72,9 @@ h5 {
margin-top
:
1rem
;
}
nz-select
{
min-width
:
80px
;
}
//@import '../../../style/common_mixin';
//
//.p-image-uploader {
...
...
src/app/common/custom-hot-zone/custom-hot-zone.component.ts
View file @
a65352ba
...
...
@@ -26,20 +26,10 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
return
this
.
_bgItem
;
}
@
Input
()
imgItemArr
=
null
;
@
Input
()
hotZoneItemArr
=
null
;
@
Input
()
hotZoneArr
=
null
;
@
Output
()
save
=
new
EventEmitter
();
@
Input
()
imgItemArr
=
null
;
@
Input
()
hotZoneItemArr
=
null
;
@
Input
()
hotZoneArr
=
null
;
@
Output
()
save
=
new
EventEmitter
();
@
ViewChild
(
'
canvas
'
)
canvas
:
ElementRef
;
@
ViewChild
(
'
wrap
'
)
wrap
:
ElementRef
;
...
...
@@ -137,23 +127,24 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
const
item
=
this
.
getHotZoneItem
();
this
.
hotZoneArr
.
push
(
item
);
this
.
refreshHotZoneId
();
this
.
refreshIndexNumber
()
this
.
autoSave
()
}
handleMoveItemUp
(
event
,
index
)
{
if
(
index
!=
0
)
{
this
.
hotZoneArr
[
index
]
=
this
.
hotZoneArr
.
splice
(
index
-
1
,
1
,
this
.
hotZoneArr
[
index
])[
0
];
this
.
bgItem
.
questions
[
index
]
=
this
.
bgItem
.
questions
.
splice
(
index
-
1
,
1
,
this
.
bgItem
.
questions
[
index
])[
0
];
}
else
{
this
.
hotZoneArr
.
push
(
this
.
hotZoneArr
.
shift
());
this
.
bgItem
.
questions
.
push
(
this
.
bgItem
.
questions
.
shift
());
}
this
.
autoSave
()
}
handleMoveItemDown
(
event
,
index
)
{
if
(
index
!=
this
.
hotZoneArr
.
length
-
1
)
{
this
.
hotZoneArr
[
index
]
=
this
.
hotZoneArr
.
splice
(
index
+
1
,
1
,
this
.
hotZoneArr
[
index
])[
0
];
if
(
index
!=
this
.
bgItem
.
questions
.
length
-
1
)
{
this
.
bgItem
.
questions
[
index
]
=
this
.
bgItem
.
questions
.
splice
(
index
+
1
,
1
,
this
.
bgItem
.
questions
[
index
])[
0
];
}
else
{
this
.
hotZoneArr
.
unshift
(
this
.
hotZoneArr
.
splice
(
index
,
1
)[
0
]);
this
.
bgItem
.
questions
.
unshift
(
this
.
bgItem
.
questions
.
splice
(
index
,
1
)[
0
]);
}
this
.
autoSave
()
}
...
...
@@ -168,8 +159,13 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
this
.
autoSave
()
}
onAudioUploadSuccess
(
e
,
item
)
{
onAudioUploadSuccess
(
e
,
item
,
key
)
{
if
(
key
)
{
item
.
audio_url
=
e
.
url
;
}
else
{
item
[
key
]
=
e
.
url
;
}
this
.
autoSave
()
}
...
...
@@ -213,8 +209,9 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
// item.image_url = saveData.media.image_url
// item.text = saveData.media.text
// item.type = saveData.media.type
item
.
audio_url
=
saveData
.
media
.
audio_url
?
saveData
.
media
.
audio_url
:
""
item
.
image_url
=
"
assets/play/bg_70_40.png
"
item
.
text
=
""
//
item.text = ""
item
.
type
=
"
Image
"
}
else
{
item
.
init
(
"
assets/play/bg_70_40.png
"
,
null
,
"
Image
"
,
()
=>
{
...
...
@@ -224,12 +221,21 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
item
.
y
=
this
.
canvasHeight
/
2
-
20
;
},
()
=>
this
.
autoSave
());
}
item
.
text
=
item
.
text
?
item
.
text
:
""
item
.
anchorX
=
0.5
;
item
.
anchorY
=
0.5
;
return
item
;
}
refreshIndexNumber
()
{
this
.
hotZoneArr
.
forEach
((
element
:
HotZoneImageItem
,
index
)
=>
{
element
.
init
(
`assets/play/hotZooCard/bg_70_40_
${
index
+
1
}
.png`
,
element
.
text
,
"
Image
"
,
()
=>
{
})
},
()
=>
this
.
autoSave
());
// this.autoSave()
}
getPicItem
(
img
,
saveData
=
null
)
{
const
item
=
new
EditorItem
(
this
.
ctx
);
...
...
@@ -265,8 +271,8 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
}
onAudioUploadSuccessByImg
(
e
,
i
mg
)
{
i
mg
.
audio_url
=
e
.
url
;
onAudioUploadSuccessByImg
(
e
,
i
tem
)
{
i
tem
.
audio_url
=
e
.
url
;
this
.
autoSave
()
}
...
...
@@ -276,6 +282,12 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
this
.
autoSave
()
}
deleteQuestionItem
(
e
,
i
)
{
this
.
bgItem
.
questions
.
splice
(
i
,
1
);
// this.refreshHotZoneId();
this
.
autoSave
()
}
init
()
{
this
.
initData
();
this
.
initCtx
();
...
...
@@ -284,8 +296,11 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
initItem
()
{
if
(
!
this
.
bgItem
)
{
this
.
bgItem
=
{};
this
.
bgItem
=
{
};
}
else
{
if
(
!
this
.
bgItem
.
questions
)
{
this
.
bgItem
.
questions
=
[]
}
this
.
refreshBackground
(()
=>
{
if
(
!
this
.
hotZoneItemArr
)
{
this
.
hotZoneItemArr
=
[];
...
...
@@ -325,6 +340,30 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
this
.
refreshHotZoneId
();
}
addQustion
()
{
this
.
bgItem
.
questions
.
push
({
number
:
2
,
combin
:
[
0
,
0
]
})
}
handleCombinLength
(
item
)
{
if
(
Number
(
item
.
number
)
>
5
){
return
}
if
(
Number
(
item
.
number
)
>
item
.
combin
.
length
)
{
let
num
=
Number
(
item
.
number
)
-
item
.
combin
.
length
for
(
var
index
=
0
;
index
<
num
;
index
++
)
{
item
.
combin
.
push
(
0
)
}
}
else
{
item
.
combin
=
item
.
combin
.
splice
(
0
,
Number
(
item
.
number
))
}
this
.
autoSave
()
console
.
log
(
item
.
combin
)
}
initImgArr
()
{
let
curBgRect
;
if
(
this
.
bg
)
{
...
...
@@ -361,6 +400,19 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
this
.
refreshImageId
();
}
getQuestionWord
(
combin
)
{
let
str
=
""
combin
.
forEach
(
element
=>
{
if
(
element
==
-
1
)
{
str
+=
this
.
bgItem
.
wordLeft_text
?
this
.
bgItem
.
wordLeft_text
:
""
;
}
else
if
(
element
==
-
2
)
{
str
+=
this
.
bgItem
.
wordRight_text
?
this
.
bgItem
.
wordRight_text
:
""
;
}
else
{
str
+=
this
.
hotZoneArr
[
element
]
&&
this
.
hotZoneArr
[
element
].
text
?
this
.
hotZoneArr
[
element
].
text
:
""
;
}
});
return
str
}
initData
()
{
this
.
canvasWidth
=
this
.
wrap
.
nativeElement
.
clientWidth
;
...
...
@@ -502,13 +554,16 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
}
changeCurItem
(
item
)
{
this
.
hideAllLineDash
();
this
.
curItem
=
item
;
this
.
curItem
.
showLineDash
();
}
handlePartChange
(
e
,
item
,
index
)
{
item
.
combin
[
index
]
=
e
console
.
log
(
item
.
combin
,
index
)
}
hideAllLineDash
()
{
for
(
let
i
=
0
;
i
<
this
.
imgArr
.
length
;
i
++
)
{
if
(
this
.
imgArr
[
i
].
picItem
)
{
...
...
@@ -690,7 +745,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy, OnChanges {
hotZoneItem
[
'
media
'
].
image_url
=
hotZoneArr
[
i
].
image_url
hotZoneItem
[
'
media
'
].
text
=
hotZoneArr
[
i
].
text
hotZoneItem
[
'
media
'
].
type
=
hotZoneArr
[
i
].
type
//
hotZoneItem['media'].audio_url = hotZoneArr[i].audio_url ? hotZoneArr[i].audio_url : ""
hotZoneItem
[
'
media
'
].
audio_url
=
hotZoneArr
[
i
].
audio_url
?
hotZoneArr
[
i
].
audio_url
:
""
// hotZoneItem['media'].card_audio_url = hotZoneArr[i].card_audio_url ? hotZoneArr[i].card_audio_url : ""
hotZoneItemArr
.
push
(
hotZoneItem
);
}
...
...
src/app/form/form.component.ts
View file @
a65352ba
...
...
@@ -80,7 +80,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
if
(
this
.
item
.
contentObj
.
bgItem
)
{
this
.
bgItem
=
this
.
item
.
contentObj
.
bgItem
;
}
else
{
this
.
bgItem
=
{}
this
.
bgItem
=
{
url
:
'
assets/play/hotZooCard/defalut_bg.png
'
}
this
.
item
.
contentObj
.
bgItem
=
this
.
bgItem
;
}
}
...
...
src/assets/play/filename.txt
View file @
a65352ba
'bg_line': 'assets/play/bg_line.png',
'bg_line_container': 'assets/play/bg_line_container.png',
'bg_sentence': 'assets/play/bg_sentence.png',
'bg_title_b': 'assets/play/bg_title_b.png',
'bg_title_c': 'assets/play/bg_title_c.png',
'bg_title_part': 'assets/play/bg_title_part.png',
'bg_white': 'assets/play/bg_white.png',
'bg_70_40': 'assets/play/bg_70_40.png',
'creatJsonProfile': 'assets/play/creatJsonProfile.py',
'filename': 'assets/play/filename.txt',
'hot-zoo-bg': 'assets/play/hot-zoo-bg.png',
'icon_audio_container': 'assets/play/icon_audio_container.png',
'icon_paly': 'assets/play/icon_paly.png',
'icon_pause': 'assets/play/icon_pause.png',
'resizeImg': 'assets/play/resizeImg.py',
'icon_laba (1)': 'assets/play/frame/icon_laba (1).png',
'icon_laba (2)': 'assets/play/frame/icon_laba (2).png',
'icon_laba (3)': 'assets/play/frame/icon_laba (3).png',
'icon_laba (4)': 'assets/play/frame/icon_laba (4).png',
'icon_labaxiao (1)': 'assets/play/frame/icon_labaxiao (1).png',
'icon_labaxiao (2)': 'assets/play/frame/icon_labaxiao (2).png',
'icon_labaxiao (3)': 'assets/play/frame/icon_labaxiao (3).png',
'correct': 'assets/play/sound/correct.mp3',
'fanhui': 'assets/play/sound/fanhui.mp3',
'shuibo': 'assets/play/sound/shuibo.mp3',
'xinyemian': 'assets/play/sound/xinyemian.mp3',
'yes': 'assets/play/sound/yes.mp3',
'1': 'assets/play/sound/1.mp3',
'2': 'assets/play/sound/2.mp3',
'3': 'assets/play/sound/3.mp3',
'check': 'assets/play/sound/check.mp3',
'fanye': 'assets/play/sound/fanye.mp3',
'jifen': 'assets/play/sound/jifen.mp3',
'kulian': 'assets/play/sound/kulian.mp3',
'putong': 'assets/play/sound/putong.mp3',
'start': 'assets/play/sound/start.mp3',
'xianshi': 'assets/play/sound/xianshi.mp3',
'xiaolian': 'assets/play/sound/xiaolian.mp3',
'xingxing': 'assets/play/sound/xingxing.mp3',
src/assets/play/hotZooCard/creatJsonProfile.py
0 → 100644
View file @
a65352ba
import
os
import
json
def
file_name
(
file_dir
):
fileList
=
[
"bg_kuang"
,
"bg_kuang2"
,
"bg_light"
]
f
=
open
(
'filename.txt'
,
'w'
);
blank
=
False
for
root
,
dirs
,
files
in
os
.
walk
(
file_dir
):
for
fileName
in
files
:
print
(
root
.
split
(
"
\\
"
)[
-
1
])
f
.
write
(
"'"
+
fileName
.
split
(
"."
)[
0
]
+
"': 'assets/hotZooCard/"
+
root
.
split
(
"
\\
"
)[
-
1
]
+
"/"
+
fileName
+
"',
\n
"
)
f
.
close
()
fileList
=
file_name
(
os
.
path
.
abspath
(
'.'
))
src/assets/play/hotZooCard/defalut_bg.png
0 → 100644
View file @
a65352ba
2.49 KB
src/assets/play/hotZooCard/filename.txt
0 → 100644
View file @
a65352ba
'bg_70_40_1': 'assets/hotZooCard/hotZooCard/bg_70_40_1.png',
'bg_70_40_10': 'assets/hotZooCard/hotZooCard/bg_70_40_10.png',
'bg_70_40_11': 'assets/hotZooCard/hotZooCard/bg_70_40_11.png',
'bg_70_40_12': 'assets/hotZooCard/hotZooCard/bg_70_40_12.png',
'bg_70_40_13': 'assets/hotZooCard/hotZooCard/bg_70_40_13.png',
'bg_70_40_14': 'assets/hotZooCard/hotZooCard/bg_70_40_14.png',
'bg_70_40_15': 'assets/hotZooCard/hotZooCard/bg_70_40_15.png',
'bg_70_40_16': 'assets/hotZooCard/hotZooCard/bg_70_40_16.png',
'bg_70_40_17': 'assets/hotZooCard/hotZooCard/bg_70_40_17.png',
'bg_70_40_18': 'assets/hotZooCard/hotZooCard/bg_70_40_18.png',
'bg_70_40_19': 'assets/hotZooCard/hotZooCard/bg_70_40_19.png',
'bg_70_40_2': 'assets/hotZooCard/hotZooCard/bg_70_40_2.png',
'bg_70_40_20': 'assets/hotZooCard/hotZooCard/bg_70_40_20.png',
'bg_70_40_21': 'assets/hotZooCard/hotZooCard/bg_70_40_21.png',
'bg_70_40_22': 'assets/hotZooCard/hotZooCard/bg_70_40_22.png',
'bg_70_40_23': 'assets/hotZooCard/hotZooCard/bg_70_40_23.png',
'bg_70_40_24': 'assets/hotZooCard/hotZooCard/bg_70_40_24.png',
'bg_70_40_25': 'assets/hotZooCard/hotZooCard/bg_70_40_25.png',
'bg_70_40_3': 'assets/hotZooCard/hotZooCard/bg_70_40_3.png',
'bg_70_40_4': 'assets/hotZooCard/hotZooCard/bg_70_40_4.png',
'bg_70_40_5': 'assets/hotZooCard/hotZooCard/bg_70_40_5.png',
'bg_70_40_6': 'assets/hotZooCard/hotZooCard/bg_70_40_6.png',
'bg_70_40_7': 'assets/hotZooCard/hotZooCard/bg_70_40_7.png',
'bg_70_40_8': 'assets/hotZooCard/hotZooCard/bg_70_40_8.png',
'bg_70_40_9': 'assets/hotZooCard/hotZooCard/bg_70_40_9.png',
'creatJsonProfile': 'assets/hotZooCard/hotZooCard/creatJsonProfile.py',
'filename': 'assets/hotZooCard/hotZooCard/filename.txt',
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