Commit a0aab121 authored by 李维's avatar 李维

添加选项,分离选项和题目

适配选项少 题目多的题型
parent a9962782
......@@ -1583,6 +1583,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
};
const optionList = [];
if(contentData.useSelectOptionList) {
contentData.selectOptionList.forEach((option, index) => {
optionList.push({
index: index,
label: option.optionShowText ? option.optionShowText : option.text,
value: option.text,
strikeOutNode: null
})
});
}
contentData.contentList.forEach((option, index) => {
const hotZoneItemData = this.data.hotZoneItemArr[option.selectHotZoneIndex];
const resultRect = this.newRectNode(hotZoneItemData, layer_2, debugMode);
......@@ -1616,12 +1627,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
score: 0
});
optionList.push({
index: index,
label: option.optionShowText ? option.optionShowText : option.text,
value: option.text,
strikeOutNode: strikeOutHotZoneNode
})
// 如果不是独立选项数据
if(!contentData.useSelectOptionList) {
optionList.push({
index: index,
label: option.optionShowText ? option.optionShowText : option.text,
value: option.text,
strikeOutNode: strikeOutHotZoneNode
})
}
subValidater.push(()=>null)
rect.on("click", async () => {
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -64,6 +64,42 @@
<nz-option [nzValue]="IMAGE_SELECT" nzLabel="图片选项" nzDisabled></nz-option>
<nz-option [nzValue]="PRONUNCIATION_ASSESSMENT" nzLabel="语音评测" nzDisabled></nz-option>
</nz-select>
<label *ngIf="it.hotZoneType == TEXT_SELECT" nz-checkbox [(ngModel)]="it.useSelectOptionList" (ngModelChange)="handleUserSelectOptionListChange(it)" style="margin-left: 10px;">使用独立选项清单</label>
<div *ngIf="it.hotZoneType == TEXT_SELECT && it.useSelectOptionList" style="padding: 10px 0 10px 150px;">
<div style="margin-bottom: 16px;">
<span style="font-size: 14px; color: #000000d9;">选项清单</span>
<button nz-button nzSize="small" nzType="primary" style="float: right;" (click)="addHotzoneSelectOption(it)">
<span nz-icon nzType="plus-circle"></span>
添加选项
</button>
</div>
<nz-table #contentTable [nzData]="it.selectOptionList" [nzFrontPagination]="false" [nzShowPagination]="false">
<thead>
<tr>
<th nzWidth="100px" nzAlign="center">序号</th>
<th>文字</th>
<th>展示文字</th>
<th nzWidth="150px" nzAlign="center">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of contentTable.data; let i = index;">
<td nzWidth="100px" nzAlign="center">{{ i + 1 }}</td>
<td>
<input type="text" nz-input [(ngModel)]="data.text" (blur)="save()"/>
</td>
<td>
<input type="text" nz-input [(ngModel)]="data.optionShowText" (blur)="save()"/>
</td>
<td nzWidth="150px" nzAlign="center">
<a nz-popconfirm nzPopconfirmTitle="删除后不可恢复,确定删除吗?" (nzOnConfirm)="deleteHotzoneSelectOption(it, i)">删除</a>
</td>
</tr>
</tbody>
</nz-table>
</div>
<div *ngIf="it.hotZoneType != '' && it.hotZoneType != AUDIO_PLAY && it.hotZoneType != TEXTINPUT && it.hotZoneType != PRONUNCIATION_ASSESSMENT" style="padding: 10px 0 10px 150px;">
<div style="margin-bottom: 16px;">
<span style="font-size: 14px; color: #000000d9;">内容清单</span>
......@@ -79,10 +115,11 @@
<tr>
<th nzWidth="100px" nzAlign="center">序号</th>
<th nzWidth="100px" nzAlign="center">分数</th>
<th>文字</th>
<th>展示文字</th>
<th>正确热区</th>
<th>选择后划掉热区(可选)</th>
<th *ngIf="it.useSelectOptionList" nzAlign="center">正确选项</th>
<th *ngIf="!it.useSelectOptionList" nzAlign="center">文字</th>
<th *ngIf="!it.useSelectOptionList" nzAlign="center">展示文字</th>
<th nzAlign="center">正确热区</th>
<th *ngIf="!it.useSelectOptionList" nzAlign="center">选择后划掉热区(可选)</th>
<th nzWidth="150px" nzAlign="center">操作</th>
</tr>
</thead>
......@@ -92,18 +129,23 @@
<td nzWidth="100px" nzAlign="center">
<input type="text" nz-input [(ngModel)]="data.score" (blur)="save()"/>
</td>
<td>
<td *ngIf="it.useSelectOptionList" nzAlign="center">
<nz-select nzShowSearch nzAllowClear [(ngModel)]="data.selectOptionListIndex" style="width: 180px;" (ngModelChange)="save()">
<nz-option *ngFor="let itOption of it.selectOptionList; let i = index;" [nzValue]="i" [nzLabel]="itOption.text"></nz-option>
</nz-select>
</td>
<td *ngIf="!it.useSelectOptionList" nzAlign="center">
<input type="text" nz-input [(ngModel)]="data.text" (blur)="save()"/>
</td>
<td>
<td *ngIf="!it.useSelectOptionList" nzAlign="center">
<input type="text" nz-input [(ngModel)]="data.optionShowText" (blur)="save()"/>
</td>
<td>
<td nzAlign="center">
<nz-select nzShowSearch nzAllowClear [(ngModel)]="data.selectHotZoneIndex" style="width: 180px;" (ngModelChange)="save()">
<nz-option *ngFor="let itOption of item.hotZoneItemArr" [nzValue]="itOption.index" [nzLabel]="itOption.itemName"></nz-option>
</nz-select>
</td>
<td>
<td *ngIf="!it.useSelectOptionList" nzAlign="center">
<nz-select nzShowSearch nzAllowClear [(ngModel)]="data.selectStrikeOutHotZoneIndex" style="width: 180px;" (ngModelChange)="save()">
<nz-option *ngFor="let itOption of item.hotZoneItemArr" [nzValue]="itOption.index" [nzLabel]="itOption.itemName"></nz-option>
</nz-select>
......
......@@ -102,6 +102,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
selectedStyle: "border",
rightOrWrongStyleType: "symbol",
inputText: "",
useSelectOptionList: false,
selectOptionList: [
],
contentList: [
]
......@@ -155,6 +159,36 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
this.save();
}
// 添加文字选项
addHotzoneSelectOption(it) {
if(!it.selectOptionList) {
it.selectOptionList = [];
}
it.selectOptionList = [
...it.selectOptionList,
{
text: "", optionShowText: ""
}
];
this.save();
}
// 删除文字选项
deleteHotzoneSelectOption(it, index) {
if(!it.selectOptionList) {
it.selectOptionList = [];
}
it.selectOptionList.splice(index, 1);
it.selectOptionList = [
...it.selectOptionList
];
this.save();
}
// 获取默认热区内容配置
getDefaultConfigContentItem() {
return {
......@@ -173,8 +207,14 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
}
}
// 文字选择题 是否 使用独立选项配置
handleUserSelectOptionListChange(it) {
// 新增的配置 修复已有模板缺少这个字段的问题
if(!it.selectOptionList) {
it.selectOptionList = [];
}
this.save();
}
// 添加分数组
addScoreConfig() {
......
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