Commit 1dee227d authored by 李维's avatar 李维

添加文字选项两列配置

parent dd63da7c
...@@ -62,8 +62,8 @@ export default class NewClass extends cc.Component { ...@@ -62,8 +62,8 @@ export default class NewClass extends cc.Component {
this.hide(); this.hide();
}) })
this.node.on("show", (option, type="textList") => { this.node.on("show", (option, type="textList", col2=false) => {
this.show(option, type); this.show(option, type, col2);
}) })
const rightWrongLayout = cc.find("center/list/layout_right_wrong", this.node); const rightWrongLayout = cc.find("center/list/layout_right_wrong", this.node);
...@@ -80,7 +80,7 @@ export default class NewClass extends cc.Component { ...@@ -80,7 +80,7 @@ export default class NewClass extends cc.Component {
}) })
} }
show(option, type) { show(option, type, col2) {
this.node.opacity = 0; this.node.opacity = 0;
this.node.active = true; this.node.active = true;
cc.tween(this.node).to(0.1, { cc.tween(this.node).to(0.1, {
...@@ -92,16 +92,25 @@ export default class NewClass extends cc.Component { ...@@ -92,16 +92,25 @@ export default class NewClass extends cc.Component {
if(type == "textList") { if(type == "textList") {
this.initTitle("请选择答案"); this.initTitle("请选择答案");
const listLayout = cc.find("center/list/layout_options", this.node); const layoutName = col2 ? "layout_options_col2" : "layout_options"
const itemTemplate = cc.find("center/list/layout_options/item_tempate", this.node); const listLayout = cc.find(`center/list/${layoutName}`, this.node);
const itemTemplate = cc.find(`center/list/${layoutName}/item_tempate`, this.node);
listLayout.active = true; listLayout.active = true;
option.forEach((item, index) => { option.forEach((item, index) => {
const optionNode = cc.instantiate(itemTemplate); const optionNode = cc.instantiate(itemTemplate);
// 第一个选项不显示顶部分隔条 // 第一个选项不显示顶部分隔条
if(col2) {
if(index == 0 || index == 1) {
cc.find("line_top", optionNode).active = false;
}
} else {
if(index == 0) { if(index == 0) {
cc.find("line_top", optionNode).active = false; cc.find("line_top", optionNode).active = false;
} }
}
optionNode.name = `option_${index}` optionNode.name = `option_${index}`
const text = cc.find("text", optionNode); const text = cc.find("text", optionNode);
text.getComponent(cc.Label).string = item.label; text.getComponent(cc.Label).string = item.label;
...@@ -181,6 +190,7 @@ export default class NewClass extends cc.Component { ...@@ -181,6 +190,7 @@ export default class NewClass extends cc.Component {
opacity: 0 opacity: 0
}).call(()=>{ }).call(()=>{
const listLayout = cc.find("center/list/layout_options", this.node); const listLayout = cc.find("center/list/layout_options", this.node);
const listLayout_col2 = cc.find("center/list/layout_options_col2", this.node);
const rightWrongLayout = cc.find("center/list/layout_right_wrong", this.node); const rightWrongLayout = cc.find("center/list/layout_right_wrong", this.node);
listLayout.active = false; listLayout.active = false;
rightWrongLayout.active = false; rightWrongLayout.active = false;
...@@ -192,6 +202,12 @@ export default class NewClass extends cc.Component { ...@@ -192,6 +202,12 @@ export default class NewClass extends cc.Component {
child.destroy(); child.destroy();
} }
}) })
listLayout_col2.children.forEach(child=>{
if(child.name != "item_tempate") {
child.destroy();
}
})
}).start(); }).start();
} }
......
This diff is collapsed.
...@@ -2828,7 +2828,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -2828,7 +2828,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
lastText = rect.cleanLast() lastText = rect.cleanLast()
} }
let selectData = await this.asyncShowSelectModal(optionList, "textList"); let selectData = await this.asyncShowSelectModal(optionList, "textList", contentData.oplistCol2?true:false);
// 如果点击了取消 则还原上次显示 // 如果点击了取消 则还原上次显示
const inputLabel = this.newInputTextNode(selectData?selectData.value:lastText, 0); const inputLabel = this.newInputTextNode(selectData?selectData.value:lastText, 0);
inputLabel.x = rect.width / 2; inputLabel.x = rect.width / 2;
...@@ -4385,7 +4385,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -4385,7 +4385,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
"Mustn't": "[@AC(Mustnot)]", "Mustn't": "[@AC(Mustnot)]",
"must not": "[@AC(mustnot)]", "must not": "[@AC(mustnot)]",
"mustn't": "[@AC(mustnot)]", "mustn't": "[@AC(mustnot)]",
} }
for(let contraction in contractionTemplate) { for(let contraction in contractionTemplate) {
...@@ -4396,9 +4395,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -4396,9 +4395,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
// 同步方式显示选择模态框 // 同步方式显示选择模态框
asyncShowSelectModal(option, type) { asyncShowSelectModal(option, type, col2) {
return new Promise((resovle, reject) => { return new Promise((resovle, reject) => {
this.selectModal.emit("show", option, type); this.selectModal.emit("show", option, type, col2);
this.onSelectedCallback = (target, e) => { this.onSelectedCallback = (target, e) => {
if(e == undefined) { if(e == undefined) {
// 点击了取消 // 点击了取消
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -616,6 +616,11 @@ ...@@ -616,6 +616,11 @@
<label nz-checkbox [(ngModel)]="it.drawingCheckStrictEqual" (ngModelChange)="save()" style="margin-left: 10px;">颜色严格相等</label> <label nz-checkbox [(ngModel)]="it.drawingCheckStrictEqual" (ngModelChange)="save()" style="margin-left: 10px;">颜色严格相等</label>
</div> </div>
<div *ngIf="it.hotZoneType == TEXT_SELECT" style="margin: 10px 10px;">
<span style="display: inline-block; text-align: right; width: 150px;">两列选项:</span>
<label nz-checkbox [(ngModel)]="it.oplistCol2" (ngModelChange)="save()" style="margin-left: 10px;"></label>
</div>
<div *ngIf="it.hotZoneType == DRAWING || it.hotZoneType == DRAWING_CHECK" style="margin: 10px 10px;"> <div *ngIf="it.hotZoneType == DRAWING || it.hotZoneType == DRAWING_CHECK" style="margin: 10px 10px;">
<span style="display: inline-block; text-align: right; width: 150px;">绘图按钮在中间:</span> <span style="display: inline-block; text-align: right; width: 150px;">绘图按钮在中间:</span>
<label nz-checkbox [(ngModel)]="it.painterOnCenter" (ngModelChange)="save()" style="margin-left: 10px;"></label> <label nz-checkbox [(ngModel)]="it.painterOnCenter" (ngModelChange)="save()" style="margin-left: 10px;"></label>
......
...@@ -276,6 +276,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni ...@@ -276,6 +276,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
drawingCheckCorrectColors: [], // 正确颜色 [评分画图题] drawingCheckCorrectColors: [], // 正确颜色 [评分画图题]
drawingCheckStrictEqual: false, // 严格相等 [评分画图题] drawingCheckStrictEqual: false, // 严格相等 [评分画图题]
painterOnCenter: false, // 开启绘图按钮在绘画区中间 [评分画图题、画图题] painterOnCenter: false, // 开启绘图按钮在绘画区中间 [评分画图题、画图题]
oplistCol2: false, // 两列选择数据 [文字选项题]
} }
} }
......
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