Commit 5ea1c6ca authored by yu's avatar yu

表单

parent 40c3401d
...@@ -37,8 +37,8 @@ export default class Game { ...@@ -37,8 +37,8 @@ export default class Game {
this.score = data.score; this.score = data.score;
this.aniEnter = data.aniEnter; this.aniEnter = data.aniEnter;
let id = 0; let id = 0;
for (let i = 0; i < this.data.item.length; i++) { for (let i = 0; i < this.data.questions.length; i++) {
let data = this.data.item[i]; let data = this.data.questions[i];
data.page = id++; data.page = id++;
this.lists.push(data); this.lists.push(data);
} }
......
...@@ -9833,7 +9833,7 @@ ...@@ -9833,7 +9833,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 267, "width": 344,
"height": 97 "height": 97
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -9981,7 +9981,7 @@ ...@@ -9981,7 +9981,7 @@
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "f4df267f-8ffc-495c-96ae-95cd01b59f92" "__uuid__": "256aa9a1-430c-4c92-96b6-a3ce7b98034e"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 2, "_sizeMode": 2,
...@@ -10026,7 +10026,7 @@ ...@@ -10026,7 +10026,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 267, "width": 344,
"height": 97 "height": 97
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -10174,7 +10174,7 @@ ...@@ -10174,7 +10174,7 @@
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "fb5a080b-5e50-4a37-a2d0-a040d0870e7d" "__uuid__": "69bd08e4-d059-4529-a0ce-ad07823abb15"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 1,
......
...@@ -111,7 +111,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -111,7 +111,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}, 1800); }, 1800);
} }
private showGame() { private showGame() {
if (this.roundIdx >= this.data.item.length) { if (this.roundIdx >= this.data.questions.length) {
this.gameOver(); this.gameOver();
return; return;
} }
...@@ -122,11 +122,11 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -122,11 +122,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.showLayout(); this.showLayout();
} }
private showQuestion() { private showQuestion() {
let quest = this.data.item[this.roundIdx]; let quest = this.data.questions[this.roundIdx];
let desc = cc.find("top/topTitle/title", this.node); let desc = cc.find("top/topTitle/title", this.node);
desc.active = true; desc.active = true;
desc.getComponent(cc.Label).string = quest.title; desc.getComponent(cc.Label).string = quest.text;
if (quest.audio_title) { if (quest.questionAudio) {
this.playTopLaba() this.playTopLaba()
} }
} }
...@@ -151,16 +151,16 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -151,16 +151,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
}, 150) }, 150)
let quest = this.data.item[this.roundIdx]; let quest = this.data.questions[this.roundIdx];
quest.audio_title && pg.audio.playAudioByUrl(quest.audio_title).then(() => { stop = true; }) quest.questionAudio && pg.audio.playAudioByUrl(quest.questionAudio).then(() => { stop = true; })
} }
private randomData() { private randomData() {
this.upArr = []; this.upArr = [];
this.downArr = []; this.downArr = [];
let dt = this.data.item[this.roundIdx]; let dt = this.data.questions[this.roundIdx];
if (!dt) return; if (!dt) return;
let data = dt.group; let data = dt.options;
data.forEach((dt, idx) => { data.forEach((dt, idx) => {
if (dt.up) { if (dt.up) {
dt.up.id = idx; dt.up.id = idx;
...@@ -181,7 +181,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -181,7 +181,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
private getItemLeftNode(type) { private getItemLeftNode(type) {
let item; let item;
// let isText = this.upArr[0].type == 1; // let isText = this.upArr[0].type == 1;
let isText = type == 1; let isText = type == "txt";
if (this.upArr.length == 5) { if (this.upArr.length == 5) {
item = isText ? cc.instantiate(this.item5_left) : cc.instantiate(this.item5_pic); item = isText ? cc.instantiate(this.item5_left) : cc.instantiate(this.item5_pic);
} }
...@@ -198,7 +198,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -198,7 +198,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
private getItemRightNode(type) { private getItemRightNode(type) {
let item; let item;
let isText = type == 1; let isText = type == "txt";
// let isText = this.downArr[0].type == 1; // let isText = this.downArr[0].type == 1;
if (this.upArr.length == 5) { if (this.upArr.length == 5) {
item = isText ? cc.instantiate(this.item5_right) : cc.instantiate(this.item5_pic); item = isText ? cc.instantiate(this.item5_right) : cc.instantiate(this.item5_pic);
...@@ -222,7 +222,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -222,7 +222,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
private showLayout() { private showLayout() {
let data = this.data.item.group; let data = this.data.questions.options;
this.layout_left.removeAllChildren(); this.layout_left.removeAllChildren();
this.layout_right.removeAllChildren(); this.layout_right.removeAllChildren();
let spacing = this.getlayoutSpacing(); let spacing = this.getlayoutSpacing();
...@@ -232,24 +232,24 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -232,24 +232,24 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.layout_left.getComponent(cc.Layout).paddingTop = spacing.top; this.layout_left.getComponent(cc.Layout).paddingTop = spacing.top;
this.upArr.forEach((item) => { this.upArr.forEach((item) => {
if (item.type == 1) { if (item.type == "txt") {
let textItem = this.getItemLeftNode(1); let textItem = this.getItemLeftNode("txt");
this.initTextItem(textItem, item); this.initTextItem(textItem, item);
textItem.parent = this.layout_left; textItem.parent = this.layout_left;
} else if (item.type == 0) { } else if (item.type == "img") {
let textItem = this.getItemLeftNode(0); let textItem = this.getItemLeftNode("img");
let size = this.getHeadSize(1); let size = this.getHeadSize(1);
this.initPicItem(textItem, item, size); this.initPicItem(textItem, item, size);
textItem.parent = this.layout_left; textItem.parent = this.layout_left;
} }
}); });
this.downArr.forEach((item) => { this.downArr.forEach((item) => {
if (item.type == 1) { if (item.type == "txt") {
let textItem = this.getItemRightNode(1); let textItem = this.getItemRightNode("txt");
this.initTextItem(textItem, item); this.initTextItem(textItem, item);
textItem.parent = this.layout_right; textItem.parent = this.layout_right;
} else if (item.type == 0) { } else if (item.type == "img") {
let textItem = this.getItemRightNode(0); let textItem = this.getItemRightNode("img");
let size = this.getHeadSize(2); let size = this.getHeadSize(2);
this.initPicItem(textItem, item, size); this.initPicItem(textItem, item, size);
textItem.parent = this.layout_right; textItem.parent = this.layout_right;
...@@ -487,11 +487,11 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -487,11 +487,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.resetLayout(); this.resetLayout();
}, 0.15); }, 0.15);
this._drawIndex++; this._drawIndex++;
if (this._drawIndex >= this.data.item[this.roundIdx].group.length) { if (this._drawIndex >= this.data.questions[this.roundIdx].options.length) {
this.scheduleOnce(() => { this.scheduleOnce(() => {
this._drawIndex = 0; this._drawIndex = 0;
this.roundIdx++; this.roundIdx++;
if (this.roundIdx < this.data.item.length) graphics.clear(); if (this.roundIdx < this.data.questions.length) graphics.clear();
this.showGame(); this.showGame();
// this.updateRound(); // this.updateRound();
// pg.event.emit("mouse_add"); // pg.event.emit("mouse_add");
......
export const defaultData = { export const defaultData = {
"score": 5, "score": 0,
"aniEnter": { "top": {
"skeJsonData": {}, "image": "",
"texJsonData": {}, "text": "1",
"texPngData": {}, "audio": ""
"audioUrl": "http://staging-teach.cdn.ireadabc.com/fe2520ea0b12ad8c482595f6dddf8019.mp3",
"time": 2
}, },
"item": [ "questions": [
{ {
"title": "ghjdhjghjsd", "type": "img",
"audio_title": "http://staging-teach.cdn.ireadabc.com/116fb7accb5428361836fbc46287f769.mp3", "audio": "http://staging-teach.cdn.ireadabc.com/a8ed9422993b0865fe0625fcb3253070_l.mp3",
"group": [ "text": "what",
"image": "",
"time": null,
"audioName": "",
"options": [
{ {
"up": { "up": {
"type": 1, "type": "txt",
"pic_url": "", "pic_url": "",
"text": "34534", "text": "321",
"audio_url": "http://staging-teach.cdn.ireadabc.com/fe2520ea0b12ad8c482595f6dddf8019.mp3" "audio_url": "http://staging-teach.cdn.ireadabc.com/a8ed9422993b0865fe0625fcb3253070_l.mp3",
"audioName": ""
}, },
"down": { "down": {
"type": 1, "type": "txt",
"pic_url": "", "pic_url": "",
"text": "432", "text": "434",
"audio_url": "" "audio_url": "",
"image": "http://staging-teach.cdn.ireadabc.com/66c5d99bc575bc4734ea9d837c75ad9b.png"
} }
}, },
{ {
"up": { "up": {
"type": 1, "type": "txt",
"pic_url": "", "pic_url": "",
"text": "hjky", "text": "423",
"audio_url": "" "audio_url": "http://staging-teach.cdn.ireadabc.com/65c62cd89703cce9cec9c68b41b92f5d_l.mp3",
"audioName": ""
}, },
"down": { "down": {
"type": 1, "type": "txt",
"pic_url": "", "pic_url": "",
"text": "312", "text": "423",
"audio_url": "" "audio_url": "http://staging-teach.cdn.ireadabc.com/aa8d4f0add5c41218fb7c94097641b8b_l.mp3",
"audioName": ""
} }
}, },
{ {
"up": { "up": {
"type": 1, "type": "txt",
"pic_url": "", "pic_url": "",
"text": "jkllkl", "text": "hg",
"audio_url": "" "audio_url": "http://staging-teach.cdn.ireadabc.com/a8ed9422993b0865fe0625fcb3253070_l.mp3",
"audioName": ""
}, },
"down": { "down": {
"type": 1, "type": "txt",
"pic_url": "", "pic_url": "",
"text": "kkkkk", "text": "yuuuy",
"audio_url": "" "audio_url": "http://staging-teach.cdn.ireadabc.com/aa8d4f0add5c41218fb7c94097641b8b_l.mp3",
} "audioName": ""
}
]
},
{
"title": "非凡哥的",
"audio_title": "http://staging-teach.cdn.ireadabc.com/116fb7accb5428361836fbc46287f769.mp3",
"group": [
{
"up": {
"type": 0,
"pic_url": "http://staging-teach.cdn.ireadabc.com/6693ddf8840e95046b8c726c6ba6ca54.png",
"text": "",
"audio_url": ""
},
"down": {
"type": 1,
"pic_url": "",
"text": "就认识的方法的",
"audio_url": ""
}
},
{
"up": {
"type": 0,
"pic_url": "http://staging-teach.cdn.ireadabc.com/6689e11c1646fba838a51c212b7770d2.png",
"text": "",
"audio_url": ""
},
"down": {
"type": 1,
"pic_url": "",
"text": "跟换成",
"audio_url": ""
}
},
{
"up": {
"type": 0,
"pic_url": "http://staging-teach.cdn.ireadabc.com/e359730cf593c396a58e020333026fac.png",
"text": "",
"audio_url": ""
},
"down": {
"type": 1,
"pic_url": "",
"text": "兰陵缭乱",
"audio_url": ""
} }
}, },
{ {
"up": { "up": {
"type": 0, "type": "txt",
"pic_url": "http://staging-teach.cdn.ireadabc.com/bcc13bb8f504b17ee9d07d8f5204b12f.png",
"text": "",
"audio_url": ""
},
"down": {
"type": 1,
"pic_url": "",
"text": "太多",
"audio_url": ""
}
}
]
},
{
"title": "搞明白发给",
"audio_title": "",
"group": [
{
"up": {
"type": 1,
"pic_url": "", "pic_url": "",
"text": "非凡哥", "text": "56545",
"audio_url": "" "audio_url": "http://staging-teach.cdn.ireadabc.com/65c62cd89703cce9cec9c68b41b92f5d_l.mp3",
"audioName": ""
}, },
"down": { "down": {
"type": 1, "type": "txt",
"pic_url": "", "pic_url": "",
"text": "湖广会馆", "text": "6546",
"audio_url": "" "audio_url": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610_l.mp3",
"audioName": ""
} }
}, },
{ {
"up": { "up": {
"type": 1, "type": "txt",
"pic_url": "", "pic_url": "",
"text": "皇家公馆和", "text": "334",
"audio_url": "" "audio_url": "http://staging-teach.cdn.ireadabc.com/aa8d4f0add5c41218fb7c94097641b8b_l.mp3",
"audioName": ""
}, },
"down": { "down": {
"type": 1, "type": "txt",
"pic_url": "", "pic_url": "",
"text": "十三道", "text": "3423",
"audio_url": "" "audio_url": "http://staging-teach.cdn.ireadabc.com/aa8d4f0add5c41218fb7c94097641b8b_l.mp3",
} "audioName": ""
},
{
"up": {
"type": 1,
"pic_url": "",
"text": "更方便",
"audio_url": ""
},
"down": {
"type": 1,
"pic_url": "",
"text": "不女",
"audio_url": ""
} }
} }
] ]
}, },
{ {
"title": "工本费播放码", "type": "img",
"audio_title": "", "audio": "",
"group": [ "text": "zxc",
{ "image": "",
"up": { "time": null,
"type": 0, "audioName": "",
"pic_url": "http://staging-teach.cdn.ireadabc.com/7ab9b9239675038288b09ca3525e111e.png", "options": [
"text": "",
"audio_url": ""
},
"down": {
"type": 0,
"pic_url": "http://staging-teach.cdn.ireadabc.com/7ab9b9239675038288b09ca3525e111e.png",
"text": "",
"audio_url": ""
}
},
{ {
"up": { "up": {
"type": 0, "type": "img",
"pic_url": "http://staging-teach.cdn.ireadabc.com/bcc13bb8f504b17ee9d07d8f5204b12f.png", "pic_url": "http://staging-teach.cdn.ireadabc.com/4b04b4769ea192344512f4849bb252bc.png",
"text": "", "text": "",
"audio_url": "" "audio_url": "http://staging-teach.cdn.ireadabc.com/aa8d4f0add5c41218fb7c94097641b8b_l.mp3",
"audioName": ""
}, },
"down": { "down": {
"type": 0, "type": "img",
"pic_url": "http://staging-teach.cdn.ireadabc.com/bcc13bb8f504b17ee9d07d8f5204b12f.png",
"text": "", "text": "",
"audio_url": "" "audio_url": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610_l.mp3",
"audioName": "",
"pic_url": "http://staging-teach.cdn.ireadabc.com/4b04b4769ea192344512f4849bb252bc.png"
} }
}, },
{ {
"up": { "up": {
"type": 0, "type": "img",
"pic_url": "http://staging-teach.cdn.ireadabc.com/b84efeac2d0bc3f32f1dffb6734aeea6.png", "pic_url": "http://staging-teach.cdn.ireadabc.com/d1470f33d8ffd93d8e080ff461935bac.png",
"text": "", "text": "",
"audio_url": "" "audio_url": "http://staging-teach.cdn.ireadabc.com/aa8d4f0add5c41218fb7c94097641b8b_l.mp3",
"audioName": ""
}, },
"down": { "down": {
"type": 0, "type": "img",
"pic_url": "http://staging-teach.cdn.ireadabc.com/b84efeac2d0bc3f32f1dffb6734aeea6.png",
"text": "", "text": "",
"audio_url": "" "audio_url": "http://staging-teach.cdn.ireadabc.com/a8ed9422993b0865fe0625fcb3253070_l.mp3",
"audioName": "",
"pic_url": "http://staging-teach.cdn.ireadabc.com/d1470f33d8ffd93d8e080ff461935bac.png"
} }
}, },
{ {
"up": { "up": {
"type": 0, "type": "img",
"pic_url": "http://staging-teach.cdn.ireadabc.com/ce43980b533f674f9debe6ce9cae7b8d.png", "pic_url": "http://staging-teach.cdn.ireadabc.com/dec15decdbc3d72983dfab3b66a2fd8d.png",
"text": "", "text": "",
"audio_url": "" "audio_url": "http://staging-teach.cdn.ireadabc.com/a8ed9422993b0865fe0625fcb3253070_l.mp3",
"audioName": ""
}, },
"down": { "down": {
"type": 0, "type": "img",
"pic_url": "http://staging-teach.cdn.ireadabc.com/ce43980b533f674f9debe6ce9cae7b8d.png",
"text": "", "text": "",
"audio_url": "" "audio_url": "http://staging-teach.cdn.ireadabc.com/a8ed9422993b0865fe0625fcb3253070_l.mp3",
"audioName": "",
"pic_url": "http://staging-teach.cdn.ireadabc.com/dec15decdbc3d72983dfab3b66a2fd8d.png"
} }
} }
] ]
......
...@@ -80,11 +80,11 @@ ...@@ -80,11 +80,11 @@
<input type="text" nz-input [(ngModel)]="item.score" (blur)="save()"> <input type="text" nz-input [(ngModel)]="item.score" (blur)="save()">
<span style="font-size: 20px;">标题文字: </span> <span style="font-size: 20px;">标题文字: </span>
<input type="text" nz-input [(ngModel)]="item.top.text" (blur)="save()"> <input type="text" nz-input [(ngModel)]="item.top.text" (blur)="save()">
<span style="font-size: 20px;">标题图片: </span> <!-- <span style="font-size: 20px;">标题图片: </span>
<div style="width:300px"> <div style="width:300px">
<app-upload-image-with-preview [picUrl]="item.top.image" <app-upload-image-with-preview [picUrl]="item.top.image"
(imageUploaded)="onImageUploadSuccess($event,'image', item.top)"></app-upload-image-with-preview> (imageUploaded)="onImageUploadSuccess($event,'image', item.top)"></app-upload-image-with-preview>
</div> </div> -->
<span style="font-size: 20px;">标题音频: </span> <span style="font-size: 20px;">标题音频: </span>
<div style="display:flex ;"> <div style="display:flex ;">
<div> <div>
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
</div> </div>
</div> </div>
<div class="option-img"> <!-- <div class="option-img">
<div class="word-input-title"> <div class="word-input-title">
默认线图: 默认线图:
</div> </div>
...@@ -140,13 +140,13 @@ ...@@ -140,13 +140,13 @@
<app-upload-image-with-preview [picUrl]="question.image" <app-upload-image-with-preview [picUrl]="question.image"
(imageUploaded)="onImageUploadSuccess($event,'image', question)"></app-upload-image-with-preview> (imageUploaded)="onImageUploadSuccess($event,'image', question)"></app-upload-image-with-preview>
</div> </div>
</div> </div> -->
<div *ngFor="let option of question.options; let m = index"> <div *ngFor="let option of question.options; let j = index">
<div style="display: flex;margin-top: 20px;"> <div style="display: flex;margin-top: 20px;">
<div class="border-dashed" style="min-width: 700px;"> <div class="border-dashed" style="min-width: 700px;">
<div class="option-title"> <div class="option-title">
<span>连线组-{{ i + 1 }} </span> <span>连线组-{{ j + 1 }} </span>
</div> </div>
<div> <div>
...@@ -155,25 +155,88 @@ ...@@ -155,25 +155,88 @@
选项类型: 选项类型:
</div> </div>
<div style="margin-top: 5px;"> <div style="margin-top: 5px;">
<nz-radio-group [(ngModel)]="option.type" (ngModelChange)="ngChange(i,j)"> <nz-radio-group [(ngModel)]="option.up.type" (ngModelChange)="ngChange(i,j)">
<label nz-radio nzValue="img">
<span [style]="{color:option.up.type=='img' ? '#169BD5':'#000'}">图片</span>
</label>
<label nz-radio nzValue="txt">
<span [style]="{color:option.up.type=='txt' ? '#169BD5':'#000'}">文字</span>
</label>
</nz-radio-group>
</div>
</div>
<div style="margin-top: 15px;">
<div class="option-img">
<div *ngIf="option.up.type=='img'">
<div class="word-input-title">
图片:
</div>
<div style="width: 300px;">
<app-upload-image-with-preview [picUrl]="option.up.pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url', option.up)">
</app-upload-image-with-preview>
</div>
</div>
</div>
<div class="option-audio">
<div class="word-input-title">
音频:
</div>
<div style="display: flex">
<div>
<app-audio-recorder [audioUrl]="option.up.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url', option.up)">
</app-audio-recorder>
</div>
<div style="margin: 5px">
<span>
{{ option.up.audioName}}
</span>
</div>
</div>
</div>
<div class="option-text" *ngIf="option.up.type=='txt'">
<div class="word-input-title">
<!-- <span style="color:red;margin-left:-15px">* </span> -->
<span>文本: </span>
</div>
<input class="input-place-red" type="text" nz-input [(ngModel)]="option.up.text"
(blur)="save()">
</div>
</div>
<div style="margin-top: 20px;">
<div class="word-type-option-title">
选项类型:
</div>
<div style="margin-top: 5px;">
<nz-radio-group [(ngModel)]="option.down.type" (ngModelChange)="ngChange(i,j)">
<label nz-radio nzValue="img"> <label nz-radio nzValue="img">
<span [style]="{color:option.type=='img' ? '#169BD5':'#000'}">图片</span> <span [style]="{color:option.down.type=='img' ? '#169BD5':'#000'}">图片</span>
</label> </label>
<label nz-radio nzValue="txt"> <label nz-radio nzValue="txt">
<span [style]="{color:option.type=='txt' ? '#169BD5':'#000'}">文字</span> <span [style]="{color:option.down.type=='txt' ? '#169BD5':'#000'}">文字</span>
</label> </label>
</nz-radio-group> </nz-radio-group>
</div> </div>
</div> </div>
<div style="margin-top: 15px;"> <div style="margin-top: 15px;">
<div class="option-img"> <div class="option-img">
<div *ngIf="option.type=='img'"> <div *ngIf="option.down.type=='img'">
<div class="word-input-title"> <div class="word-input-title">
图片: 图片:
</div> </div>
<div style="width: 300px;"> <div style="width: 300px;">
<app-upload-image-with-preview [picUrl]="option.image" <app-upload-image-with-preview [picUrl]="option.down.pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'image', option)"> (imageUploaded)="onImageUploadSuccess($event, 'pic_url', option.down)">
</app-upload-image-with-preview> </app-upload-image-with-preview>
</div> </div>
</div> </div>
...@@ -185,35 +248,38 @@ ...@@ -185,35 +248,38 @@
<div style="display: flex"> <div style="display: flex">
<div> <div>
<app-audio-recorder [audioUrl]="option.audio" <app-audio-recorder [audioUrl]="option.down.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio', option)"> (audioUploaded)="onAudioUploadSuccess($event, 'audio_url', option.down)">
</app-audio-recorder> </app-audio-recorder>
</div> </div>
<div style="margin: 5px"> <div style="margin: 5px">
<span> <span>
{{ option.audioName}} {{ option.down.audioName}}
</span> </span>
</div> </div>
</div> </div>
</div> </div>
<div class="option-text" *ngIf="option.type=='txt'"> <div class="option-text" *ngIf="option.down.type=='txt'">
<div class="word-input-title"> <div class="word-input-title">
<!-- <span style="color:red;margin-left:-15px">* </span> --> <!-- <span style="color:red;margin-left:-15px">* </span> -->
<span>文本: </span> <span>文本: </span>
</div> </div>
<input class="input-place-red" type="text" nz-input [(ngModel)]="option.text" (blur)="save()"> <input class="input-place-red" type="text" nz-input [(ngModel)]="option.down.text"
(blur)="save()">
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div style="margin-left: 10px;"> <div style="margin-left: 10px;">
<button class="btn-red" nz-button nzType="default" nzDanger (click)="removeOption(i,m)">删除选项</button> <button class="btn-red" nz-button nzType="default" nzDanger (click)="removeOption(i,j)">删除选项</button>
</div> </div>
</div> </div>
</div> </div>
<button *ngIf="item.questions.length < 6" class="btn-blue" style="margin-top: 10px;" nz-button <button *ngIf="question.options.length < 5" class="btn-blue" style="margin-top: 10px;" nz-button
nzType="default" nzDanger (click)="addOption(i)">增加选项</button> nzType="default" nzDanger (click)="addOption(i)">增加选项</button>
</div> </div>
<div style="margin:0 20px"> <div style="margin:0 20px">
...@@ -225,8 +291,8 @@ ...@@ -225,8 +291,8 @@
</div> </div>
<div style="margin-top: 20px;"> <div style="margin-top: 20px;">
<button *ngIf="item.questions.length < 6" class="btn-blue" style="width: 1000px; height: 50px;" nz-button <button class="btn-blue" style="width: 1000px; height: 50px;" nz-button nzType="default" nzDanger
nzType="default" nzDanger (click)="addQuestion()">+增加题目</button> (click)="addQuestion()">+增加题目</button>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -11,13 +11,13 @@ import { ComponentBase } from './ComponentBase'; ...@@ -11,13 +11,13 @@ import { ComponentBase } from './ComponentBase';
export class FormComponent extends ComponentBase implements OnInit, OnChanges, OnDestroy { export class FormComponent extends ComponentBase implements OnInit, OnChanges, OnDestroy {
// 储存数据用 // 储存数据用
saveKey = "card_machine"; saveKey = "boy04";
// 储存对象 // 储存对象
item: any = { item: any = {
score: 0, score: 0,
top: { top: {
image: "", image: "",
text: "", text: "1",
audio: "", audio: "",
}, },
//1 ~ 6 个 //1 ~ 6 个
...@@ -88,16 +88,27 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -88,16 +88,27 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
} }
addOption(idx) { addOption(idx) {
if (this.item.questions[idx].options.length == 6) return; // if (this.item.questions[idx].options.length == 6) return;
this.item.questions[idx].options.push({ this.item.questions[idx].options.push({
right: false, up: {
colorImgWait: '', type: 'txt',
colorImgSelected: '', pic_url: '',
image: '', text: '',
audio_url: ''
},
down: {
type: 'txt',
pic_url: '',
text: '',
audio_url: ''
},
}); });
this.save(); this.save();
} }
ngChange(i, j) {
this.save();
}
removeOption(idx, n) { removeOption(idx, n) {
this.openDelete("确定删除选项?", () => { this.openDelete("确定删除选项?", () => {
this.item.questions[idx].options.splice(n, 1); this.item.questions[idx].options.splice(n, 1);
......
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