Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BOY04
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
BOY04
Commits
5ea1c6ca
Commit
5ea1c6ca
authored
Jun 24, 2022
by
yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表单
parent
40c3401d
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
216 additions
and
213 deletions
+216
-213
Game.ts
assets/boy04/scene/Game.ts
+2
-2
boy04.fire
assets/boy04/scene/boy04.fire
+4
-4
boy04.ts
assets/boy04/scene/boy04.ts
+21
-21
defaultData.ts
assets/boy04/script/defaultData.ts
+84
-158
form.component.html
form/src/app/form/form.component.html
+87
-21
form.component.ts
form/src/app/form/form.component.ts
+18
-7
No files found.
assets/boy04/scene/Game.ts
View file @
5ea1c6ca
...
...
@@ -37,8 +37,8 @@ export default class Game {
this
.
score
=
data
.
score
;
this
.
aniEnter
=
data
.
aniEnter
;
let
id
=
0
;
for
(
let
i
=
0
;
i
<
this
.
data
.
item
.
length
;
i
++
)
{
let
data
=
this
.
data
.
item
[
i
];
for
(
let
i
=
0
;
i
<
this
.
data
.
questions
.
length
;
i
++
)
{
let
data
=
this
.
data
.
questions
[
i
];
data
.
page
=
id
++
;
this
.
lists
.
push
(
data
);
}
...
...
assets/boy04/scene/boy04.fire
View file @
5ea1c6ca
...
...
@@ -9833,7 +9833,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width":
267
,
"width":
344
,
"height": 97
},
"_anchorPoint": {
...
...
@@ -9981,7 +9981,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "
f4df267f-8ffc-495c-96ae-95cd01b59f92
"
"__uuid__": "
256aa9a1-430c-4c92-96b6-a3ce7b98034e
"
},
"_type": 0,
"_sizeMode": 2,
...
...
@@ -10026,7 +10026,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width":
267
,
"width":
344
,
"height": 97
},
"_anchorPoint": {
...
...
@@ -10174,7 +10174,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "
fb5a080b-5e50-4a37-a2d0-a040d0870e7d
"
"__uuid__": "
69bd08e4-d059-4529-a0ce-ad07823abb15
"
},
"_type": 0,
"_sizeMode": 1,
...
...
assets/boy04/scene/boy04.ts
View file @
5ea1c6ca
...
...
@@ -111,7 +111,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
},
1800
);
}
private
showGame
()
{
if
(
this
.
roundIdx
>=
this
.
data
.
item
.
length
)
{
if
(
this
.
roundIdx
>=
this
.
data
.
questions
.
length
)
{
this
.
gameOver
();
return
;
}
...
...
@@ -122,11 +122,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
showLayout
();
}
private
showQuestion
()
{
let
quest
=
this
.
data
.
item
[
this
.
roundIdx
];
let
quest
=
this
.
data
.
questions
[
this
.
roundIdx
];
let
desc
=
cc
.
find
(
"
top/topTitle/title
"
,
this
.
node
);
desc
.
active
=
true
;
desc
.
getComponent
(
cc
.
Label
).
string
=
quest
.
t
itle
;
if
(
quest
.
audio_title
)
{
desc
.
getComponent
(
cc
.
Label
).
string
=
quest
.
t
ext
;
if
(
quest
.
questionAudio
)
{
this
.
playTopLaba
()
}
}
...
...
@@ -151,16 +151,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
},
150
)
let
quest
=
this
.
data
.
item
[
this
.
roundIdx
];
quest
.
audio_title
&&
pg
.
audio
.
playAudioByUrl
(
quest
.
audio_title
).
then
(()
=>
{
stop
=
true
;
})
let
quest
=
this
.
data
.
questions
[
this
.
roundIdx
];
quest
.
questionAudio
&&
pg
.
audio
.
playAudioByUrl
(
quest
.
questionAudio
).
then
(()
=>
{
stop
=
true
;
})
}
private
randomData
()
{
this
.
upArr
=
[];
this
.
downArr
=
[];
let
dt
=
this
.
data
.
item
[
this
.
roundIdx
];
let
dt
=
this
.
data
.
questions
[
this
.
roundIdx
];
if
(
!
dt
)
return
;
let
data
=
dt
.
group
;
let
data
=
dt
.
options
;
data
.
forEach
((
dt
,
idx
)
=>
{
if
(
dt
.
up
)
{
dt
.
up
.
id
=
idx
;
...
...
@@ -181,7 +181,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
getItemLeftNode
(
type
)
{
let
item
;
// let isText = this.upArr[0].type == 1;
let
isText
=
type
==
1
;
let
isText
=
type
==
"
txt
"
;
if
(
this
.
upArr
.
length
==
5
)
{
item
=
isText
?
cc
.
instantiate
(
this
.
item5_left
)
:
cc
.
instantiate
(
this
.
item5_pic
);
}
...
...
@@ -198,7 +198,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
private
getItemRightNode
(
type
)
{
let
item
;
let
isText
=
type
==
1
;
let
isText
=
type
==
"
txt
"
;
// let isText = this.downArr[0].type == 1;
if
(
this
.
upArr
.
length
==
5
)
{
item
=
isText
?
cc
.
instantiate
(
this
.
item5_right
)
:
cc
.
instantiate
(
this
.
item5_pic
);
...
...
@@ -222,7 +222,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
private
showLayout
()
{
let
data
=
this
.
data
.
item
.
group
;
let
data
=
this
.
data
.
questions
.
options
;
this
.
layout_left
.
removeAllChildren
();
this
.
layout_right
.
removeAllChildren
();
let
spacing
=
this
.
getlayoutSpacing
();
...
...
@@ -232,24 +232,24 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
layout_left
.
getComponent
(
cc
.
Layout
).
paddingTop
=
spacing
.
top
;
this
.
upArr
.
forEach
((
item
)
=>
{
if
(
item
.
type
==
1
)
{
let
textItem
=
this
.
getItemLeftNode
(
1
);
if
(
item
.
type
==
"
txt
"
)
{
let
textItem
=
this
.
getItemLeftNode
(
"
txt
"
);
this
.
initTextItem
(
textItem
,
item
);
textItem
.
parent
=
this
.
layout_left
;
}
else
if
(
item
.
type
==
0
)
{
let
textItem
=
this
.
getItemLeftNode
(
0
);
}
else
if
(
item
.
type
==
"
img
"
)
{
let
textItem
=
this
.
getItemLeftNode
(
"
img
"
);
let
size
=
this
.
getHeadSize
(
1
);
this
.
initPicItem
(
textItem
,
item
,
size
);
textItem
.
parent
=
this
.
layout_left
;
}
});
this
.
downArr
.
forEach
((
item
)
=>
{
if
(
item
.
type
==
1
)
{
let
textItem
=
this
.
getItemRightNode
(
1
);
if
(
item
.
type
==
"
txt
"
)
{
let
textItem
=
this
.
getItemRightNode
(
"
txt
"
);
this
.
initTextItem
(
textItem
,
item
);
textItem
.
parent
=
this
.
layout_right
;
}
else
if
(
item
.
type
==
0
)
{
let
textItem
=
this
.
getItemRightNode
(
0
);
}
else
if
(
item
.
type
==
"
img
"
)
{
let
textItem
=
this
.
getItemRightNode
(
"
img
"
);
let
size
=
this
.
getHeadSize
(
2
);
this
.
initPicItem
(
textItem
,
item
,
size
);
textItem
.
parent
=
this
.
layout_right
;
...
...
@@ -487,11 +487,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
resetLayout
();
},
0.15
);
this
.
_drawIndex
++
;
if
(
this
.
_drawIndex
>=
this
.
data
.
item
[
this
.
roundIdx
].
group
.
length
)
{
if
(
this
.
_drawIndex
>=
this
.
data
.
questions
[
this
.
roundIdx
].
options
.
length
)
{
this
.
scheduleOnce
(()
=>
{
this
.
_drawIndex
=
0
;
this
.
roundIdx
++
;
if
(
this
.
roundIdx
<
this
.
data
.
item
.
length
)
graphics
.
clear
();
if
(
this
.
roundIdx
<
this
.
data
.
questions
.
length
)
graphics
.
clear
();
this
.
showGame
();
// this.updateRound();
// pg.event.emit("mouse_add");
...
...
assets/boy04/script/defaultData.ts
View file @
5ea1c6ca
This diff is collapsed.
Click to expand it.
form/src/app/form/form.component.html
View file @
5ea1c6ca
...
...
@@ -80,11 +80,11 @@
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
score
"
(
blur
)="
save
()"
>
<span
style=
"font-size: 20px;"
>
标题文字:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
top
.
text
"
(
blur
)="
save
()"
>
<span
style=
"font-size: 20px;"
>
标题图片:
</span>
<
!-- <
span style="font-size: 20px;">标题图片: </span>
<div style="width:300px">
<app-upload-image-with-preview [picUrl]="item.top.image"
(imageUploaded)="onImageUploadSuccess($event,'image', item.top)"></app-upload-image-with-preview>
</div>
</div>
-->
<span
style=
"font-size: 20px;"
>
标题音频:
</span>
<div
style=
"display:flex ;"
>
<div>
...
...
@@ -132,7 +132,7 @@
</div>
</div>
<div
class=
"option-img"
>
<
!-- <
div class="option-img">
<div class="word-input-title">
默认线图:
</div>
...
...
@@ -140,13 +140,13 @@
<app-upload-image-with-preview [picUrl]="question.image"
(imageUploaded)="onImageUploadSuccess($event,'image', question)"></app-upload-image-with-preview>
</div>
</div>
</div>
-->
<div
*
ngFor=
"let option of question.options; let
m
= index"
>
<div
*
ngFor=
"let option of question.options; let
j
= index"
>
<div
style=
"display: flex;margin-top: 20px;"
>
<div
class=
"border-dashed"
style=
"min-width: 700px;"
>
<div
class=
"option-title"
>
<span>
连线组-{{
i
+ 1 }}
</span>
<span>
连线组-{{
j
+ 1 }}
</span>
</div>
<div>
...
...
@@ -155,25 +155,88 @@
选项类型:
</div>
<div
style=
"margin-top: 5px;"
>
<nz-radio-group
[(
ngModel
)]="
option
.
type
"
(
ngModelChange
)="
ngChange
(
i
,
j
)"
>
<nz-radio-group
[(
ngModel
)]="
option
.
up
.
type
"
(
ngModelChange
)="
ngChange
(
i
,
j
)"
>
<label
nz-radio
nzValue=
"img"
>
<span
[
style
]="{
color:option
.
up
.
type=
='img'
?
'#
169BD5
'
:
'#
000
'}"
>
图片
</span>
</label>
<label
nz-radio
nzValue=
"txt"
>
<span
[
style
]="{
color:option
.
up
.
type=
='txt'
?
'#
169BD5
'
:
'#
000
'}"
>
文字
</span>
</label>
</nz-radio-group>
</div>
</div>
<div
style=
"margin-top: 15px;"
>
<div
class=
"option-img"
>
<div
*
ngIf=
"option.up.type=='img'"
>
<div
class=
"word-input-title"
>
图片:
</div>
<div
style=
"width: 300px;"
>
<app-upload-image-with-preview
[
picUrl
]="
option
.
up
.
pic_url
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
'
pic_url
',
option
.
up
)"
>
</app-upload-image-with-preview>
</div>
</div>
</div>
<div
class=
"option-audio"
>
<div
class=
"word-input-title"
>
音频:
</div>
<div
style=
"display: flex"
>
<div>
<app-audio-recorder
[
audioUrl
]="
option
.
up
.
audio_url
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audio_url
',
option
.
up
)"
>
</app-audio-recorder>
</div>
<div
style=
"margin: 5px"
>
<span>
{{ option.up.audioName}}
</span>
</div>
</div>
</div>
<div
class=
"option-text"
*
ngIf=
"option.up.type=='txt'"
>
<div
class=
"word-input-title"
>
<!-- <span style="color:red;margin-left:-15px">* </span> -->
<span>
文本:
</span>
</div>
<input
class=
"input-place-red"
type=
"text"
nz-input
[(
ngModel
)]="
option
.
up
.
text
"
(
blur
)="
save
()"
>
</div>
</div>
<div
style=
"margin-top: 20px;"
>
<div
class=
"word-type-option-title"
>
选项类型:
</div>
<div
style=
"margin-top: 5px;"
>
<nz-radio-group
[(
ngModel
)]="
option
.
down
.
type
"
(
ngModelChange
)="
ngChange
(
i
,
j
)"
>
<label
nz-radio
nzValue=
"img"
>
<span
[
style
]="{
color:option
.
type=
='img'
?
'#
169BD5
'
:
'#
000
'}"
>
图片
</span>
<span
[
style
]="{
color:option
.
down
.
type=
='img'
?
'#
169BD5
'
:
'#
000
'}"
>
图片
</span>
</label>
<label
nz-radio
nzValue=
"txt"
>
<span
[
style
]="{
color:option
.
type=
='txt'
?
'#
169BD5
'
:
'#
000
'}"
>
文字
</span>
<span
[
style
]="{
color:option
.
down
.
type=
='txt'
?
'#
169BD5
'
:
'#
000
'}"
>
文字
</span>
</label>
</nz-radio-group>
</div>
</div>
<div
style=
"margin-top: 15px;"
>
<div
class=
"option-img"
>
<div
*
ngIf=
"option.type=='img'"
>
<div
*
ngIf=
"option.
down.
type=='img'"
>
<div
class=
"word-input-title"
>
图片:
</div>
<div
style=
"width: 300px;"
>
<app-upload-image-with-preview
[
picUrl
]="
option
.
image
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
'
image
',
optio
n
)"
>
<app-upload-image-with-preview
[
picUrl
]="
option
.
down
.
pic_url
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
'
pic_url
',
option
.
dow
n
)"
>
</app-upload-image-with-preview>
</div>
</div>
...
...
@@ -185,35 +248,38 @@
<div
style=
"display: flex"
>
<div>
<app-audio-recorder
[
audioUrl
]="
option
.
audio
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audio
',
optio
n
)"
>
<app-audio-recorder
[
audioUrl
]="
option
.
down
.
audio_url
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audio
_url
',
option
.
dow
n
)"
>
</app-audio-recorder>
</div>
<div
style=
"margin: 5px"
>
<span>
{{ option.audioName}}
{{ option.
down.
audioName}}
</span>
</div>
</div>
</div>
<div
class=
"option-text"
*
ngIf=
"option.type=='txt'"
>
<div
class=
"option-text"
*
ngIf=
"option.
down.
type=='txt'"
>
<div
class=
"word-input-title"
>
<!-- <span style="color:red;margin-left:-15px">* </span> -->
<span>
文本:
</span>
</div>
<input
class=
"input-place-red"
type=
"text"
nz-input
[(
ngModel
)]="
option
.
text
"
(
blur
)="
save
()"
>
<input
class=
"input-place-red"
type=
"text"
nz-input
[(
ngModel
)]="
option
.
down
.
text
"
(
blur
)="
save
()"
>
</div>
</div>
</div>
</div>
<div
style=
"margin-left: 10px;"
>
<button
class=
"btn-red"
nz-button
nzType=
"default"
nzDanger
(
click
)="
removeOption
(
i
,
m
)"
>
删除选项
</button>
<button
class=
"btn-red"
nz-button
nzType=
"default"
nzDanger
(
click
)="
removeOption
(
i
,
j
)"
>
删除选项
</button>
</div>
</div>
</div>
<button
*
ngIf=
"
item.questions.length < 6
"
class=
"btn-blue"
style=
"margin-top: 10px;"
nz-button
<button
*
ngIf=
"
question.options.length < 5
"
class=
"btn-blue"
style=
"margin-top: 10px;"
nz-button
nzType=
"default"
nzDanger
(
click
)="
addOption
(
i
)"
>
增加选项
</button>
</div>
<div
style=
"margin:0 20px"
>
...
...
@@ -225,8 +291,8 @@
</div>
<div
style=
"margin-top: 20px;"
>
<button
*
ngIf=
"item.questions.length < 6"
class=
"btn-blue"
style=
"width: 1000px; height: 50px;"
nz-button
nzType=
"default"
nzDanger
(
click
)="
addQuestion
()"
>
+增加题目
</button>
<button
class=
"btn-blue"
style=
"width: 1000px; height: 50px;"
nz-button
nzType=
"default"
nzDanger
(
click
)="
addQuestion
()"
>
+增加题目
</button>
</div>
</div>
</div>
...
...
form/src/app/form/form.component.ts
View file @
5ea1c6ca
...
...
@@ -11,13 +11,13 @@ import { ComponentBase } from './ComponentBase';
export
class
FormComponent
extends
ComponentBase
implements
OnInit
,
OnChanges
,
OnDestroy
{
// 储存数据用
saveKey
=
"
card_machine
"
;
saveKey
=
"
boy04
"
;
// 储存对象
item
:
any
=
{
score
:
0
,
top
:
{
image
:
""
,
text
:
""
,
text
:
"
1
"
,
audio
:
""
,
},
//1 ~ 6 个
...
...
@@ -88,16 +88,27 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
}
addOption
(
idx
)
{
if
(
this
.
item
.
questions
[
idx
].
options
.
length
==
6
)
return
;
//
if (this.item.questions[idx].options.length == 6) return;
this
.
item
.
questions
[
idx
].
options
.
push
({
right
:
false
,
colorImgWait
:
''
,
colorImgSelected
:
''
,
image
:
''
,
up
:
{
type
:
'
txt
'
,
pic_url
:
''
,
text
:
''
,
audio_url
:
''
},
down
:
{
type
:
'
txt
'
,
pic_url
:
''
,
text
:
''
,
audio_url
:
''
},
});
this
.
save
();
}
ngChange
(
i
,
j
)
{
this
.
save
();
}
removeOption
(
idx
,
n
)
{
this
.
openDelete
(
"
确定删除选项?
"
,
()
=>
{
this
.
item
.
questions
[
idx
].
options
.
splice
(
n
,
1
);
...
...
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