Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
duiduipeng
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
duiduipeng
Commits
c50b5fbe
Commit
c50b5fbe
authored
Jun 10, 2022
by
yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除提示
parent
1160f5fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
9 deletions
+41
-9
form.component.html
form/src/app/form/form.component.html
+14
-1
form.component.ts
form/src/app/form/form.component.ts
+27
-8
No files found.
form/src/app/form/form.component.html
View file @
c50b5fbe
...
...
@@ -188,7 +188,7 @@
</div>
<br>
<span
style=
"font-size: 20px;"
>
选项音频:
</span>
<div
style=
"display: flex"
>
<div>
<app-audio-recorder
[
audioUrl
]="
question
.
options
[
j
+
1
].
audio
"
...
...
@@ -230,4 +230,17 @@
<div
style=
"color: #f00;font-size: 12px;"
>
为保证游戏效果,每题最多配置5对选项
</div>
</button>
</div>
<nz-modal
[(
nzVisible
)]="
isVisible
"
[
nzTitle
]="
null
"
[
nzContent
]="
modalContent
"
[
nzFooter
]="
modalFooter
"
(
nzOnCancel
)="
handleCancel
()"
>
<ng-template
#
modalContent
>
<p>
{{deleteTitle}}
</p>
</ng-template>
<ng-template
#
modalFooter
>
<button
nz-button
nzType=
"default"
(
click
)="
handleCancel
()"
>
取消
</button>
<button
nz-button
nzType=
"primary"
(
click
)="
handleOk
()"
>
确定
</button>
</ng-template>
</nz-modal>
</div>
\ No newline at end of file
form/src/app/form/form.component.ts
View file @
c50b5fbe
...
...
@@ -28,8 +28,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
removeQuestion
(
idx
)
{
this
.
item
.
questions
.
splice
(
idx
,
1
);
this
.
save
();
this
.
openDelete
(
"
确定删除题目?
"
,
()
=>
{
this
.
item
.
questions
.
splice
(
idx
,
1
);
this
.
save
();
})
}
addOption
(
i
)
{
...
...
@@ -52,12 +54,14 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
removeOption
(
i
,
j
)
{
const
pairIdx
=
this
.
item
.
questions
[
i
].
options
[
j
].
pairIdx
;
this
.
item
.
questions
[
i
].
options
=
this
.
item
.
questions
[
i
].
options
.
filter
((
option
)
=>
option
.
pairIdx
!=
pairIdx
);
this
.
item
.
questions
[
i
].
options
.
forEach
((
option
,
idx
)
=>
{
option
.
pairIdx
=
Math
.
floor
(
idx
/
2
);
});
this
.
save
();
this
.
openDelete
(
"
确定删除题目?
"
,
()
=>
{
const
pairIdx
=
this
.
item
.
questions
[
i
].
options
[
j
].
pairIdx
;
this
.
item
.
questions
[
i
].
options
=
this
.
item
.
questions
[
i
].
options
.
filter
((
option
)
=>
option
.
pairIdx
!=
pairIdx
);
this
.
item
.
questions
[
i
].
options
.
forEach
((
option
,
idx
)
=>
{
option
.
pairIdx
=
Math
.
floor
(
idx
/
2
);
});
this
.
save
();
})
}
copyOption
(
i
,
j
)
{
if
(
this
.
item
.
questions
[
i
].
options
.
length
>=
10
)
{
...
...
@@ -116,6 +120,21 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
isVisible
=
false
;
deleteTitle
=
"
是否删除题目
"
;
deleteCallback
=
function
()
{
};
openDelete
(
title
,
callback
)
{
this
.
deleteCallback
=
callback
;
this
.
deleteTitle
=
title
;
this
.
isVisible
=
true
;
}
handleCancel
()
{
this
.
isVisible
=
false
;
}
handleOk
()
{
this
.
deleteCallback
&&
this
.
deleteCallback
();
this
.
handleCancel
();
}
/**
* 储存图片数据
...
...
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