Commit 987a5093 authored by limingzhe's avatar limingzhe

first

parent baec353a
This diff is collapsed.
{
"name": "ng-template-generator",
"version": "0.0.1",
"scripts": {
"start": "ng serve",
"scripts": {
"start": "ng serve",
"build": "ng build --build--optimizer --aot --base-href /JGT/v3/",
"publish": "node ./bin/publish.js"
"publish": "node ./bin/publish.js"
},
"private": true,
"dependencies": {
......@@ -43,7 +43,7 @@
"nedb": "^1.8.0",
"ng-lottie": "^0.3.1",
"ng-zorro-antd": "^7.2.0",
"npm": "^6.5.0",
"npm": "^6.13.4",
"rxjs": "^6.3.3",
"rxjs-compat": "^6.3.3",
"rxjs-tslint": "^0.1.6",
......@@ -52,7 +52,7 @@
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.11.4",
"@angular-devkit/build-angular": "^0.803.20",
"@angular/cli": "^7.2.10",
"@angular/compiler-cli": "^7.2.10",
"@angular/language-service": "^7.2.10",
......
......@@ -4,99 +4,17 @@
<div *ngFor="let it of picArr; let i = index"
nz-col nzSpan="8" >
<div class="item-box">
<app-upload-image-with-preview
style="width: 100%"
[picUrl]="it.pic_url"
(imageUploaded)="onImageUploadSuccessByItem($event, it)"
></app-upload-image-with-preview>
<div style="display: flex; justify-items: center; padding-top: 10px">
<app-audio-recorder
[audioUrl]="it.audio_url"
(audioUploaded)="onAudioUploadSuccessByItem($event, it)">
</app-audio-recorder>
<button style="margin-left: 10px;" nz-button nzType="danger" (click)="deleteItem(it)">
<i nz-icon type="close"></i>
</button>
<div style="padding: 3vw; display: flex; align-items: center">
<span style="padding-right: 1vw"> 人数: </span>
<nz-radio-group [(ngModel)]="item.contentObj.type" (ngModelChange)="log(item.contentObj.type)">
<div nz-row nzType="flex" nzJustify="space-around" nzAlign="middle">
<div *ngFor="let pic of picArr; let i = index" nz-col nzSpan="6">
<label nz-radio nzValue={{i}}> {{pic.text}} </label>
</div>
</div>
</div>
<!--<h5> id-{{i+1}} </h5>-->
<!--<div style="display: flex; align-items: center; justify-content: center; padding-bottom: 5px">-->
<!--<input type="text" nz-input placeholder="" [(ngModel)]="it.text" (blur)="saveItem()">-->
<!--<button style="margin-left: 10px;" nz-button nzType="danger" (click)="deleteItem(it)">-->
<!--<i nz-icon type="close"></i>-->
<!--</button>-->
<!--</div>-->
<!--<app-upload-image-with-preview-->
<!--style="width: 100%"-->
<!--[picUrl]="it.pic_url"-->
<!--(imageUploaded)="onImageUploadSuccessByItem($event, it)"-->
<!--&gt;</app-upload-image-with-preview>-->
<!--<div style="display: flex; align-items: center; justify-content: center">-->
<!--<span style="width: 80px;">-->
<!--question:-->
<!--</span>-->
<!--<app-audio-recorder-->
<!--[audioUrl]="it['q_audio_url']"-->
<!--(audioUploaded)="onAudioUploadSuccessByItem($event, it, 'q')">-->
<!--</app-audio-recorder>-->
<!--</div>-->
<!--<div style="display: flex; align-items: center; justify-content: center">-->
<!--<span style="width: 80px;">-->
<!--answer:-->
<!--</span>-->
<!--<app-audio-recorder-->
<!--[audioUrl]="it['a_audio_url']"-->
<!--(audioUploaded)="onAudioUploadSuccessByItem($event, it, 'a')">-->
<!--</app-audio-recorder>-->
<!--</div>-->
<!--<nz-radio-group [(ngModel)]="it.radioValue" >-->
<!--<label nz-radio nzValue="A" (click)="radioClick(it, 'A')"> <i nz-icon nzType="check" nzTheme="outline"></i> </label>-->
<!--<label nz-radio nzValue="B" (click)="radioClick(it, 'B')"> <i nz-icon nzType="close" nzTheme="outline"></i> </label>-->
<!--</nz-radio-group>-->
</div>
<div nz-col nzSpan="8" class="add-btn-box" >
<!--<div style="width: 100%; height: 100%;">-->
<button style=" margin: auto; width: 60%; height: 60%;" nz-button nzType="dashed" class="add-btn"
(click)="addPic()">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>
Add
</button>
<!--</div>-->
</nz-radio-group>
</div>
......
......@@ -12,7 +12,7 @@
.item-box{
width: 100%;
//margin: auto;
display: flex;
align-items: center;
......@@ -21,8 +21,8 @@
flex-direction: column;
padding: 10px;
padding-bottom: 5vw;
padding-top: 5vw;
padding-bottom: 2vw;
padding-top: 3vw;
}
......@@ -41,14 +41,21 @@
align-items: center;
justify-content: center;
//width: 180px;
height: 20vw;
height: 15vw;
//background: #FFDC00;
padding: 10px;
padding-top: 5vw;
padding-top: 1vw;
}
}
.border {
border-radius: 20px;
border-style: dashed;
}
import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef} from '@angular/core';
import {
Component,
EventEmitter,
Input,
OnDestroy,
OnChanges,
OnInit,
Output,
ApplicationRef,
ChangeDetectorRef
} from '@angular/core';
......@@ -10,15 +20,18 @@ import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, Ap
export class FormComponent implements OnInit, OnChanges, OnDestroy {
picArr = [];
optionArr = [];
_item: any;
KEY = 'hw_000';
KEY = 'dfzx_17';
answerType = 'A';
refreshTimeId;
refreshLabel = 0;
// @Input()
set item(item) {
......@@ -35,7 +48,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
constructor(private appRef: ApplicationRef) {
constructor(private appRef: ApplicationRef,
public changeDetectorRef: ChangeDetectorRef) {
}
......@@ -60,6 +76,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
console.log('~data:', data);
this.init();
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.refresh();
}, this.KEY);
......@@ -71,6 +91,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
ngOnDestroy() {
clearTimeout( this.refreshTimeId);
}
......@@ -81,17 +103,36 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
} else {
this.picArr = this.getDefaultPicArr();
this.item.contentObj.picArr = this.picArr;
this.item.contentObj.type = 0;
}
console.log('item:' , this.item);
// this.picArr = this.getDefaultPicArr();
// this.item.contentObj.picArr = this.picArr;
// console.log('this.item:;', this.picArr);
}
startRefresh() {
this.refreshTimeId = setTimeout(() => {
this.refreshLabel ++;
this.startRefresh();
this.refresh();
}, 1000);
}
getDefaultPicArr() {
const arr = [];
const arr = [
{
text: '一人',
type: '0'
},
{
text: '两人',
type: '1'
}
];
// for (let i = 0; i < 4; i ++) {
// const data = {};
// data['pic_url'] = '';
......@@ -126,10 +167,26 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
// this.update.emit(this.item);
this.refreshOptionsPicArr();
this.save();
}
deleteOption(data) {
const index = this.optionArr.indexOf(data);
if (index !== -1) {
this.optionArr.splice(index, 1);
}
this.save();
}
refreshOptionsPicArr() {
for (let i = 0; i < this.optionArr.length; i++) {
const option = this.optionArr[i];
option.picArr = this.getOptionPicArr();
}
}
......@@ -166,16 +223,55 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
addPic() {
this.picArr.push({
const data = {
text: '',
pic_url: '',
audio_url: '',
// text: '',
// radioValue: 'A'
});
};
this.picArr.push(data);
this.refreshOptionsPicArr();
this.saveItem();
}
addOption() {
const data = {
text: '',
pic_url: '',
audio_url: '',
type: '0'
};
data['picArr'] = this.getOptionPicArr();
this.optionArr.push(data);
this.saveItem();
}
getOptionPicArr() {
const arr = [];
for (let i = 0; i < this.picArr.length; i++) {
const data = {};
data['label'] = '类别-' + (i + 1);
data['value'] = i;
arr.push(data);
}
return arr;
}
radioClick(it, radioValue) {
it.radioValue = radioValue;
......@@ -189,10 +285,18 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
saveItem() {
console.log(' in saveItem');
// this.update.emit(this.item);
this.save();
}
log(a) {
console.log('a:', a);
this.save();
}
save() {
(<any> window).courseware.setData(this.item, null, this.KEY);
......
......@@ -1378,7 +1378,7 @@ export function getPosDistance(sx, sy, ex, ey) {
return len;
}
export function delayCall(callback, second) {
export function delayCall(item, callback, second) {
const tween = new TWEEN.Tween(this)
.delay(second * 1000)
.onComplete(() => {
......@@ -1543,3 +1543,54 @@ export function shake(item, time = 0.5, callback = null, rate = 1) {
// --------------- custom class --------------------
export function showBlingBling(starImg, rectArea, parent, mapScale = 1, num = 30, disTime = 0.1, showTime = 3) {
const timeId = setInterval(() => {
showBlingStar(starImg, num, rectArea, parent, mapScale);
}, disTime * 1000);
//
// const tmpObj = {};
// tmpObj['timeId'] = timeId;
setTimeout(() => {
clearInterval(timeId);
}, showTime * 1000);
}
function showBlingStar(starImg, num, rectArea, parent, mapScale) {
for (let i = 0; i < num; i++) {
const star = new MySprite();
star.init(starImg);
const px = rectArea.x + Math.random() * rectArea.width;
const py = rectArea.y + Math.random() * rectArea.height;
star.x = px;
star.y = py;
const randomS = (0.1 + Math.random() * 0.8) * mapScale;
star.setScaleXY(0);
parent.addChild(star);
scaleItem(star, randomS, 0.3, () => {
setTimeout(() => {
scaleItem(star, 0, 0.3, () => {
parent.removeChild(star);
});
}, 100 + Math.random() * 200);
});
}
}
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"],
['panel', "assets/play/panel.png"],
['color_1', "assets/play/color/1.png"],
['color_2', "assets/play/color/2.png"],
['color_3', "assets/play/color/3.png"],
['color_4', "assets/play/color/4.png"],
['color_5', "assets/play/color/5.png"],
['icon_1', "assets/play/icon/hat.png"],
['icon_2', "assets/play/icon/clothes.png"],
['icon_3', "assets/play/icon/pants.png"],
['icon_4', "assets/play/icon/shoes.png"],
['boy', "assets/play/boy.png"],
['girl', "assets/play/girl.png"],
['icon', "assets/play/icon/icon.png"],
['icon_boy', "assets/play/icon/boy.png"],
['icon_girl', "assets/play/icon/girl.png"],
['hat_1', "assets/play/hat/1.png"],
['hat_2', "assets/play/hat/2.png"],
['hat_3', "assets/play/hat/3.png"],
['hat_4', "assets/play/hat/4.png"],
['hat_5', "assets/play/hat/5.png"],
['clothes_1', "assets/play/clothes/1.png"],
['clothes_2', "assets/play/clothes/2.png"],
['clothes_3', "assets/play/clothes/3.png"],
['clothes_4', "assets/play/clothes/4.png"],
['clothes_5', "assets/play/clothes/5.png"],
['pants_1', "assets/play/pants/1.png"],
['pants_2', "assets/play/pants/2.png"],
['pants_3', "assets/play/pants/3.png"],
['pants_4', "assets/play/pants/4.png"],
['pants_5', "assets/play/pants/5.png"],
['shoes_1', "assets/play/shoes/1.png"],
['shoes_2', "assets/play/shoes/2.png"],
['shoes_3', "assets/play/shoes/3.png"],
['shoes_4', "assets/play/shoes/4.png"],
['shoes_5', "assets/play/shoes/5.png"],
['star', "assets/play/star.png"],
];
......@@ -13,7 +57,10 @@ const res = [
const resAudio = [
// ['click', "assets/play/music/click.mp3"],
['click', "assets/play/music/click.mp3"],
['click_2', "assets/play/music/click_2.mp3"],
['click_3', "assets/play/music/click_3.mp3"],
['star', "assets/play/music/star.mp3"],
......
src/assets/play/bg.jpg

25.8 KB | W: | H:

src/assets/play/bg.jpg

12.2 KB | W: | H:

src/assets/play/bg.jpg
src/assets/play/bg.jpg
src/assets/play/bg.jpg
src/assets/play/bg.jpg
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/default/pic.jpg

28.7 KB | W: | H:

src/assets/play/default/pic.jpg

28 KB | W: | H:

src/assets/play/default/pic.jpg
src/assets/play/default/pic.jpg
src/assets/play/default/pic.jpg
src/assets/play/default/pic.jpg
  • 2-up
  • Swipe
  • Onion skin
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