Commit d7929c87 authored by yu's avatar yu

1

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