Commit 29feead2 authored by yu's avatar yu

1

parent be749228
...@@ -83,6 +83,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -83,6 +83,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(cc.Node) @property(cc.Node)
card_box: cc.Node = null; card_box: cc.Node = null;
@property(cc.Node) @property(cc.Node)
card_boximg: cc.Node = null;
@property(cc.Node)
card_img: cc.Node = null; card_img: cc.Node = null;
@property(cc.Node) @property(cc.Node)
card_txt: cc.Node = null; card_txt: cc.Node = null;
...@@ -163,11 +165,19 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -163,11 +165,19 @@ export default class SceneComponent extends MyCocosSceneComponent {
let ques = Game.getIns().getList(); let ques = Game.getIns().getList();
ques.forEach((q) => { ques.forEach((q) => {
let itemBox = cc.instantiate(this.card_box); if(q.type == "img"){
itemBox.parent = this.layout_box; let itemBox = cc.instantiate(this.card_boximg);
cc.find("desc", itemBox).getComponent(cc.Label).string = q.text; itemBox.parent = this.layout_box;
itemBox.data = q; pg.view.setNetImg( cc.find("img", itemBox), q.image, { w: 190, h: 140 });
this.wordItams.push(itemBox); itemBox.data = q;
this.wordItams.push(itemBox);
}else{
let itemBox = cc.instantiate(this.card_box);
itemBox.parent = this.layout_box;
cc.find("desc", itemBox).getComponent(cc.Label).string = q.text;
itemBox.data = q;
this.wordItams.push(itemBox);
}
}); });
let qe = Game.getIns().getCardInfo(); let qe = Game.getIns().getCardInfo();
qe.forEach((op) => { qe.forEach((op) => {
......
...@@ -50,12 +50,16 @@ export class Item { ...@@ -50,12 +50,16 @@ export class Item {
public pointsArr; public pointsArr;
public text: string; public text: string;
public isClick: boolean; public isClick: boolean;
public type;
public image;
constructor(data, page) { constructor(data, page) {
this.audio = data.audio; this.audio = data.audio;
this.text = data.text; this.text = data.text;
this.bgItem = data.bgItem; this.bgItem = data.bgItem;
this.hotZoneItemArr = data.hotZoneItemArr; this.hotZoneItemArr = data.hotZoneItemArr;
this.page = page; this.page = page;
this.type = data.type;
this.image = data.image || "";
this.optionList = data.options.map((o, idx) => { this.optionList = data.options.map((o, idx) => {
return new Option(o, this.page); return new Option(o, this.page);
...@@ -147,7 +151,7 @@ export default class Game { ...@@ -147,7 +151,7 @@ export default class Game {
public dispelCount; public dispelCount;
public aniEnter; public aniEnter;
public startAudio: string; public startAudio: string;
public time:number; public time: number;
// public questionText: string; // public questionText: string;
public init(data) { public init(data) {
// this.question = { text: data.questionText, audio: data.questionTextAudio }; // this.question = { text: data.questionText, audio: data.questionTextAudio };
......
...@@ -6,77 +6,81 @@ export const defaultData = { ...@@ -6,77 +6,81 @@ export const defaultData = {
}, },
"questionTextAudio": "http://staging-teach.cdn.ireadabc.com/c3b69ad3d51385eac7d4195773ef59f7_l.mp3", "questionTextAudio": "http://staging-teach.cdn.ireadabc.com/c3b69ad3d51385eac7d4195773ef59f7_l.mp3",
"questions": [{ "questions": [{
"options": [{ "options": [{
"type": "txt", "type": "txt",
"image": "", "image": "",
"audio": "", "audio": "",
"text": "apple", "text": "apple",
"time": "", "time": "",
"right": false "right": false
}, { }, {
"type": "img",
"image": "http://staging-teach.cdn.ireadabc.com/0a05dff8e07282a7c3b365292490da17.png",
"audio": "",
"text": "",
"time": "",
"right": false
}
],
"type": "img", "type": "img",
"image": "http://staging-teach.cdn.ireadabc.com/0a05dff8e07282a7c3b365292490da17.png", "text": "fruit",
"audio": "", "questionAudio": "",
"text": "", "contentMain": "",
"time": "", "contentArr": [],
"right": false "image": "http://staging-teach.cdn.ireadabc.com/a190861baa166812cc6c35faef0cfdcf.png"
}
],
"type": "",
"text": "fruit",
"questionAudio": "",
"contentMain": "",
"contentArr": []
}, {
"options": [{
"type": "txt",
"image": "",
"audio": "",
"text": "dog",
"time": "",
"right": false
}, { }, {
"type": "img", "options": [{
"image": "http://staging-teach.cdn.ireadabc.com/7ac42fd52f203b5a39c4261181e51ea9.png", "type": "txt",
"audio": "", "image": "",
"text": "", "audio": "",
"time": "", "text": "dog",
"right": false "time": "",
} "right": false
], }, {
"type": "", "type": "img",
"text": "animal", "image": "http://staging-teach.cdn.ireadabc.com/7ac42fd52f203b5a39c4261181e51ea9.png",
"questionAudio": "", "audio": "",
"contentMain": "", "text": "",
"contentArr": [] "time": "",
}, { "right": false
"options": [{ }
],
"type": "txt", "type": "txt",
"image": "", "text": "animal",
"audio": "", "questionAudio": "",
"text": "bot", "contentMain": "",
"time": "", "contentArr": []
"right": false
}, { }, {
"options": [{
"type": "txt",
"image": "",
"audio": "",
"text": "bot",
"time": "",
"right": false
}, {
"type": "txt",
"image": "",
"audio": "",
"text": "putput",
"time": "",
"right": false
}
],
"type": "txt", "type": "txt",
"image": "", "text": "vegetable",
"audio": "", "questionAudio": "",
"text": "putput", "contentMain": "",
"time": "", "contentArr": []
"right": false
} }
],
"type": "",
"text": "vegetable",
"questionAudio": "",
"contentMain": "",
"contentArr": []
}
], ],
"tipSwitch": 1, "tipSwitch": 1,
"startAudio": "", "startAudio": "",
"audioName": "", "audioName": "",
"time": 60, "time": 60,
"title": "sn04-分类", "title": "sn04-分类",
"opleng": 6 "opleng": 6,
"word_count": "0",
"sentence_count": "0",
"zi_count": "0"
} }
{
"ver": "2.3.5",
"uuid": "5221020d-32e1-4d9e-a581-c1ce24770c86",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 408,
"height": 290,
"platformSettings": {},
"subMetas": {
"bg_bar_img": {
"ver": "1.0.4",
"uuid": "ef68c786-f2d4-4766-9ca2-2aa31d1968fa",
"rawTextureUuid": "5221020d-32e1-4d9e-a581-c1ce24770c86",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 408,
"height": 290,
"rawWidth": 408,
"rawHeight": 290,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
...@@ -95,7 +95,22 @@ ...@@ -95,7 +95,22 @@
<div class="border-solid" style="min-width: 1000px;"> <div class="border-solid" style="min-width: 1000px;">
<div class="word-type-title"> <div class="word-type-title">
分类{{i+1}} 分类{{i+1}}
<div class=" option-text"> <div style="margin-top: 20px;">
<div class="word-type-option-title">
选项类型:
</div>
<div style="margin-top: 5px;">
<nz-radio-group [(ngModel)]="question.type" (ngModelChange)="ngChange()">
<label nz-radio nzValue="img">
<span [style]="{color:question.type=='img' ? '#169BD5':'#000'}">图片</span>
</label>
<label nz-radio nzValue="txt">
<span [style]="{color:question.type=='txt' ? '#169BD5':'#000'}">文字</span>
</label>
</nz-radio-group>
</div>
</div>
<div *ngIf="question.type=='txt'" class=" option-text">
<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>
...@@ -103,7 +118,18 @@ ...@@ -103,7 +118,18 @@
<input type="text" class="input-place-red" nz-input [(ngModel)]="question.text" placeholder="" <input type="text" class="input-place-red" nz-input [(ngModel)]="question.text" placeholder=""
(blur)="save()"> (blur)="save()">
</div> </div>
<div class="option-img">
<div *ngIf="question.type=='img'">
<div class="word-input-title">
图片:
</div>
<div style="width: 300px;">
<app-upload-image-with-preview [picUrl]="question.image"
(imageUploaded)="onImageUploadSuccess($event, 'image', question)">
</app-upload-image-with-preview>
</div>
</div>
</div>
<div class="word-type-option-title" style="margin-top:20px;"> <div class="word-type-option-title" style="margin-top:20px;">
选项内容: 选项内容:
</div> </div>
...@@ -129,7 +155,7 @@ ...@@ -129,7 +155,7 @@
选项类型: 选项类型:
</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.type" (ngModelChange)="ngChange()">
<label nz-radio nzValue="img"> <label nz-radio nzValue="img">
<span [style]="{color:option.type=='img' ? '#169BD5':'#000'}">图片</span> <span [style]="{color:option.type=='img' ? '#169BD5':'#000'}">图片</span>
</label> </label>
......
...@@ -27,7 +27,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -27,7 +27,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
// tipSwitch: 1,//提示功能开关 // tipSwitch: 1,//提示功能开关
// startAudio: "", // startAudio: "",
// audioName: "", // audioName: "",
title: "sn04-分类", title: "分类",
time: 60, time: 60,
opleng: 0, opleng: 0,
word_count: '0', word_count: '0',
...@@ -102,20 +102,20 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -102,20 +102,20 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
addquestion() { addquestion() {
this.item.questions.push({ this.item.questions.push({
options: [], options: [],
type: "", type: "txt",
text: "", text: "",
questionAudio: "", questionAudio: "",
// wordAudio: "", // wordAudio: "",
// wordAudioName: "", // wordAudioName: "",
// audioName: "", // audioName: "",
// questImg: "", image: "",
contentMain: "", contentMain: "",
contentArr: [], contentArr: [],
}); });
this.updateOpleng(); this.updateOpleng();
this.save(); this.save();
} }
ngChange(i, j) { ngChange() {
this.updateOpleng(); this.updateOpleng();
this.save(); this.save();
} }
......
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