Commit 0a66d553 authored by limingzhe's avatar limingzhe

feat: 首次提交

parent 8a51c964
<div class="model-content"> <div class="model-content">
<div style="padding: 20px">
<div style="position: absolute; left: 200px; top: 100px; width: 800px;">
<input type="text" nz-input [(ngModel)]="item.text" (blur)="save()"> <div style="width: 700px">
<app-upload-image-with-preview <nz-divider nzText="课程标题" nzOrientation="left"></nz-divider>
[picUrl]="item.pic_url" <nz-form-label nzFor="t_val1">标题1</nz-form-label>
(imageUploaded)="onImageUploadSuccess($event, 'pic_url')" <input style="width: 80%; margin-bottom: 0.5vw" type="text" nz-input placeholder="" [(ngModel)]="item.title.t_val1" (blur)="save()">
></app-upload-image-with-preview> <br><nz-form-label nzFor="t_val2">标题2</nz-form-label>
<input style="width: 80%; margin-bottom: 0.5vw" type="text" nz-input placeholder="" [(ngModel)]="item.title.t_val2" (blur)="save()">
<nz-form-control [nzSpan]="6">
<app-audio-recorder id="item.title.audio_url" [audioUrl]="item.title.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url', item.title)">
</app-audio-recorder>
</nz-form-control>
<app-audio-recorder <div style="margin-top: 80px"></div>
[audioUrl]="item.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')" <nz-divider nzText="单词" nzOrientation="left"></nz-divider>
></app-audio-recorder>
<app-custom-hot-zone></app-custom-hot-zone> <div *ngFor="let it of item.picArr; let i = index" style="padding: 10px; border: 1px solid #ccc; border-radius: 10px; width: 270px; margin-bottom: 20px">
<app-upload-video></app-upload-video>
<app-lesson-title-config></app-lesson-title-config> <div style=" display: flex; align-items: center;">
</div> <div style="width: 200px; margin-right: 10px; display: flex; justify-content: center; flex-direction: column">
<h4>单词-{{i+1}}: </h4>
<input type="text" nz-input [(ngModel)]="it.text" (blur)="save()">
<app-audio-recorder
style="margin-top: 5px"
[audioUrl]="it.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url', it)"
></app-audio-recorder>
<button style="width: 150px; margin-top: 5px" nz-button nzType="danger" (click)="deletePic(i)">
删除
</button>
</div>
</div>
</div>
<div *ngIf="item.picArr.length < 10">
<button style="width: 180px; height: 70px;" nz-button nzType="dashed" (click)="addPic()">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>
添加单词
</button>
</div>
<div style="margin-top: 80px"></div>
<nz-divider nzText="格子" nzOrientation="left"></nz-divider>
<div style="margin-top: 10px; display: flex">
<div *ngFor="let oneRow of item.grid; let x = index" >
<div *ngFor="let oneGrid of oneRow; let y = index" style="padding: 2px;">
<input style="width: 38px" [maxLength]="1" type="text" nz-input [(ngModel)]="oneGrid.text" (blur)="save()" >
</div>
</div>
</div>
</div>
</div> </div>
\ No newline at end of file
...@@ -10,7 +10,7 @@ import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, Ap ...@@ -10,7 +10,7 @@ import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, Ap
export class FormComponent implements OnInit, OnChanges, OnDestroy { export class FormComponent implements OnInit, OnChanges, OnDestroy {
// 储存数据用 // 储存数据用
saveKey = "test_0011"; saveKey = 'ym_3_29';
// 储存对象 // 储存对象
item; item;
...@@ -30,6 +30,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -30,6 +30,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
if (data) { if (data) {
this.item = data; this.item = data;
} }
console.log('data:', data);
this.init(); this.init();
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
...@@ -50,7 +51,19 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -50,7 +51,19 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
init() { init() {
if (!this.item.logicX) {
this.item.logicX = 13;
}
if (!this.item.logicY) {
this.item.logicY = 9;
}
if (!this.item.picArr) {
this.item.picArr = [];
}
if (!this.item.title) {
this.item.title = {};
}
this.gridSizeSave();
} }
...@@ -58,9 +71,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -58,9 +71,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
* 储存图片数据 * 储存图片数据
* @param e * @param e
*/ */
onImageUploadSuccess(e, key) { onImageUploadSuccess(e, key, item = null) {
if (item == null) {
this.item[key] = e.url; item = this.item;
}
item[key] = e.url;
this.save(); this.save();
} }
...@@ -68,9 +83,64 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -68,9 +83,64 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
* 储存音频数据 * 储存音频数据
* @param e * @param e
*/ */
onAudioUploadSuccess(e, key) { onAudioUploadSuccess(e, key, item = null) {
console.log(' key, item:', item);
if (item == null) {
item = this.item;
}
item[key] = e.url;
this.save();
}
addPic() {
console.log(' in add Pic');
if (!this.item.picArr) {
this.item.picArr = [];
}
this.item.picArr.push(
{
text: '',
audio_url: '',
pic_url: ''
}
)
this.save();
}
deletePic(index) {
this.item.picArr.splice(index, 1);
this.save();
}
gridSizeSave() {
console.log(' in gridSizeSave')
if (!this.item.grid) {
this.item.grid = [];
}
const w = Number(this.item.logicX);
const h = Number(this.item.logicY);
this.item.grid.length = w;
for (let i = 0; i < w; i ++) {
if (!this.item.grid[i]) {
this.item.grid[i] = [];
}
this.item.grid[i].length = h;
for (let j = 0; j < h; j++) {
if (!this.item.grid[i][j]) {
this.item.grid[i][j] = {};
}
}
}
this.item[key] = e.url;
this.save(); this.save();
} }
......
This diff is collapsed.
...@@ -12,8 +12,27 @@ ...@@ -12,8 +12,27 @@
@font-face @font-face
{
font-family: 'BRLNSDB_1';
src: url("../../assets/font/BRLNSDB_1.TTF") ;
}@font-face
{ {
font-family: 'BRLNSDB'; font-family: 'BRLNSDB';
src: url("../../assets/font/BRLNSDB.TTF") ; src: url("../../assets/font/BRLNSDB.TTF") ;
} }
@font-face
{
font-family: 'FUTURAB';
src: url("../../assets/font/FUTURAB.TTF") ;
}
@font-face
{
font-family: 'GOTHICB_1';
src: url("../../assets/font/GOTHICB_1.TTF") ;
}
@font-face
{
font-family: 'FZLSJW';
src: url("../../assets/font/FZLSJW.TTF") ;
}
<div class="game-container" #wrap> <div class="game-container" #wrap>
<canvas id="canvas" #canvas></canvas> <canvas id="canvas" #canvas></canvas>
</div> </div>
<label style="font-family: 'BRLNSDB_1'; opacity: 0; position: absolute; top: 0px">1</label>
<label style="font-family: 'BRLNSDB'; opacity: 0; position: absolute; top: 0px">1</label>
<label style="font-family: 'FUTURAB'; opacity: 0; position: absolute; top: 0px">1</label>
<label style="font-family: 'GOTHICB_1'; opacity: 0; position: absolute; top: 0px">1</label>
<label style="font-family: 'FZLSJW'; opacity: 0; position: absolute; top: 0px">1</label>
This diff is collapsed.
const res = [ const res = [
// ['bg', "assets/play/bg.jpg"], ['dot', "assets/play/dot.png"],
['btn_left', "assets/play/btn_left.png"],
['btn_right', "assets/play/btn_right.png"], ['ballon_1', "assets/play/ballon/1.png"],
// ['text_bg', "assets/play/text_bg.png"], ['ballon_2', "assets/play/ballon/2.png"],
['ballon_3', "assets/play/ballon/3.png"],
['ballon_4', "assets/play/ballon/4.png"],
['ballon_5', "assets/play/ballon/5.png"],
['ballon_6', "assets/play/ballon/6.png"],
]; ];
...@@ -11,7 +15,12 @@ const res = [ ...@@ -11,7 +15,12 @@ const res = [
const resAudio = [ const resAudio = [
['right', "assets/play/music/right.mp3"],
['wrong', "assets/play/music/wrong.mp3"],
['click', "assets/play/music/click.mp3"], ['click', "assets/play/music/click.mp3"],
['pop', "assets/play/music/pop.mp3"],
['finish', "assets/play/music/finish.mp3"],
['apple', "assets/play/music/apple.mp3"],
]; ];
......
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