Commit d32b5e7c authored by Tt's avatar Tt

数据完成

parent 8f522f36
export const defaultData = {
"pic_url": "http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png",
"pic_url_2": "http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png",
"text": "This is a test label.",
"audio_url": "http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"
export const defaultData =
{
"questions": [
{
"options":
[{ "type": "img", "image": "", "audio": "", "text": "", "time": "", "right": false }, { "type": "img", "image": "", "audio": "", "text": "", "time": "", "right": false }, { "type": "img", "image": "", "audio": "", "text": "", "time": "", "right": false }], "type": "img", "mainType": "empty", "mainText": "this is info", "mainTextArr": [{ "text": "this", "block": true, "check": 1 }, { "text": "is", "block": false, "check": 1 }, { "text": "info", "block": false, "check": 1 }], "meetType": "img", "meetText": "test info", "meetTextArr": [{ "text": "test", "block": true, "check": 1 }, { "text": "info", "block": false, "check": 1 }], "vegetableType": "text", "pieType": "img_text", "pieText": "Countries have their own flag.", "pieTextArr": [{ "text": "Countries", "block": false, "check": 1 }, { "text": "have", "block": true, "check": 1 }, { "text": "their", "block": true, "check": 1 }, { "text": "own", "block": true, "check": 1 }, { "text": "flag.", "block": false, "check": 1 }], "title": "Countries", "meetImage": "http://staging-teach.cdn.ireadabc.com/b4494456199505bdf990fff96a0c9fb8.jpg", "vegetableText": "have one's own flag", "vegetableTextArr": [{ "text": "have", "block": false, "check": 1 }, { "text": "one's", "block": false, "check": 1 }, { "text": "own", "block": false, "check": 1 }, { "text": "flag", "block": true, "check": 1 }], "pieImage": "http://staging-teach.cdn.ireadabc.com/0205b2ff3fc18a109419aec0c84d5bfe.png"
}, {
"title": "Test", "mainType": "img_text", "mainText": "I have an apple.", "mainTextArr": [{ "text": "I", "block": false, "check": 1 }, { "text": "have", "block": false, "check": 1 }, { "text": "an", "block": true, "check": 1 }, { "text": "apple.", "block": false, "check": 1 }], "mainImage": "http://staging-teach.cdn.ireadabc.com/45f92811e6830d6c3b554b415afab7f7.png", "meetType": "text", "meetText": "I have a meet", "meetTextArr": [{ "text": "I", "block": false, "check": 1 }, { "text": "have", "block": false, "check": 1 }, { "text": "a", "block": false, "check": 1 }, { "text": "meet", "block": true, "check": 1 }], "meetImage": "", "vegetableType": "img", "vegetableText": "", "vegetableTextArr": [], "vegetableImage": "http://staging-teach.cdn.ireadabc.com/2a7c0b6ad9df5b42871ddd76d3654f04.png", "pieType": "text", "pieText": "I have a pie", "pieTextArr": [{ "text": "I", "block": false, "check": 1 }, { "text": "have", "block": false, "check": 1 }, { "text": "a", "block": false, "check": 1 }, { "text": "pie", "block": true, "check": 1 }], "pieImage": ""
}],
"questionText": "",
"auidoStart": "http://staging-teach.cdn.ireadabc.com/5f4e4c72671607bb35d1ecd1d291f238_l.mp3",
"auidoStartName": "", "auidoEnd": "http://staging-teach.cdn.ireadabc.com/5f4e4c72671607bb35d1ecd1d291f238_l.mp3",
"auidoMeet": "http://staging-teach.cdn.ireadabc.com/5f4e4c72671607bb35d1ecd1d291f238_l.mp3",
"auidoVegetable": "http://staging-teach.cdn.ireadabc.com/5f4e4c72671607bb35d1ecd1d291f238_l.mp3",
"auidoFinish": "http://staging-teach.cdn.ireadabc.com/5f4e4c72671607bb35d1ecd1d291f238_l.mp3"
}
\ No newline at end of file
......@@ -190,10 +190,7 @@
</div>
</div>
<div style="margin-top: 20px;">
<div name="题干部分">
<div name="题干部分" class="border-solid" style="margin-top: 20px;">
<div class="word-type-option-title">
题干类型:
......@@ -229,7 +226,7 @@
<span style="font-size: 20px;">文本:</span>
<div class="border-dashed" style="width: 900px;">
<h2>空格分隔选词:</h2>
<textarea rows="4" nz-input [(ngModel)]="question.mainText" (blur)="changeMain(i)"></textarea>
<textarea rows="4" nz-input [(ngModel)]="question.mainText" (blur)="changeMain(i,'main')"></textarea>
</div>
<div class="border-dashed" style="width: 900px;">
......@@ -249,6 +246,174 @@
</div>
<div name="肉饼部分" class="border-solid" style="margin-top: 20px;">
<div class="word-type-option-title">
肉饼类型:
</div>
<div style="margin-top: 5px;">
<nz-radio-group [(ngModel)]="question.meetType" (ngModelChange)="save()">
<label nz-radio nzValue="img">
<span [style]="{color:question.meetType=='img' ? '#169BD5':'#000'}">图片</span>
</label>
<label nz-radio nzValue="text">
<span [style]="{color:question.meetType=='text' ? '#169BD5':'#000'}">文字</span>
</label>
</nz-radio-group>
</div>
<div>
<div class="option-img">
<div *ngIf="question.meetType=='img' || question.meetType =='img_text'" style="width: 200px;">
<span style="font-size: 20px;">图片:</span>
<app-upload-image-with-preview [picUrl]="question.meetImage"
(imageUploaded)="onImageUploadSuccess($event, 'meetImage',question)">
</app-upload-image-with-preview>
</div>
</div>
<div class="option-text">
<div *ngIf="question.meetType=='text' || question.meetType =='img_text'" style="width: 1000px">
<span style="font-size: 20px;">文本:</span>
<div class="border-dashed" style="width: 900px;">
<h2>空格分隔选词:</h2>
<textarea rows="4" nz-input [(ngModel)]="question.meetText"
(blur)="changeMain(i,'meet')"></textarea>
</div>
<div class="border-dashed" style="width: 900px;">
<h2>点击文本设置高亮:</h2>
<span *ngFor="let cont of question.meetTextArr; let i = index" style="margin-bottom: 5px; ">
<span *ngIf="cont.block" class="option-title-line" (click)="onBlock(cont,false)"
[innerHtml]="cont.text"></span>
<span *ngIf="!cont.block" class="option-title" (click)="onBlock(cont,true)"
[innerHtml]="cont.text"></span>
</span>
</div>
</div>
</div>
</div>
</div>
<div name="蔬菜部分" class="border-solid" style="margin-top: 20px;">
<div class="word-type-option-title">
蔬菜类型:
</div>
<div style="margin-top: 5px;">
<nz-radio-group [(ngModel)]="question.vegetableType" (ngModelChange)="save()">
<label nz-radio nzValue="img">
<span [style]="{color:question.vegetableType=='img' ? '#169BD5':'#000'}">图片</span>
</label>
<label nz-radio nzValue="text">
<span [style]="{color:question.vegetableType=='text' ? '#169BD5':'#000'}">文字</span>
</label>
</nz-radio-group>
</div>
<div>
<div class="option-img">
<div *ngIf="question.vegetableType=='img' || question.vegetableType =='img_text'"
style="width: 200px;">
<span style="font-size: 20px;">图片:</span>
<app-upload-image-with-preview [picUrl]="question.vegetableImage"
(imageUploaded)="onImageUploadSuccess($event, 'vegetableImage',question)">
</app-upload-image-with-preview>
</div>
</div>
<div class="option-text">
<div *ngIf="question.vegetableType=='text' || question.vegetableType =='img_text'"
style="width: 1000px">
<span style="font-size: 20px;">文本:</span>
<div class="border-dashed" style="width: 900px;">
<h2>空格分隔选词:</h2>
<textarea rows="4" nz-input [(ngModel)]="question.vegetableText"
(blur)="changeMain(i,'vegetable')"></textarea>
</div>
<div class="border-dashed" style="width: 900px;">
<h2>点击文本设置高亮:</h2>
<span *ngFor="let cont of question.vegetableTextArr; let i = index" style="margin-bottom: 5px; ">
<span *ngIf="cont.block" class="option-title-line" (click)="onBlock(cont,false)"
[innerHtml]="cont.text"></span>
<span *ngIf="!cont.block" class="option-title" (click)="onBlock(cont,true)"
[innerHtml]="cont.text"></span>
</span>
</div>
</div>
</div>
</div>
</div>
<div name="面饼部分" class="border-solid" style="margin-top: 20px;">
<div class="word-type-option-title">
面饼类型:
</div>
<div style="margin-top: 5px;">
<nz-radio-group [(ngModel)]="question.pieType" (ngModelChange)="save()">
<label nz-radio nzValue="img">
<span [style]="{color:question.pieType=='img' ? '#169BD5':'#000'}">图片</span>
</label>
<label nz-radio nzValue="text">
<span [style]="{color:question.pieType=='text' ? '#169BD5':'#000'}">文字</span>
</label>
<label nz-radio nzValue="img_text">
<span [style]="{color:question.pieType=='img_text' ? '#169BD5':'#000'}">文字+图片</span>
</label>
</nz-radio-group>
</div>
<div>
<div class="option-img">
<div *ngIf="question.pieType=='img' || question.pieType =='img_text'" style="width: 200px;">
<span style="font-size: 20px;">图片:</span>
<app-upload-image-with-preview [picUrl]="question.pieImage"
(imageUploaded)="onImageUploadSuccess($event, 'pieImage',question)">
</app-upload-image-with-preview>
</div>
</div>
<div class="option-text">
<div *ngIf="question.pieType=='text' || question.pieType =='img_text'" style="width: 1000px">
<span style="font-size: 20px;">文本:</span>
<div class="border-dashed" style="width: 900px;">
<h2>空格分隔选词:</h2>
<textarea rows="4" nz-input [(ngModel)]="question.pieText"
(blur)="changeMain(i,'pie')"></textarea>
</div>
<div class="border-dashed" style="width: 900px;">
<h2>点击文本设置高亮:</h2>
<span *ngFor="let cont of question.pieTextArr; let i = index" style="margin-bottom: 5px; ">
<span *ngIf="cont.block" class="option-title-line" (click)="onBlock(cont,false)"
[innerHtml]="cont.text"></span>
<span *ngIf="!cont.block" class="option-title" (click)="onBlock(cont,true)"
[innerHtml]="cont.text"></span>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="margin-left: 10px;">
<button class="btn-red" nz-button nzType="default" nzDanger (click)="removeQuestion(i)">删除题目</button>
</div>
</div>
......@@ -275,4 +440,4 @@
</div>
</div>
\ No newline at end of file
</div>
\ No newline at end of file
......@@ -90,7 +90,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
removequestion(idx) {
removeQuestion(idx) {
this.openDelete("确定删除题目?", () => {
this.item.questions.splice(idx, 1);
this.save();
......@@ -105,6 +105,22 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
mainText: "",//题干文字
mainTextArr: [],//题干文字高亮
mainImage: "",//题干图片
meetType: "",//肉类型
meetText: "",//肉文字
meetTextArr: [],//肉文字高亮
meetImage: "",//肉图片
vegetableType: "",//菜类型
vegetableText: "",//菜文字
vegetableTextArr: [],//菜文字高亮
vegetableImage: "",//菜图片
pieType: "",//菜类型
pieText: "",//菜文字
pieTextArr: [],//菜文字高亮
pieImage: "",//菜图片
});
this.save();
}
......@@ -124,11 +140,11 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
this.save();
}
changeMain(i) {
changeMain(i, name) {
let question = this.item.questions[i]
//输出的数据可以识别到\n的换行符
let contentMain = question.mainText;
let contentArr = question.mainTextArr || [];
let contentMain = question[name + "Text"];
let contentArr = question[name + "TextArr"] || [];
let arr = contentMain.split(" ");
let oldArr = contentArr.concat();
let contetArr = arr.map(ar => {
......@@ -147,10 +163,11 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
}
return obj;
})
question.mainTextArr = contetArr;
question[name + "TextArr"] = contetArr;
console.log(contetArr)
this.save();
}
onBlock(item, vis) {
item.block = vis;
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