Commit cb437e73 authored by liujiangnan's avatar liujiangnan

feat: 迁移完成

parent 8a51c964
...@@ -30,7 +30,10 @@ ...@@ -30,7 +30,10 @@
], ],
"styles": [ "styles": [
"./node_modules/ng-zorro-antd/ng-zorro-antd.min.css", "./node_modules/ng-zorro-antd/ng-zorro-antd.min.css",
"src/styles.css" "./node_modules/font-awesome/css/font-awesome.css",
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"./node_modules/animate.css/animate.min.css",
"src/styles.scss"
], ],
"scripts": [] "scripts": []
}, },
...@@ -128,5 +131,8 @@ ...@@ -128,5 +131,8 @@
} }
} }
}, },
"defaultProject": "ng-template-generator" "defaultProject": "ng-template-generator",
} "cli": {
"analytics": "4ac5015e-c397-4a11-92f8-d88d5163f352"
}
}
\ No newline at end of file
...@@ -24,6 +24,7 @@ import {AudioRecorderComponent} from './common/audio-recorder/audio-recorder.com ...@@ -24,6 +24,7 @@ import {AudioRecorderComponent} from './common/audio-recorder/audio-recorder.com
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome'; import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
import { fas } from '@fortawesome/free-solid-svg-icons'; import { fas } from '@fortawesome/free-solid-svg-icons';
import { far } from '@fortawesome/free-regular-svg-icons'; import { far } from '@fortawesome/free-regular-svg-icons';
import { BrLineBreakerPipe } from './pipes/br-line-breaker.pipe';
registerLocaleData(zh); registerLocaleData(zh);
...@@ -36,6 +37,7 @@ registerLocaleData(zh); ...@@ -36,6 +37,7 @@ registerLocaleData(zh);
AudioRecorderComponent, AudioRecorderComponent,
UploadImageWithPreviewComponent, UploadImageWithPreviewComponent,
BackgroundImagePipe, BackgroundImagePipe,
BrLineBreakerPipe,
ResourcePipe, ResourcePipe,
TimePipe, TimePipe,
UploadVideoComponent, UploadVideoComponent,
......
@import '../style/common_mixin.css';
.model-content {
width: 100%;
height: 100%;
}
<nz-form-item>
<div class="model-content"> <nz-form-label [nzSpan]="4">Vocabulary</nz-form-label>
<nz-form-control [nzSpan]="8">
<input type="text" nz-input placeholder="Please input Vocabulary" [(ngModel)]="item.contentObj.vocabulary" (blur)="updateVocabulary()">
<div style="position: absolute; left: 200px; top: 100px; width: 800px;"> </nz-form-control>
</nz-form-item>
<input type="text" nz-input [(ngModel)]="item.text" (blur)="save()"> <nz-form-item>
<nz-form-control [nzSpan]="8" [nzOffset]="4">
<app-upload-image-with-preview <app-audio-recorder
[picUrl]="item.pic_url" [audioUrl]="item.contentObj.vocabulary_audio"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url')" (audioUploaded)="onVocabularyAudioUploadSuccess($event)"
></app-upload-image-with-preview> ></app-audio-recorder>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4">Part of Speech</nz-form-label>
<nz-form-control [nzSpan]="8">
<input type="text" nz-input [(ngModel)]="item.contentObj.vocabularyType" (blur)="updatePartOfSpeech()" placeholder="Please Input Part of Speech">
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4">Definition</nz-form-label>
<nz-form-control [nzSpan]="8">
<textarea nz-input rows="2" placeholder="Please Input Definition" [(ngModel)]="item.contentObj.definition" (blur)="updateDefinition()"></textarea>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-control [nzSpan]="8" [nzOffset]="4">
<app-audio-recorder <app-audio-recorder
[audioUrl]="item.audio_url" [audioUrl]="item.contentObj.definition_audio"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')" (audioUploaded)="onDefinitionAudioUploadSuccess($event)"
></app-audio-recorder> ></app-audio-recorder>
<app-custom-hot-zone></app-custom-hot-zone> </nz-form-control>
<app-upload-video></app-upload-video> </nz-form-item>
<app-lesson-title-config></app-lesson-title-config> <nz-form-item>
</div> <nz-form-label [nzSpan]="4">Definition Picture</nz-form-label>
<nz-form-control [nzSpan]="8">
<app-upload-image-with-preview
</div> [picUrl]="item.contentObj.pic_id"
(imageUploaded)="onImageUploadSuccess($event)"
\ No newline at end of file ></app-upload-image-with-preview>
</nz-form-control>
</nz-form-item>
import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef, ChangeDetectorRef} from '@angular/core'; import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef, ChangeDetectorRef} from '@angular/core';
import _ from 'lodash';
@Component({ @Component({
selector: 'app-form', selector: 'app-form',
templateUrl: './form.component.html', templateUrl: './form.component.html',
styleUrls: ['./form.component.css'] styleUrls: ['./form.component.scss']
}) })
export class FormComponent implements OnInit, OnChanges, OnDestroy { export class FormComponent implements OnInit, OnChanges, OnDestroy {
// 储存数据用 // 储存数据用
saveKey = "test_0011"; saveKey = 'ww_vocabulary';
// 储存对象 // 储存对象
item; item;
originContent;
constructor(private appRef: ApplicationRef,private changeDetectorRef: ChangeDetectorRef) { constructor(private appRef: ApplicationRef,
private changeDetectorRef: ChangeDetectorRef) {
} }
ngOnInit() { ngOnInit() {
this.item = {}; this.item = {
contentObj: {
vocabulary: "",
vocabularyType: "",
definition: "",
definition_audio: "",
pic_id: "",
vocabulary_audio: ""
}
};
// 获取存储的数据 // 获取存储的数据
(<any> window).courseware.getData((data) => { (window as any).courseware.getData((data) => {
if (data) { if (data) {
this.item = data; this.item = data;
} }
this.init();
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();
this.refresh(); this.refresh();
...@@ -41,41 +49,58 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -41,41 +49,58 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
} }
ngOnChanges() { ngOnChanges() {
} }
ngOnDestroy() { ngOnDestroy() {
} }
onImageUploadSuccess(e) {
this.item.contentObj.pic_id = e.url;
init() { this.save();
} }
updateVocabulary() {
/** const temp = this.item.contentObj.vocabulary ? this.item.contentObj.vocabulary.trim() : '';
* 储存图片数据 if (temp) {
* @param e this.item.contentObj.vocabulary = this.item.contentObj.vocabulary.trim();
*/ }
onImageUploadSuccess(e, key) { if (temp !== this.originContent.vocabulary) {
this.originContent.vocabulary = temp;
this.item[key] = e.url;
this.save(); this.save();
}
}
updatePartOfSpeech() {
const temp = this.item.contentObj.vocabularyType ? this.item.contentObj.vocabularyType.trim() : '';
if (temp) {
this.item.contentObj.vocabularyType = this.item.contentObj.vocabularyType.trim();
}
if (temp !== this.originContent.vocabularyType) {
this.originContent.vocabularyType = temp;
this.save();
}
}
updateDefinition() {
const temp = this.item.contentObj.definition ? this.item.contentObj.definition.trim() : '';
if (temp) {
this.item.contentObj.definition = this.item.contentObj.definition.trim();
}
if (temp !== this.originContent.definition) {
this.originContent.definition = temp;
this.save();
}
} }
/** onVocabularyAudioUploadSuccess(e) {
* 储存音频数据 this.item.contentObj.vocabulary_audio = e.url;
* @param e this.save();
*/ }
onAudioUploadSuccess(e, key) { onDefinitionAudioUploadSuccess(e) {
this.item.contentObj.definition_audio = e.url;
this.item[key] = e.url;
this.save(); this.save();
} }
/** /**
* 储存数据 * 储存数据
*/ */
......
import {Pipe, PipeTransform} from '@angular/core'; import {Pipe, PipeTransform} from '@angular/core';
// import {ElectronUtil} from '../util/ElectronUtil';
declare const APP_PATH;
// const isInElectron = localStorage.getItem('electron');
@Pipe({ @Pipe({
name: 'backgroundImage' name: 'backgroundImage'
}) })
export class BackgroundImagePipe implements PipeTransform { export class BackgroundImagePipe implements PipeTransform {
transform(value: any, coursewareSid?: string) { transform(value: any) {
// const ret = value ? `url(${value})` : ''; return `url(${value})`;
const ret = value ? `url(${value})` : '';
return ret;
// let ret = value > 0 ? `url(/api/media-resource/${value}/file)` : '';
// if (isInElectron && ElectronUtil.hasCached(coursewareSid, value)) {
// ret = `url(file://${APP_PATH}/courseware_cache/${coursewareSid}/${value})`;
// }
// return ret;
} }
} }
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'brLineBreaker'
})
export class BrLineBreakerPipe implements PipeTransform {
transform(value: any, args?: any): any {
return value ? value.replace(/\n/g, '<br />') : '';
}
}
...@@ -2,25 +2,17 @@ import {Pipe, PipeTransform} from '@angular/core'; ...@@ -2,25 +2,17 @@ import {Pipe, PipeTransform} from '@angular/core';
// import {ElectronUtil} from '../util/ElectronUtil'; // import {ElectronUtil} from '../util/ElectronUtil';
declare const APP_PATH; declare const APP_PATH;
// const isInElectron = localStorage.getItem('electron'); const isInElectron = localStorage.getItem('electron');
@Pipe({ @Pipe({
name: 'resource' name: 'resource'
}) })
export class ResourcePipe implements PipeTransform { export class ResourcePipe implements PipeTransform {
transform(pic_url: any, coursewareSid?: string): string { transform(value: any, coursewareSid?: string): string {
// return pic_url; return value ? `/api/media-resource/${value}/file` : '';
if (pic_url && typeof pic_url === 'object') { // if (isInElectron && ElectronUtil.hasCached(coursewareSid, value)) {
return pic_url; // ret = `file://${APP_PATH}/courseware_cache/${coursewareSid}/${value}`;
}
// console.log('resource', pic_url)
return `${pic_url}?t=${Math.random()}`;
// let ret = value ? `/api/resource/${value}/file` : '';
// let ret = res_id ? `/resource/audio/${res_id}` : '';
// if (isInElectron && ElectronUtil.hasCached(coursewareSid, res_id)) {
// ret = `file://${APP_PATH}/courseware_cache/${coursewareSid}/${res_id}`;
// } // }
// return ret; // return ret;
} }
......
.game-container {
width: 100%;
height: 100%;
background: #ffffff;
background-size: cover;
}
#canvas {
}
@font-face
{
font-family: 'BRLNSDB';
src: url("../../assets/font/BRLNSDB.TTF") ;
}
<div class="game-container" #wrap> <div class="vocabulary-container">
<canvas id="canvas" #canvas></canvas> <div class="content-wrap">
<div class="top-line">
<img class="star" src="../../assets/vocabulary/star.png" alt="" size="20">
<h1 class="vocabulary" [ngClass]="{'animated bounce infinite': vocabularyPlaying}"
(click)="playVocabularyAudio()">
<span class="star"></span>{{data.contentObj.vocabulary}}
</h1>
<h2 class="type">
{{data.contentObj.vocabularyType}}
</h2>
<div class="audio-button" [ngClass]="{'animated zoomIn slow infinite': definitionPlaying}"
(click)="playDefinitionAudio()"></div>
<div class="show-text" (click)="showSentence()"></div>
</div>
<div class="sentence" [style.visibility]="show">
{{data.contentObj.definition}}
</div>
<div class="img-wrap">
<img [src]="data.contentObj.pic_id" alt="" (dragstart)="false;$event.preventDefault();"/>
</div>
</div>
</div> </div>
.vocabulary-container {
text-align: left;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: #fff;
font-family: 'ChalkboardSE-Regular';
.content-wrap {
display: flex;
flex-direction: column;
width: 90%;
height: 90%;
padding: 1rem 10vh;
.top-line {
display: flex;
align-items: center;
.star {
width: 1.5rem;
height: 1.5rem;
margin-right: 0.6rem;
object-fit: contain;
}
.vocabulary {
display: inline-block;
}
.audio-button {
display: inline-block;
width: 2.5rem;
height: 2.5rem;
margin: 0 0.5rem;
background-image: url("../../assets/vocabulary/1.png");
background-repeat: no-repeat;
background-size: contain;
}
.show-text {
display: inline-block;
width: 2.5rem;
height: 2.5rem;
margin: 0 0.5rem;
background-image: url("../../assets/vocabulary/2.png");
background-repeat: no-repeat;
background-size: contain;
}
.type {
display: inline-block;
font-weight: 300;
margin: 0 0 0 2rem;
color: #444;
}
}
.sentence {
color: #000;// #FF960B;
font-size: 24px;
min-height: 4rem;
max-height: 7rem;
margin: 1rem 0;
overflow-y: auto;
}
.img-wrap {
width: 60%;
height: 60%;
border: .8vh solid rgb(255, 150, 11);
border-radius: 2.4vh;
img {
width: 100%;
height: 100%;
object-fit: contain;
}
}
}
}
This diff is collapsed.
@mixin hide-overflow-text {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
@mixin k-no-select {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
@mixin k-img-bg {
background-repeat: no-repeat;
background-position: center;
background-size: contain;
}
@mixin hide-overflow-text {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
@mixin k-no-select {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
@mixin k-img-bg {
background-repeat: no-repeat;
background-position: center;
background-size: contain;
}
...@@ -3,6 +3,8 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; ...@@ -3,6 +3,8 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module'; import { AppModule } from './app/app.module';
import { environment } from './environments/environment'; import { environment } from './environments/environment';
import '../node_modules/bootstrap/dist/css/bootstrap.min.css';
if (environment.production) { if (environment.production) {
enableProdMode(); enableProdMode();
......
/* You can add global styles to this file, and also import other style files */
/* You can add global styles to this file, and also import other style files */
@mixin hide-overflow-text {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
@mixin k-no-select {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
@mixin k-img-bg {
background-repeat: no-repeat;
background-position: center;
background-size: contain;
}
This diff is collapsed.
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