Commit e10438c1 authored by wangxin's avatar wangxin

publish

parent fa703d42
<div class="model-content"> <div class="model-content">
<input nz-input [(ngModel)]="item.text" (blur)="save()" />
<div style="padding: 10px;">
<div style="width: 300px;" align='center'>
<span>图1: </span>
<app-upload-image-with-preview
[picUrl]="item.pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url')">
</app-upload-image-with-preview>
</div>
<div style="width: 300px; margin-top: 5px;" align='center'>
<span>图2: </span>
<app-upload-image-with-preview
[picUrl]="item.pic_url_2"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url_2')">
</app-upload-image-with-preview>
</div>
<div style="width: 300px; margin-top: 15px;">
<span>文本: </span>
<input type="text" nz-input [(ngModel)]="item.text" (blur)="save()">
</div>
<div style="margin-top: 5px">
<span>音频: </span>
<app-audio-recorder
[audioUrl]="item.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')"
></app-audio-recorder>
</div>
</div>
</div> </div>
import { Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef, ChangeDetectorRef } from '@angular/core'; import {
import { JsonPipe } from '@angular/common'; Component,
EventEmitter,
Input,
OnDestroy,
OnChanges,
OnInit,
Output,
ApplicationRef,
ChangeDetectorRef,
} from "@angular/core";
import { JsonPipe } from "@angular/common";
@Component({ @Component({
selector: 'app-form', selector: "app-form",
templateUrl: './form.component.html', templateUrl: "./form.component.html",
styleUrls: ['./form.component.css'] styleUrls: ["./form.component.css"],
}) })
export class FormComponent implements OnInit, OnChanges, OnDestroy { export class FormComponent implements OnInit, OnChanges, OnDestroy {
// 储存数据用 // 储存数据用
saveKey = "test_001"; saveKey = "test_001";
// 储存对象 // 储存对象
item; item;
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) { constructor(
private appRef: ApplicationRef,
} private changeDetectorRef: ChangeDetectorRef
) {}
createShell() { createShell() {
this.item.wordList.push({ this.item.wordList.push({
word: '', word: "",
audio: '', audio: "",
backWord: '', backWord: "",
backWordAudio: '', backWordAudio: "",
}); });
this.save(); this.save();
} }
...@@ -34,12 +43,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -34,12 +43,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
} }
ngOnInit() { ngOnInit() {
this.item = {}; this.item = {};
// 获取存储的数据 // 获取存储的数据
(<any>window).courseware.getData((data) => { (<any>window).courseware.getData((data) => {
if (data) { if (data) {
this.item = data; this.item = data;
} }
...@@ -48,27 +55,20 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -48,27 +55,20 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();
this.refresh(); this.refresh();
}, this.saveKey); }, this.saveKey);
} }
ngOnChanges() { ngOnChanges() {}
}
ngOnDestroy() {
}
init() { ngOnDestroy() {}
}
init() {}
/** /**
* 储存图片数据 * 储存图片数据
* @param e * @param e
*/ */
onImageUploadSuccess(e, key) { onImageUploadSuccess(e, key) {
this.item[key] = e.url; this.item[key] = e.url;
this.save(); this.save();
} }
...@@ -99,7 +99,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -99,7 +99,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
(<any>window).courseware.setData(this.item, null, this.saveKey); (<any>window).courseware.setData(this.item, null, this.saveKey);
this.refresh(); this.refresh();
console.log('this.item = ' + JSON.stringify(this.item)); console.log("this.item = " + JSON.stringify(this.item));
} }
/** /**
...@@ -110,5 +110,4 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -110,5 +110,4 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.appRef.tick(); this.appRef.tick();
}, 1); }, 1);
} }
}
}
\ No newline at end of file
This diff is collapsed.
{ {
"name": "publish", "name": "publish",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "build.js", "main": "build.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "sh ./publish/build.sh", "build": "sh ./publish/build.sh",
"win": "cd publish && build.cmd" "win": "cd publish && build.cmd"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"compressing": "^1.5.0" "compressing": "^1.5.0",
} "node-sass": "^4.0.0"
}
} }
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