Commit bc5295c6 authored by LikG21's avatar LikG21

游戏配置更换

parent b1dd2c8f
This diff is collapsed.
...@@ -9,7 +9,7 @@ import { MetaFormCreator } from './mataFormCreator'; ...@@ -9,7 +9,7 @@ import { MetaFormCreator } from './mataFormCreator';
}) })
export class FormComponent extends ComponentBase implements OnInit, OnChanges, OnDestroy { export class FormComponent extends ComponentBase implements OnInit, OnChanges, OnDestroy {
// 储存数据用 // 储存数据用
saveKey = "hy_06"; saveKey = "hy_08";
item = { item = {
onlineFlg: false, onlineFlg: false,
...@@ -21,6 +21,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -21,6 +21,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
bgAudioName: "", bgAudioName: "",
audioName: "" audioName: ""
}; };
isVisible = false; isVisible = false;
deleteTitle = "是否删除题目"; deleteTitle = "是否删除题目";
deleteCallback = function () { }; deleteCallback = function () { };
...@@ -39,35 +40,29 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -39,35 +40,29 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
init(): void { init(): void {
/* console.log(new MetaFormCreator().create()); */ console.log(new MetaFormCreator().create());
} }
removeoption(i, j) { removeoption(i, j) {
if ((this.item.questions[i].optionsType == "img" || this.item.questions[i].optionsType == "shortTxt") && this.item.questions[i].letterList.length > 2) { this.openDelete("确定删除选项?", () => {
this.openDelete("确定减少选项?", () => { this.item.questions[i].options.splice(j, 1);
this.item.questions[i].letterList.splice(j, 2); this.save();
this.save(); })
})
} else {
this.openDelete("确定减少选项?", () => {
this.item.questions[i].letterList.splice(j, 1);
this.save();
})
}
} }
copyOption(i, j) { copyOption(i, j) {
let data = this.item.questions[i].letterList[j]; let data = this.item.questions[i].options[j];
this.item.questions[i].letterList.push(JSON.parse(JSON.stringify(data))); this.item.questions[i].options.push(JSON.parse(JSON.stringify(data)));
this.save(); this.save();
} }
addoption(i) { addoption(i) {
this.item.questions[i].letterList.push({ this.item.questions[i].options.push({
answer: '', type: "",
image: "", image: "",
shortText: "", audio: "",
longText: "", text: "",
}) right: false
});
this.save(); this.save();
} }
...@@ -80,32 +75,19 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -80,32 +75,19 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
addquestion() { addquestion() {
this.item.questions.push({ this.item.questions.push({
optionsType: "img",
questionAudio: "", questionAudio: "",
duration: 120, duration: 120,
type: "img", options: []
image: "",
index: '',
audio: "",
text: "",
right: false,
letterList: [],
}); });
this.save(); this.save();
} }
deleteBgAudio() { deleteBgAudio() {
this.item.bgAudio = ""; this.item.bgAudio = "";
this.item.bgAudioName = ""; this.item.bgAudioName = "";
this.save(); this.save();
} }
button1() { ngChange(i, j) {
console.log(this.item, '456')
}
ngChange(i) {
for (let a = 0; a < this.item.questions[i].letterList.length; a++) {
this.item.questions[i].letterList[a].answer = false
}
this.item.questions[i].letterList[this.item.questions[i].index].answer = true
this.save(); 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