Commit 7233d4c1 authored by Tt's avatar Tt

修改form内容

parent cfdfe0b5
No preview for this file type
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { NgModule, ErrorHandler } from '@angular/core'; import { NgModule, ErrorHandler } from '@angular/core';
import {MyErrorHandler} from './MyError'; import { MyErrorHandler } from './MyError';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { NgZorroAntdModule, NZ_I18N, zh_CN } from 'ng-zorro-antd'; import { NgZorroAntdModule, NZ_I18N, zh_CN } from 'ng-zorro-antd';
...@@ -10,17 +10,17 @@ import { HttpClientModule } from '@angular/common/http'; ...@@ -10,17 +10,17 @@ import { HttpClientModule } from '@angular/common/http';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { registerLocaleData } from '@angular/common'; import { registerLocaleData } from '@angular/common';
import zh from '@angular/common/locales/zh'; import zh from '@angular/common/locales/zh';
import {FormComponent} from './form/form.component'; import { FormComponent } from './form/form.component';
import {PlayComponent} from './play/play.component'; import { PlayComponent } from './play/play.component';
import {LessonTitleConfigComponent} from './common/lesson-title-config/lesson-title-config.component'; import { LessonTitleConfigComponent } from './common/lesson-title-config/lesson-title-config.component';
import {BackgroundImagePipe} from './pipes/background-image.pipe'; import { BackgroundImagePipe } from './pipes/background-image.pipe';
import {UploadImageWithPreviewComponent} from './common/upload-image-with-preview/upload-image-with-preview.component'; import { UploadImageWithPreviewComponent } from './common/upload-image-with-preview/upload-image-with-preview.component';
import {PlayerContentWrapperComponent} from './common/player-content-wrapper/player-content-wrapper.component'; import { PlayerContentWrapperComponent } from './common/player-content-wrapper/player-content-wrapper.component';
import {CustomHotZoneComponent} from './common/custom-hot-zone/custom-hot-zone.component'; import { CustomHotZoneComponent } from './common/custom-hot-zone/custom-hot-zone.component';
import {UploadVideoComponent} from './common/upload-video/upload-video.component'; import { UploadVideoComponent } from './common/upload-video/upload-video.component';
import {TimePipe} from './pipes/time.pipe'; import { TimePipe } from './pipes/time.pipe';
import {ResourcePipe} from './pipes/resource.pipe'; import { ResourcePipe } from './pipes/resource.pipe';
import {AudioRecorderComponent} from './common/audio-recorder/audio-recorder.component'; import { AudioRecorderComponent } from './common/audio-recorder/audio-recorder.component';
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';
...@@ -54,15 +54,15 @@ registerLocaleData(zh); ...@@ -54,15 +54,15 @@ registerLocaleData(zh);
FontAwesomeModule FontAwesomeModule
], ],
providers: [ providers: [
{provide: ErrorHandler, useClass: MyErrorHandler}, { provide: ErrorHandler, useClass: MyErrorHandler },
{ provide: NZ_I18N, useValue: zh_CN } { provide: NZ_I18N, useValue: zh_CN }
], ],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { export class AppModule {
constructor(library: FaIconLibrary) { constructor(library: FaIconLibrary) {
let fs :any = fas; let fs: any = fas;
let fr :any = far; let fr: any = far;
library.addIconPacks(fs, fr); library.addIconPacks(fs, fr);
} }
} }
...@@ -42,13 +42,14 @@ export class ComponentBase { ...@@ -42,13 +42,14 @@ export class ComponentBase {
// let sp = e.url.split(".mp3"); // let sp = e.url.split(".mp3");
// let u = sp[0] + "_l.mp3"; // let u = sp[0] + "_l.mp3";
// item[key[i]] = u; // item[key[i]] = u;
// console.log("audioName: " + e.name);
// item["audioName"] = e.name || ""; // item["audioName"] = e.name || "";
// } else { // } else {
// item[key[i]] = e.url; // item[key[i]] = e.url;
// } // }
// this.save();
// return; // return;
// } // }
// this.save();
// item = item[key[i]]; // item = item[key[i]];
// } // }
// } // }
......
This diff is collapsed.
...@@ -2,9 +2,6 @@ import { Component, OnDestroy, OnChanges, OnInit, ApplicationRef, ChangeDetector ...@@ -2,9 +2,6 @@ import { Component, OnDestroy, OnChanges, OnInit, ApplicationRef, ChangeDetector
import { ComponentBase } from './ComponentBase'; import { ComponentBase } from './ComponentBase';
import { MetaFormCreator } from './mataFormCreator'; import { MetaFormCreator } from './mataFormCreator';
let replaceAll = function (str, s1, s2) {
return str.replace(new RegExp(s1, "gm"), s2);
}
@Component({ @Component({
selector: 'app-form', selector: 'app-form',
templateUrl: './form.component.html', templateUrl: './form.component.html',
...@@ -12,19 +9,21 @@ let replaceAll = function (str, s1, s2) { ...@@ -12,19 +9,21 @@ let replaceAll = function (str, s1, s2) {
}) })
export class FormComponent extends ComponentBase implements OnInit, OnChanges, OnDestroy { export class FormComponent extends ComponentBase implements OnInit, OnChanges, OnDestroy {
// 储存数据用 // 储存数据用
saveKey = "ngt06_ball"; saveKey = "hy01_danci";
item = { item = {
imgAni: { recordFlag: false,
ske: {}, title: "",
tex: {}, questionText: "",
png: {} questionTextAudio: "",
}, questions: [{
startAudio: "", questionAudio: "",
audioName: "", duration: 120,
title: "判断对错", options: []
}],
questions: [], bgAudio: "",
bgAudioName: "",
audioName: ""
}; };
isVisible = false; isVisible = false;
...@@ -42,6 +41,8 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -42,6 +41,8 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
this.deleteCallback && this.deleteCallback(); this.deleteCallback && this.deleteCallback();
this.handleCancel(); this.handleCancel();
} }
init(): void { init(): void {
console.log(new MetaFormCreator().create()); console.log(new MetaFormCreator().create());
} }
...@@ -52,7 +53,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -52,7 +53,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
this.save(); this.save();
}) })
} }
copyoption(i, j) { copyOption(i, j) {
let data = this.item.questions[i].options[j]; let data = this.item.questions[i].options[j];
this.item.questions[i].options.push(JSON.parse(JSON.stringify(data))); this.item.questions[i].options.push(JSON.parse(JSON.stringify(data)));
this.save(); this.save();
...@@ -60,69 +61,39 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -60,69 +61,39 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
addoption(i) { addoption(i) {
this.item.questions[i].options.push({ this.item.questions[i].options.push({
type: "txt", type: "",
image: "", image: "",
audio: "", audio: "",
text: "", text: "",
time: "", duration: '',
content: '',
right: false right: false
}); });
this.save(); this.save();
} }
removequestion(idx) { removequestion(i) {
this.openDelete("确定删除题目?", () => { this.openDelete("确定删除题目?", () => {
this.item.questions.splice(idx, 1); this.item.questions.splice(i, 1);
this.save(); this.save();
}) })
} }
addquestion() { addquestion() {
this.item.questions.push({ this.item.questions.push({
options: [], questionAudio: "",
type: "txt", duration: 120,
audioUrl: "", options: []
audioName: "",
text: "",
}); });
this.save(); this.save();
} }
ngChange(i, j) {
this.save();
}
changeMain(question) { deleteBgAudio() {
//输出的数据可以识别到\n的换行符 this.item.bgAudio = "";
let arr = question.contentMain.split(" "); this.item.bgAudioName = "";
let oldArr = question.contentArr.concat();
let contetArr = arr.map(ar => {
let obj = {
text: `${ar}`,//replaceAll(`${ar}`, "\n", "<br/>"),
block: false,
check: 1,
}
for (let i = 0; i < oldArr.length; i++) {
if (obj.text == oldArr[i].text) {
obj.block = oldArr[i].block;
obj.check = oldArr[i].check;
oldArr.splice(i, 1);
break;
}
}
return obj;
})
question.contentArr = contetArr;
console.log(contetArr)
this.save();
}
onBlock(item, vis) {
item.block = vis;
this.save(); this.save();
} }
ngChange(i, j) {
onDragonBoneSave(e, item) {
console.log(e);
this.save(); this.save();
} }
} }
\ No newline at end of file
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