Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JJ_Game_Parent_Child
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
JJ_Game_Parent_Child
Commits
bd0a3ebe
Commit
bd0a3ebe
authored
May 23, 2025
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: debug
parent
43f3d886
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
6 deletions
+37
-6
form.component.html
form/src/app/form/form.component.html
+23
-4
form.component.ts
form/src/app/form/form.component.ts
+14
-2
No files found.
form/src/app/form/form.component.html
View file @
bd0a3ebe
...
...
@@ -10,6 +10,11 @@
自动填充
</button>
<div
style=
"margin-left: 30px; color: #aaa;"
>
提示:两句话为一轮比拼,句子数量仅支持双数。
</div>
<!-- <div style="margin-left: 30px; margin-top:30px; display: flex; align-items: center; ">
<h3 style="margin-right: 20px;">标题文本:</h3>
<input type="text" nz-input [(ngModel)]="item.title" (blur)="save()" style=" width: 500px;">
...
...
@@ -81,11 +86,25 @@
<div
style=
"display: flex; align-items: center; justify-content: space-between;"
>
<div
style=
"display: flex; align-items: center;"
>
<h4>
设置内容-{{j+1}}:
</h4>
</div>
<button
style=
"float:right"
nz-button
nzType=
"danger"
(
click
)="
deleteOptionBtnClick
(
ques
,
j
)"
>
x
</button>
<div
style=
"display: flex; align-items: center; gap: 8px;"
>
<!-- 上移按钮 -->
<button
nz-button
nzType=
"default"
[
disabled
]="
j =
==
0
"
(
click
)="
moveOption
(
ques
,
j
,
'
up
')"
>
<i
nz-icon
nzType=
"arrow-up"
nzTheme=
"outline"
></i>
</button>
<!-- 下移按钮 -->
<button
nz-button
nzType=
"default"
[
disabled
]="
j =
==
ques
.
optionArr
.
length
-
1
"
(
click
)="
moveOption
(
ques
,
j
,
'
down
')"
>
<i
nz-icon
nzType=
"arrow-down"
nzTheme=
"outline"
></i>
</button>
<!-- 删除按钮 -->
<button
nz-button
nzType=
"danger"
(
click
)="
deleteOptionBtnClick
(
ques
,
j
)"
>
<i
nz-icon
nzType=
"delete"
nzTheme=
"outline"
></i>
</button>
</div>
</div>
...
...
form/src/app/form/form.component.ts
View file @
bd0a3ebe
...
...
@@ -68,8 +68,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
ngOnInit
()
{
this
.
getBookTextList
();
this
.
item
=
{};
...
...
@@ -534,4 +532,18 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
return
randomArr
;
}
// 添加移动选项的方法
moveOption
(
ques
:
any
,
index
:
number
,
direction
:
'
up
'
|
'
down
'
)
{
if
(
direction
===
'
up
'
&&
index
>
0
)
{
// 上移:与上一个元素交换位置
[
ques
.
optionArr
[
index
],
ques
.
optionArr
[
index
-
1
]]
=
[
ques
.
optionArr
[
index
-
1
],
ques
.
optionArr
[
index
]];
}
else
if
(
direction
===
'
down
'
&&
index
<
ques
.
optionArr
.
length
-
1
)
{
// 下移:与下一个元素交换位置
[
ques
.
optionArr
[
index
],
ques
.
optionArr
[
index
+
1
]]
=
[
ques
.
optionArr
[
index
+
1
],
ques
.
optionArr
[
index
]];
}
this
.
save
();
}
}
\ 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