Commit 8f522f36 authored by Tt's avatar Tt

文本高亮完成

parent f80ce26d
No preview for this file type
......@@ -66,12 +66,14 @@ export class ComponentBase {
* 储存音频数据
* @param e
*/
onAudioUploadSuccess(e, key, it = this.item) {
onAudioUploadSuccess(e, key, it = this.item, audioName = null) {
let url = e.url;
let sp = url.split(".mp3");
let u = sp[0] + "_l.mp3";
it[key] = u;
it["audioName"] = e.name || "";
if(!audioName)audioName = key += "Name"
it.audioName = e.name || "";
console.log(e.name,audioName)
this.save();
}
......
This diff is collapsed.
......@@ -13,122 +13,24 @@ let replaceAll = function (str, s1, s2) {
})
export class FormComponent extends ComponentBase implements OnInit, OnChanges, OnDestroy {
// 储存数据用
saveKey = "wood_input";
// 1.猫动画可替换。
// 2.文本内容可替换。//字体随内容缩小。
// 3.语音替换。
// 4.背景可替换
// 5.3~10选项内容。
// 6.配置对应的坐标。
customTypeGroupArr = [
// {
// name: '发音动画',
// rect: true,
// animaSmall: true,
// audio: true,
// },
// {
// name: '发音图片',
// pic: true,
// audio: true,
// },
// {
// name: '发音区块',
// rect: true,
// audio: true,
// },
// {
// name: '变化文本',
// action: {
// type: 'text',
// option: [
// ['fontColor', '#000000'],
// ['fontSize', '100'],
// ['opacity', '0', '100']
// ]
// },
// },
// {
// name: '变化图片',
// action: {
// type: 'pic',
// option: [
// // ['scale', '1'],
// ['opacity', '0', '100']
// ]
// },
// },
// {
// name: '变化动画',
// action: {
// type: 'anima',
// option: [
// // ['scale', '1'],
// ['opacity', '0', '100']
// ]
// },
// },
{
name: '选项图片',
drag: true,
pic: true,
// audio: true,
},
// {
// name: '选项文本',
// drag: true,
// audio: true,
// action: {
// type: 'text',
// option: [
// ['fontColor', '#000000'],
// ['fontSize', '100'],
// ]
// },
// },
// {
// name: '拖拽结束区',
// rect: true,
// }
]
saveKey = "dg28_drag";
item = {
imgAni: {
ske: {},
tex: {},
png: {}
},
tipSwitch: 1,//提示功能开关
tipType: "page",
tipBg: '',
tipPage: [{ title: '', audio: '' }],
title: "",
audio: "",
audioName: "",
image: '',
jumpIdx: '',
endImgAni: {
ske: {},
tex: {},
png: {}
},
endImgTitle: "",
// 开始音频
auidoStart: "",
auidoStartName: "",
// 结束音频
auidoEnd: "",
auidoEndName: "",
// 肉饼引导音频
auidoMeet: "",
auidoMeetName: "",
// 蔬菜引导音频
auidoVegetable: "",
auidoVegetableName: "",
// 第一次完成音频
auidoFinish: "",
auidoFinishName: "",
points: "",
tips: '',
questionScore: 0,//分数
questions: [],
questionText: "",
......@@ -158,7 +60,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
console.log(new MetaFormCreator().create());
if (this.item.questions.length == 0) {
this.addquestion();
this.addQuestion();
}
}
......@@ -187,14 +89,6 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
}
removePage(idx) {
this.item.tipPage.splice(idx, 1);
this.save();
}
addPage() {
this.item.tipPage.push({ title: "", audio: "" })
this.save();
}
removequestion(idx) {
this.openDelete("确定删除题目?", () => {
......@@ -203,14 +97,15 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
})
}
addquestion() {
addQuestion() {
// 题目自带一堆东西不用添加选项部分
this.item.questions.push({
options: [],
type: "img"
title: "",//大标题
mainType: "",//题干类型
mainText: "",//题干文字
mainTextArr: [],//题干文字高亮
mainImage: "",//题干图片
});
while (this.item.questions[0].options.length < 3) {
this.addoption(0);
}
this.save();
}
ngChange(i, j) {
......@@ -229,10 +124,13 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
this.save();
}
changeMain() {
changeMain(i) {
let question = this.item.questions[i]
//输出的数据可以识别到\n的换行符
let arr = this.item.contentMain.split(" ");
let oldArr = this.item.contentArr.concat();
let contentMain = question.mainText;
let contentArr = question.mainTextArr || [];
let arr = contentMain.split(" ");
let oldArr = contentArr.concat();
let contetArr = arr.map(ar => {
let obj = {
text: replaceAll(`${ar}`, "\n", "<br/>"),
......@@ -249,7 +147,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
}
return obj;
})
this.item.contentArr = contetArr;
question.mainTextArr = contetArr;
console.log(contetArr)
this.save();
}
......
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