Commit bd0a3ebe authored by limingzhe's avatar limingzhe

fix: debug

parent 43f3d886
......@@ -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>
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment