Commit d1e900d8 authored by Chen Jiping's avatar Chen Jiping

提交

parent 4b326c83
...@@ -128,5 +128,8 @@ ...@@ -128,5 +128,8 @@
} }
} }
}, },
"defaultProject": "ng-template-generator" "defaultProject": "ng-template-generator",
"cli": {
"analytics": "0be521b1-4907-457d-9a8c-d0f5b1a1ea35"
}
} }
\ No newline at end of file
This diff is collapsed.
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
"ali-oss": "^6.5.1", "ali-oss": "^6.5.1",
"compressing": "^1.5.0", "compressing": "^1.5.0",
"ng-zorro-antd": "^8.5.2", "ng-zorro-antd": "^8.5.2",
"node-sass": "^4.13.1",
"rxjs": "~6.5.4", "rxjs": "~6.5.4",
"spark-md5": "^3.0.0", "spark-md5": "^3.0.0",
"tslib": "^1.10.0", "tslib": "^1.10.0",
......
<div class="model-content"> <div class="model-content">
<div nz-row>
<div nz-col nzOffset='4'><h1 nz-title>课程内容编辑</h1></div>
<div style="position: absolute; left: 200px; top: 100px; width: 800px;"> </div>
<div nz-form>
<input type="text" nz-input [(ngModel)]="item.text" (blur)="save()"> <nz-form-item>
<nz-form-control [nzSpan]="6" nzOffset="3" class="add-btn-box">
<app-upload-image-with-preview <button nz-button nzType="dashed" class="add-btn" id="add-btn"
[picUrl]="item.pic_url" (click)="addPracticeItem()">
(imageUploaded)="onImageUploadSuccess($event, 'pic_url')" <i nz-icon nzType="plus-circle" nzTheme="outline"></i>添加
></app-upload-image-with-preview> </button>
</nz-form-control>
<app-audio-recorder </nz-form-item>
[audioUrl]="item.audio_url" <nz-form-item>
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')" <nz-form-control [nzSpan]="15" nzOffset="3">
></app-audio-recorder> <div *ngFor="let it of item.practices; let i = index" class="card-item" style="padding: 0.5vw;">
<app-custom-hot-zone></app-custom-hot-zone> <div class="border">
<app-upload-video></app-upload-video> <nz-divider nzText="练习-{{i+1}}" nzOrientation="left"></nz-divider>
<app-lesson-title-config></app-lesson-title-config> <div nz-form>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzFor="it.audio_url">发音</nz-form-label>
<nz-form-control [nzSpan]="6">
<app-audio-recorder id="it.audio_url"
[audioUrl]="it.audio_url"
(audioUploaded)="onAudioUploadSuccessByItem($event, it, 'audio_url')">
</app-audio-recorder>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzFor="it.answers">答案</nz-form-label>
<nz-form-control [nzSpan]="6">
<button nz-button nzType="dashed" class="add-btn" id="add-btn"
(click)="addAnswerItem(it.answers)">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>添加
</button>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<div nz-col [nzSpan]="22" nzOffset="1">
<nz-table #answersTable [nzHideOnSinglePage]="true" [nzBordered]="true" [nzNoResult]=''>
<thead>
<tr>
<th>序号</th>
<th>备选答案</th>
<th>是否正确</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of it.answers;let j = index">
<td>{{j+1}}</td>
<td><input type="text" nz-input placeholder="请录入备选答案" [(ngModel)]="data.val" (blur)="save()"></td>
<td>
<nz-select [(ngModel)]="data.correct" nzAllowClear nzPlaceHolder="请选择" (ngModelChange)="save()">
<nz-option nzValue="0" nzLabel="否"></nz-option>
<nz-option nzValue="1" nzLabel="是"></nz-option>
</nz-select>
</td>
<td>
<a (click)="delAnswerItem(it.answers, j)">delete</a>
</td>
</tr>
</tbody>
</nz-table>
</div>
</nz-form-item>
</div>
<button style="margin: 10px;" nz-button nzType="danger" (click)="delPracticeItem(i)">
<span>删除</span>
</button>
</div>
</div>
</nz-form-control>
</nz-form-item>
</div> </div>
<!-- div style="position: absolute; left: 1000px; top: 100px; width: 300px;">
<input type="text" nz-input [(ngModel)]="item.text_2" (blur)="save()">
<app-upload-image-with-preview
[picUrl]="item.pic_url_2"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url_2')"
></app-upload-image-with-preview>
<app-audio-recorder
[audioUrl]="item.audio_url_2"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url_2')"
></app-audio-recorder>
</div -->
</div> </div>
......
import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef} from '@angular/core'; import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef,ElementRef, HostListener} from '@angular/core';
import { NzTableModule } from 'ng-zorro-antd/table';
@Component({ @Component({
...@@ -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 = "DF-L220";
// 储存对象 // 储存对象
item; item;
...@@ -24,6 +24,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -24,6 +24,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.item = {}; this.item = {};
this.item.practices = [];
// 获取存储的数据 // 获取存储的数据
(<any> window).courseware.getData((data) => { (<any> window).courseware.getData((data) => {
...@@ -31,6 +33,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -31,6 +33,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.item = data; this.item = data;
} }
if(!this.item.practices){
this.item.practices = [];
}
console.log('item', this.item);
this.init(); this.init();
this.refresh(); this.refresh();
...@@ -91,5 +97,78 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -91,5 +97,78 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}, 1); }, 1);
} }
/**
* 添加练习
*/
addPracticeItem(){
let practice = this.getDefaultPracticeItem();
this.item.practices.push(practice);
this.save();
}
delPracticeItem(index){
if (index !== -1) {
this.item.practices.splice(index, 1);
this.save();
}
}
/**
* 获取缺省的练习题内容
*/
getDefaultPracticeItem(){
let practice = {
audio_url:"",
answers:[]
}
return practice;
}
/**
* 添加答案
*/
addAnswerItem(answers){
let answer = this.getDefaultAnswerItem();
answers.push(answer);
this.save();
}
/**
* 删除答案
* @param answers
* @param index
*/
delAnswerItem(answers, index){
if (index !== -1) {
answers.splice(index, 1);
this.save();
}
}
/**
* 获取缺省的答案
*/
getDefaultAnswerItem(){
let answer = {
val:"",
correct:'0'
}
return answer;
}
onAudioUploadSuccessByItem(e, item, key) {
console.log(item);
item[key] = e.url;
this.save();
}
} }
This diff is collapsed.
const res = [ const res = [
// ['bg', "assets/play/bg.jpg"], ['bg', "assets/play/bg.png"],
['btn_left', "assets/play/btn_left.png"], ['weapon', "assets/play/weapon.png"],
['btn_right', "assets/play/btn_right.png"], ['weapon_fire', "assets/play/weapon_fire.png"],
// ['text_bg', "assets/play/text_bg.png"], ['bullet', "assets/play/bullet.png"],
['star', "assets/play/star.png"],
['balloon_1', "assets/play/balloon_1.png"],
['balloon_2', "assets/play/balloon_2.png"],
['balloon_3', "assets/play/balloon_3.png"],
['balloon_4', "assets/play/balloon_4.png"],
['petal_1', "assets/play/petal_1.png"],
['petal_2', "assets/play/petal_2.png"],
['petal_3', "assets/play/petal_3.png"],
['petal_4', "assets/play/petal_4.png"],
['petal_5', "assets/play/petal_5.png"],
['petal_6', "assets/play/petal_6.png"],
['petal_7', "assets/play/petal_7.png"],
['petal_8', "assets/play/petal_8.png"],
['petal_9', "assets/play/petal_9.png"],
['play', "assets/play/play.png"],
['playing', "assets/play/playing.png"],
['start', "assets/play/start.png"]
]; ];
const resAudio = [ const resAudio = [
['click', "assets/play/music/click.mp3"], ['celebrate', "assets/play/music/celebrate.mp3"],
['fire', "assets/play/music/fire.mp3"],
['right', "assets/play/music/right.mp3"],
['start', "assets/play/music/start.mp3"],
['wrong', "assets/play/music/wrong.mp3"]
]; ];
export {res, resAudio}; export {res, resAudio};
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