Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
PU01
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
PU01
Commits
3fe625cf
Commit
3fe625cf
authored
Jun 25, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
178c8d28
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
28 deletions
+23
-28
ng-template-generator_20200625 12-36-57.zip
publish/ng-template-generator_20200625 12-36-57.zip
+0
-0
form.component.html
src/app/form/form.component.html
+2
-2
form.component.ts
src/app/form/form.component.ts
+6
-10
play.component.ts
src/app/play/play.component.ts
+8
-13
defaultData.js
src/assets/play/default/formData/defaultData.js
+7
-3
No files found.
publish/ng-template-generator_2020062
4 17-43-55
.zip
→
publish/ng-template-generator_2020062
5 12-36-57
.zip
View file @
3fe625cf
No preview for this file type
src/app/form/form.component.html
View file @
3fe625cf
...
@@ -88,7 +88,7 @@
...
@@ -88,7 +88,7 @@
</div>
</div>
<div
style=
"flex:5"
>
<div
style=
"flex:5"
>
<!-- <input type="text" nz-input placeholder="" [(ngModel)]="contentObj.dataArray[i]" (blur)="saveItem()" style="width: 250px;" /> -->
<!-- <input type="text" nz-input placeholder="" [(ngModel)]="contentObj.dataArray[i]" (blur)="saveItem()" style="width: 250px;" /> -->
<input
type=
"text"
nz-input
placeholder=
""
[(
ngModel
)]="
contentObj
.
dataArray
[
i
]"
(
blur
)="
handleTextChange
($
event
,
i
)"
style=
"width: 250px;"
/>
<input
type=
"text"
nz-input
placeholder=
""
[(
ngModel
)]="
contentObj
.
dataArray
[
i
]
.
text
"
(
blur
)="
handleTextChange
($
event
,
i
)"
style=
"width: 250px;"
/>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -98,7 +98,7 @@
...
@@ -98,7 +98,7 @@
图片
图片
</div>
</div>
<div
style=
"flex:5"
>
<div
style=
"flex:5"
>
<app-upload-image-with-preview
style=
"width: 100%;"
[
picUrl
]="
item
"
(
imageUploaded
)="
onImageUploadSuccessByItem
($
event
,
contentObj
.
dataArray
,
i
)"
></app-upload-image-with-preview>
<app-upload-image-with-preview
style=
"width: 100%;"
[
picUrl
]="
item
.
image_url
"
(
imageUploaded
)="
onImageUploadSuccessByItem
($
event
,
contentObj
.
dataArray
,
i
)"
></app-upload-image-with-preview>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
src/app/form/form.component.ts
View file @
3fe625cf
...
@@ -25,7 +25,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -25,7 +25,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
return
this
.
_item
;
return
this
.
_item
;
}
}
contentObj
=
{
contentObj
=
{
"
version
"
:
"
1.
0
"
,
"
version
"
:
"
1.
1
"
,
key
:
"
DataKey_PU01
"
,
key
:
"
DataKey_PU01
"
,
question
:
{
question
:
{
type
:
"
Image
"
,
type
:
"
Image
"
,
...
@@ -53,25 +53,21 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -53,25 +53,21 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
handleQuestionTypeChange
(){
handleQuestionTypeChange
(){
if
(
this
.
contentObj
.
question
.
type
!=
'
LongAudio
'
){
if
(
this
.
contentObj
.
question
.
type
!=
'
LongAudio
'
){
if
(
this
.
contentObj
.
answerType
!=
"
Text
"
){
this
.
contentObj
.
answerType
=
'
Text
'
this
.
contentObj
.
answerType
=
'
Text
'
let
len
=
this
.
contentObj
.
dataArray
.
length
this
.
contentObj
.
dataArray
=
Array
(
len
).
fill
(
""
)
}
}
}
this
.
saveItem
()
this
.
saveItem
()
}
}
handleAnswerTypeChange
(){
handleAnswerTypeChange
(){
// console.log("Change")
// console.log("Change")
let
len
=
this
.
contentObj
.
dataArray
.
length
//
let len = this.contentObj.dataArray.length
this
.
contentObj
.
dataArray
=
Array
(
len
).
fill
(
""
)
//
this.contentObj.dataArray = Array(len).fill("")
this
.
saveItem
()
this
.
saveItem
()
}
}
handleTextChange
(
e
,
index
){
handleTextChange
(
e
,
index
){
// console.log(e.target.value, index)
// console.log(e.target.value, index)
this
.
contentObj
.
dataArray
[
index
]
=
e
.
target
.
value
this
.
contentObj
.
dataArray
[
index
]
.
text
=
e
.
target
.
value
this
.
saveItem
()
this
.
saveItem
()
this
.
refresh
();
this
.
refresh
();
}
}
...
@@ -159,7 +155,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -159,7 +155,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
}
onImageUploadSuccessByItem
(
e
,
item
,
key
)
{
onImageUploadSuccessByItem
(
e
,
item
,
key
)
{
this
.
contentObj
.
dataArray
[
key
]
=
e
.
url
this
.
contentObj
.
dataArray
[
key
]
.
image_url
=
e
.
url
this
,
this
.
refresh
()
this
,
this
.
refresh
()
this
.
save
();
this
.
save
();
}
}
...
...
src/app/play/play.component.ts
View file @
3fe625cf
...
@@ -166,7 +166,9 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -166,7 +166,9 @@ export class PlayComponent implements OnInit, OnDestroy {
mapToImageArray
(
contentObj
){
mapToImageArray
(
contentObj
){
let
array
=
[]
let
array
=
[]
this
.
g_formData
.
dataArray
.
forEach
(
element
=>
{
this
.
g_formData
.
dataArray
.
forEach
(
element
=>
{
array
.
push
(
element
)
if
(
element
.
image_url
){
array
.
push
(
element
.
image_url
)
}
});
});
if
(
this
.
g_formData
.
question
.
image_url
){
if
(
this
.
g_formData
.
question
.
image_url
){
array
.
push
(
this
.
g_formData
.
question
.
image_url
)
array
.
push
(
this
.
g_formData
.
question
.
image_url
)
...
@@ -244,13 +246,6 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -244,13 +246,6 @@ export class PlayComponent implements OnInit, OnDestroy {
initBackground
(){
initBackground
(){
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
"
background-main
"
,
"
bg_face
"
,
(
w
,
h
)
=>
{
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
"
background-main
"
,
"
bg_face
"
,
(
w
,
h
)
=>
{
// let sx = this.g_canvasWidth / w
// let sy = this.g_canvasHeight / h
// let s = Math.min(sx, sy)
// return {
// sx: s,
// sy: s
// }
let
sx
=
this
.
g_canvasWidth
/
w
let
sx
=
this
.
g_canvasWidth
/
w
let
sy
=
this
.
g_canvasHeight
/
h
let
sy
=
this
.
g_canvasHeight
/
h
let
s
=
Math
.
min
(
sx
,
sy
)
let
s
=
Math
.
min
(
sx
,
sy
)
...
@@ -269,14 +264,14 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -269,14 +264,14 @@ export class PlayComponent implements OnInit, OnDestroy {
xia
.
ref
.
alpha
=
0
xia
.
ref
.
alpha
=
0
element
.
koushui
=
(
callback
?)
=>
{
element
.
koushui
=
(
callback
?)
=>
{
element
.
starAni
=
this
.
g_cartoon
.
createAnimation
(
"
icon_kou
"
,
4
,
2
00
,
()
=>
{
element
.
starAni
=
this
.
g_cartoon
.
createAnimation
(
"
icon_kou
"
,
4
,
3
00
,
()
=>
{
element
.
starAni
.
visible
=
false
;
element
.
starAni
.
visible
=
false
;
this
.
deleteElementInRender
(
element
.
starAni
.
id
)
this
.
deleteElementInRender
(
element
.
starAni
.
id
)
callback
&&
callback
()
callback
&&
callback
()
})
})
element
.
starAni
.
setScaleXY
(
this
.
g_mapScale
)
element
.
starAni
.
setScaleXY
(
this
.
g_mapScale
)
element
.
starAni
.
x
=
element
.
ref
.
x
+
300
*
this
.
g_mapScale
element
.
starAni
.
x
=
element
.
ref
.
x
+
300
*
this
.
g_mapScale
element
.
starAni
.
y
=
element
.
ref
.
y
+
39
7
*
this
.
g_mapScale
element
.
starAni
.
y
=
element
.
ref
.
y
+
39
8
*
this
.
g_mapScale
this
.
render
(
element
.
starAni
,
zIndexMap
.
animation
)
this
.
render
(
element
.
starAni
,
zIndexMap
.
animation
)
element
.
starAni
.
play
()
element
.
starAni
.
play
()
}
}
...
@@ -310,7 +305,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -310,7 +305,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// 问题卡片 文字
// 问题卡片 文字
initQuestionCard_Text
(){
initQuestionCard_Text
(){
this
.
g_formData
.
dataArray
.
forEach
((
element
,
index
)
=>
{
this
.
g_formData
.
dataArray
.
forEach
((
element
,
index
)
=>
{
this
.
m_questionCard_All
.
push
(
this
.
createQuestionCardText
(
index
,
element
))
this
.
m_questionCard_All
.
push
(
this
.
createQuestionCardText
(
index
,
element
.
text
))
});
});
this
.
m_questionCard_All
=
this
.
randomArray_shuffle
(
this
.
m_questionCard_All
)
this
.
m_questionCard_All
=
this
.
randomArray_shuffle
(
this
.
m_questionCard_All
)
this
.
alignCenter
(
this
.
m_questionCard_All
,
40
*
this
.
g_mapScale
,
true
)
this
.
alignCenter
(
this
.
m_questionCard_All
,
40
*
this
.
g_mapScale
,
true
)
...
@@ -438,10 +433,10 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -438,10 +433,10 @@ export class PlayComponent implements OnInit, OnDestroy {
// 问题卡片 图片
// 问题卡片 图片
initQuestionCard_Image
(){
initQuestionCard_Image
(){
this
.
g_formData
.
dataArray
.
forEach
((
item
,
index
)
=>
{
this
.
g_formData
.
dataArray
.
forEach
((
item
,
index
)
=>
{
this
.
m_questionCard_All
.
push
(
this
.
createQuestionCardImage
(
index
,
item
))
this
.
m_questionCard_All
.
push
(
this
.
createQuestionCardImage
(
index
,
item
.
image_url
))
})
})
this
.
m_questionCard_All
=
this
.
randomArray_shuffle
(
this
.
m_questionCard_All
)
this
.
m_questionCard_All
=
this
.
randomArray_shuffle
(
this
.
m_questionCard_All
)
this
.
alignCenter
(
this
.
m_questionCard_All
,
2
0
*
this
.
g_mapScale
,
true
)
this
.
alignCenter
(
this
.
m_questionCard_All
,
4
0
*
this
.
g_mapScale
,
true
)
}
}
createQuestionCardImage
(
index
,
data
){
createQuestionCardImage
(
index
,
data
){
...
...
src/assets/play/default/formData/defaultData.js
View file @
3fe625cf
export
default
{
export
default
{
"
version
"
:
"
1.
0
"
,
"
version
"
:
"
1.
1
"
,
key
:
"
DataKey_PU01
"
,
key
:
"
DataKey_PU01
"
,
question
:
{
question
:
{
type
:
"
Image
"
type
:
"
Text
"
,
text
:
"
Sort alphabetically
"
,
image_url
:
""
,
shortAudio_url
:
""
,
longAudio_url
:
""
},
},
answerType
:
"
Text
"
,
answerType
:
"
Text
"
,
dataArray
:
[
"
One
"
,
"
Two
"
,
"
Three
"
,
"
Four
"
]
dataArray
:
[
{
text
:
"
Blueberry
"
,
image_url
:
""
},
{
text
:
"
Cherry
"
,
image_url
:
""
},
{
text
:
"
Pineapple
"
,
image_url
:
""
}
]
}
}
\ 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