Commit 0a66d553 authored by limingzhe's avatar limingzhe

feat: 首次提交

parent 8a51c964
<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
[picUrl]="item.pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url')"
></app-upload-image-with-preview>
<nz-divider nzText="课程标题" nzOrientation="left"></nz-divider>
<nz-form-label nzFor="t_val1">标题1</nz-form-label>
<input style="width: 80%; margin-bottom: 0.5vw" type="text" nz-input placeholder="" [(ngModel)]="item.title.t_val1" (blur)="save()">
<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
[audioUrl]="item.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')"
></app-audio-recorder>
<app-custom-hot-zone></app-custom-hot-zone>
<app-upload-video></app-upload-video>
<app-lesson-title-config></app-lesson-title-config>
</div>
<div style="margin-top: 80px"></div>
<nz-divider nzText="单词" nzOrientation="left"></nz-divider>
<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">
<div style=" display: flex; align-items: center;">
<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>
\ No newline at end of file
......@@ -10,7 +10,7 @@ import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, Ap
export class FormComponent implements OnInit, OnChanges, OnDestroy {
// 储存数据用
saveKey = "test_0011";
saveKey = 'ym_3_29';
// 储存对象
item;
......@@ -30,6 +30,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
if (data) {
this.item = data;
}
console.log('data:', data);
this.init();
this.changeDetectorRef.markForCheck();
......@@ -50,7 +51,19 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
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 {
* 储存图片数据
* @param e
*/
onImageUploadSuccess(e, key) {
this.item[key] = e.url;
onImageUploadSuccess(e, key, item = null) {
if (item == null) {
item = this.item;
}
item[key] = e.url;
this.save();
}
......@@ -68,9 +83,64 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
* 储存音频数据
* @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 diff is collapsed.
......@@ -12,8 +12,27 @@
@font-face
{
font-family: 'BRLNSDB_1';
src: url("../../assets/font/BRLNSDB_1.TTF") ;
}@font-face
{
font-family: 'BRLNSDB';
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>
<canvas id="canvas" #canvas></canvas>
</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 = [
// ['bg', "assets/play/bg.jpg"],
['btn_left', "assets/play/btn_left.png"],
['btn_right', "assets/play/btn_right.png"],
// ['text_bg', "assets/play/text_bg.png"],
['dot', "assets/play/dot.png"],
['ballon_1', "assets/play/ballon/1.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 = [
const resAudio = [
['right', "assets/play/music/right.mp3"],
['wrong', "assets/play/music/wrong.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