Commit 78ffe85c authored by Tt's avatar Tt

数据上传

parent 7f1f8c8e
......@@ -119,11 +119,32 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.startQuestion();
}
sendData(score) {
return new Promise(res => {
let upData: any = {
word_count: this.data.word_count,
sentence_count: this.data.sentence_count,
zi_count: this.data.zi_count,
score: score,
};
let recordList = pg.hw.getRecord();
if (recordList && recordList.length > 0) {
upData.recordList = recordList
}
const middleLayer = cc.find('middleLayer').getComponent('middleLayer');
console.log('upload->' + JSON.stringify(upData))
middleLayer.onHomeworkFinish(upData, () => {
res('');
})
})
}
private score: number;
gameOver() {
this.state = State.Over;
this.showAni().then((coin: number) => {
this.score = coin;
this.sendData(this.score).then(() => {
})
pg.event.once('layer_coin_show_coin_end', () => {
this.onClose();
}) // 动画回调
......
......@@ -668,6 +668,14 @@ let pg = {
}
},
hw: {
records: [],
addRecord(data) {
pg.hw.records.push(data)
},
getRecord() {
return pg.hw.records.concat();
},
playLocalAudio(audioName, loop = false) {
console.log("play audio->" + audioName);
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
......
......@@ -90,6 +90,14 @@
<span>{{ item.npcAudioName}}</span>
</div>
</div>
<span style="font-size: 20px;">掌握单词数: </span>
<input type="text" nz-input [(ngModel)]="item.word_count" (blur)="save()">
<span style="font-size: 20px;">掌握短语数: </span>
<input type="text" nz-input [(ngModel)]="item.sentence_count" (blur)="save()">
<span style="font-size: 20px;">掌握字数: </span>
<input type="text" nz-input [(ngModel)]="item.zi_count" (blur)="save()">
</div>
<!-- <div class="border-dashed" style="margin: 20px;width: 1000px;">
<span style="font-size: 20px;">标题: </span>
......@@ -150,6 +158,7 @@
<div *ngFor="let question of item.questions; let i = index">
<div style="display: flex;margin-top: 20px;">
<div class="border-solid" style="min-width: 1000px;">
<div class="word-type-title">
题目:
</div>
......
......@@ -26,6 +26,9 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
}],
bgAudio: "",
bgAudioName: "",
word_count: '0',
sentence_count: '0',
zi_count: '0',
audioName: ""
};
......@@ -50,6 +53,9 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
if (!this.item.npcTitle) this.item.npcTitle = '';
if (!this.item.npcAudio) this.item.npcAudio = '';
if (!this.item.npcAudioName) this.item.npcAudioName = '';
if (!this.item.word_count) this.item.word_count = '0';
if (!this.item.sentence_count) this.item.sentence_count = '0';
if (!this.item.zi_count) this.item.zi_count = '0';
}
removeoption(i, j) {
......
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