Commit d7929c87 authored by yu's avatar yu

1

parent 7fc6d2af
......@@ -85,6 +85,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(cc.Node)
btn_playall: cc.Node = null;
@property(cc.Node)
btn_replay: cc.Node = null;
@property(cc.Node)
label_title: cc.Node = null;
@property(cc.Node)
label_t2: cc.Node = null;
......@@ -164,6 +166,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
this.showLeft();
this.btn_playall.on(cc.Node.EventType.TOUCH_END, this.onPlayAll, this);
this.btn_replay.on(cc.Node.EventType.TOUCH_END, this.onReplay, this);
cc.find("label_len", this.btn_playall).getComponent(cc.Label).string = "(" + op.length + ")";
cc.find("scrollView", this.layout_game).on("scroll-began", () => {
this.playLocalAudio("gun");
......@@ -175,9 +178,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (this.isPlayAudio) return;
this.autoPlayAudio();
}
private onReplay() {
this.btn_replay.active = false;
this.itemIdx = 0;
this.autoPlayAudio();
}
private autoPlayAudio() {
let op = Game.getIns().getCurrentPage().optionList[this.itemIdx];
if (!op) return;
if (!op) {
this.btn_replay.active = true;
return;
}
pg.audio.playAudioByUrl(Game.getIns().getCurrentPage().optionList[this.itemIdx].audioUrl, (id) => {
this.itemAudioId = id;
this.updateTime();
......@@ -187,7 +198,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.autoPlayAudio();
}
});
this.showLeft();
// this.showLeft();
this.updateItems();
}
private itemAudioId;
......@@ -229,7 +240,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
});
this.itemIdx = idx;
this.showLeft();
// this.showLeft();
this.updateItems();
})
......@@ -253,10 +264,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
private showLeft() {
let data = Game.getIns().getCurrentPage().optionList[this.itemIdx];
this.label_title.getComponent(cc.Label).string = data.text;
this.label_t2.getComponent(cc.Label).string = data.desc;
pg.view.setNetImg(this.bg_img, data.picUrl, { w: 305, h: 382 })
let data = Game.getIns().getCurrentPage();
this.label_title.getComponent(cc.Label).string = data.desc;
this.label_t2.getComponent(cc.Label).string = data.text;
pg.view.setNetImg(this.bg_img, data.image, { w: 305, h: 382 })
}
private itemDuration = 0;
private updateTime() {
......
......@@ -48,7 +48,7 @@ export class Item {
public optionList;
public bgItem;
public hotZoneItemArr;
public pointsArr;
public desc;
public text: string;
public isClick: boolean;
public type;
......@@ -56,8 +56,7 @@ export class Item {
constructor(data, page) {
this.audio = data.audio;
this.text = data.text;
this.bgItem = data.bgItem;
this.hotZoneItemArr = data.hotZoneItemArr;
this.desc = data.desc;
this.page = page;
this.type = data.type || "txt";
this.image = data.image || "";
......
......@@ -2,82 +2,121 @@ export const defaultData = {
"questions": [{
"options": [{
"type": "txt",
"image": "http://staging-teach.cdn.ireadabc.com/95df6e27bfce8b01a4250e877ba6aa3e.png",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/83268f4def70e408cf9243bc214592b6_l.mp3",
"text": "startstart",
"text": "Theme sone - Track 1",
"desc": "",
"audioTitle": "",
"time": "",
"right": false,
"audioName": "bear_1.mp3",
"desc": "start"
"audioName": "bear_1.mp3"
}, {
"type": "txt",
"image": "http://staging-teach.cdn.ireadabc.com/274e8acd17edf25f9fc610f650ea37a2.png",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/944ae51b57fb9390dd03104d9651e5f4_l.mp3",
"text": "fast fast",
"text": "Theme sone - Track 2",
"desc": "",
"audioTitle": "",
"time": "",
"right": false,
"audioName": "bear_2.mp3",
"desc": "fast"
"audioName": "bear_2.mp3"
}, {
"type": "txt",
"image": "http://staging-teach.cdn.ireadabc.com/c0bb6a1eca5c75522010a4d26c519d33.png",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/36067f9e2415d59fa37c3795a3929087_l.mp3",
"text": "bbtime",
"text": "Theme sone - Track 3",
"desc": "",
"audioTitle": "",
"time": "",
"right": false,
"audioName": "bear_3.mp3",
"desc": "time"
"audioName": "bear_3.mp3"
}, {
"type": "txt",
"image": "http://staging-teach.cdn.ireadabc.com/557ae63f493c63f51ee745f9b491280d.png",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/449e65975d358514cc3494f9f67bc012_l.mp3",
"text": "seven seven",
"text": "Theme sone - Track 4",
"desc": "",
"audioTitle": "",
"time": "",
"right": false,
"audioName": "cape.mp3",
"desc": "seven"
"audioName": "cape.mp3"
}, {
"type": "txt",
"image": "http://staging-teach.cdn.ireadabc.com/6b0f46f023aca058732e6b8a9057d3f0.png",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3",
"text": "Theme sone - Track 5",
"desc": "",
"audioTitle": "",
"time": "",
"right": false,
"audioName": "dsdasdsdasdsdasdsdasdsdasdsdasdsdasdsdasdsdasdsdasdsdasdsdas.mp3"
}, {
"type": "txt",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/c3b69ad3d51385eac7d4195773ef59f7_l.mp3",
"text": "five five",
"text": "Theme sone - Track 6",
"desc": "",
"audioTitle": "",
"time": "",
"right": false,
"audioName": "极速滑雪 游戏说明.MP3",
"desc": "five"
"audioName": "极速滑雪 游戏说明.MP3"
}, {
"type": "txt",
"image": "http://staging-teach.cdn.ireadabc.com/64e428e093b15f403ade21b2d6116eb0.png",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/83268f4def70e408cf9243bc214592b6_l.mp3",
"text": "time time",
"text": "Theme sone - Track 7",
"desc": "",
"audioTitle": "",
"time": "",
"right": false,
"audioName": "bear_1.mp3",
"desc": "tt"
"audioName": "bear_1.mp3"
}, {
"type": "txt",
"image": "http://staging-teach.cdn.ireadabc.com/aa3966efdfbde6209523ba9781375191.png",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/944ae51b57fb9390dd03104d9651e5f4_l.mp3",
"text": "ame ame",
"text": "Theme sone - Track 8",
"desc": "",
"audioTitle": "",
"time": "",
"right": false,
"audioName": "bear_2.mp3",
"desc": "ame"
"audioName": "bear_2.mp3"
}, {
"type": "txt",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/36067f9e2415d59fa37c3795a3929087_l.mp3",
"text": "Theme sone - Track 9",
"desc": "",
"audioTitle": "",
"time": "",
"right": false,
"audioName": "bear_3.mp3"
}, {
"type": "txt",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/449e65975d358514cc3494f9f67bc012_l.mp3",
"text": "Theme sone - Track 10",
"desc": "",
"audioTitle": "",
"time": "",
"right": false,
"audioName": "cape.mp3"
}
],
"type": "txt",
"text": "",
"type": "img",
"text": "Starter 1",
"desc": "Magic Trip Review",
"questionAudio": "",
"image": "",
"image": "http://staging-teach.cdn.ireadabc.com/2acdedb9d07a738e0655b9a8aafd286a.jpg",
"contentMain": "",
"contentArr": []
}
],
"title": "音频播放",
"time": 60,
"opleng": 7,
"opleng": 10,
"word_count": "0",
"sentence_count": "0",
"zi_count": "0"
}
{
"ver": "2.3.5",
"uuid": "a461299f-bb6e-4313-a78f-e10cf2cad81d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 305,
"height": 382,
"platformSettings": {},
"subMetas": {
"rect_sn02_audio": {
"ver": "1.0.4",
"uuid": "53839116-c81a-4bae-aadc-7858f0b901a4",
"rawTextureUuid": "a461299f-bb6e-4313-a78f-e10cf2cad81d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 305,
"height": 382,
"rawWidth": 305,
"rawHeight": 382,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
......@@ -110,14 +110,6 @@
</nz-radio-group>
</div> -->
</div>
<!-- <div class=" option-text">
<div class="word-input-title">
<span style="color:red;margin-left:-15px">* </span>
<span>文本: </span>
</div>
<input type="text" class="input-place-red" nz-input [(ngModel)]="question.text" placeholder=""
(blur)="save()">
</div>
<div class="option-img">
<div>
<div class="word-input-title">
......@@ -129,15 +121,32 @@
</app-upload-image-with-preview>
</div>
</div>
</div> -->
</div>
<div class=" option-text">
<div class="word-input-title">
<!-- <span style="color:red;margin-left:-15px">* </span> -->
<span>封面标题: </span>
</div>
<input type="text" class="input-place-red" nz-input [(ngModel)]="question.text" placeholder=""
(blur)="save()">
</div>
<div class=" option-text">
<div class="word-input-title">
<!-- <span style="color:red;margin-left:-15px">* </span> -->
<span>封面副标题: </span>
</div>
<input type="text" class="input-place-red" nz-input [(ngModel)]="question.desc" placeholder=""
(blur)="save()">
</div>
<div class="word-type-option-title" style="margin-top:20px;">
选项内容:
音频内容:
</div>
<div *ngFor="let option of question.options; let j = index">
<div style="display: flex;margin-top:20px">
<div class="option-title">
选项{{j+1}}
音频{{j+1}}
</div>
<div class="option-content" style="padding: 15px 30px;">
<div class="word-input-title">
......@@ -185,10 +194,10 @@
</div>
</div>
</div>
<div class="option-img">
<!-- <div class="option-img">
<div>
<div class="word-input-title">
图片:
封面:
</div>
<div style="width: 300px;">
<app-upload-image-with-preview [picUrl]="option.image"
......@@ -199,17 +208,17 @@
</div>
<div *ngIf="option.type=='txt'" class="option-text">
<div class="word-input-title">
<span>标题: </span>
<span>封面标题: </span>
</div>
<input style="font-size: 22px;" class="input-place-red" type="text" nz-input
[(ngModel)]="option.text" (blur)="save()">
</div>
</div> -->
<div *ngIf="option.type=='txt'" class="option-text">
<div class="word-input-title">
<span>副标题: </span>
<span>音频名称: </span>
</div>
<input style="font-size: 22px;" class="input-place-red" type="text" nz-input
[(ngModel)]="option.desc" (blur)="save()">
[(ngModel)]="option.text" (blur)="save()">
</div>
<!-- <div class="option-time">
<div class="word-input-title">
......@@ -241,7 +250,7 @@
</div>
</div>
<div *ngIf="item.questions.length <4" style="margin-top: 20px;">
<div *ngIf="item.questions.length <1" style="margin-top: 20px;">
<button class="btn-blue" style="width: 1000px; height: 50px;" nz-button nzType="default" nzDanger
(click)="addquestion()">+增加题目</button>
</div>
......
......@@ -88,6 +88,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
audio: "",
text: "",
desc: "",
audioTitle: "",
time: "",
right: false
});
......@@ -106,8 +107,9 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
addquestion() {
this.item.questions.push({
options: [],
type: "txt",
type: "img",
text: "",
desc: "",
questionAudio: "",
// wordAudio: "",
// wordAudioName: "",
......
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