Commit 40281eec authored by 李维's avatar 李维

dev commit

parent 13070a82
<div class="model-content"> <div class="model-content">
<div class="card-config"> <div class="card-config">
<div class="card-item clearfix" style="padding: 0.5vw; width: 100%;" >
<div class="card-item-content border" >
<div class="card-item-content">
<div class="title" >
题目素材
</div>
<div class="section" >
<div class="section-content">
<div style="display: flex; margin-bottom: 10px;">
<div style="float: left; text-align: right; margin-right: 10px; margin-left: 10px;">
<span>显示选项</span><span> :</span>
</div>
<div style="float: left; width: 300px;">
<nz-radio-group [(ngModel)]="contentObj.question.type" (ngModelChange)="handleQuestionTypeChange()" >
<label nz-radio [nzValue]="'Text'" >文字</label>
<label nz-radio [nzValue]="'Image'" >图片</label>
<label nz-radio [nzValue]="'LongAudio'">长音频</label>
</nz-radio-group>
</div>
<div style="float: left; width: 300px;">
<div *ngIf="contentObj.question.type=='Image'">
<app-upload-image-with-preview style="width: 100%;" [picUrl]="contentObj.question.image_url" (imageUploaded)="onImageUploadSuccessByItem($event, contentObj.question, 'image_url')"></app-upload-image-with-preview>
</div>
<div *ngIf="contentObj.question.type=='Text'">
<textarea type="text" nz-input placeholder="" [(ngModel)]="contentObj.question.text" (blur)="saveItem()" ></textarea>
</div>
<div *ngIf="contentObj.question.type=='LongAudio'">
<app-audio-recorder [audioUrl]="contentObj.question.longAudio_url" (audioUploaded)="onAudioUploadSuccessByItem($event, contentObj.question, 'longAudio_url')" ></app-audio-recorder>
</div>
</div>
</div>
</div>
</div>
<div class="section" >
<div class="section-content">
<div style="display: flex; margin-bottom: 10px;">
<div style="float: left; text-align: right; margin-right: 10px; margin-left: 10px;">
<span>卡片类型</span><span> :</span>
</div>
<div style="float: left; width: 300px;">
<nz-radio-group [(ngModel)]="contentObj.answerType" (ngModelChange)="saveItem()" >
<label nz-radio [nzValue]="'Text'">文字</label>
<label nz-radio [nzDisabled]="contentObj.question.type != 'LongAudio'" [nzValue]="'Image'">图片</label>
</nz-radio-group>
</div>
<div style="float: left; width: 300px;"> </div>
</div>
</div>
</div>
<div class="section" >
<div class="section-content">
<div style="display: flex; margin-bottom: 10px;">
<div style="flex:1; text-align: right; margin-right: 10px;">
<span>短音频</span><span> :</span>
</div>
<div style="flex:3">
<app-audio-recorder [audioUrl]="contentObj.question.shortAudio_url" (audioUploaded)="onAudioUploadSuccessByItem($event, contentObj.question, 'shortAudio_url')" ></app-audio-recorder>
</div>
<div style="flex:8"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div *ngFor="let item of contentObj.dataArray; let i = index" class="card-item" style="padding: 0.5vw; " > <div *ngFor="let item of contentObj.dataArray; let i = index" class="card-item" style="padding: 0.5vw; " >
<div class="card-item-content border"> <div class="card-item-content border">
<div class="card-item-content"> <div class="card-item-content">
...@@ -9,7 +86,7 @@ ...@@ -9,7 +86,7 @@
<div class="section" > <div class="section" >
<div class="section-content"> <div class="section-content">
<div style="flex:1"> <div *ngIf="contentObj.answerType=='Text'" style="flex:1">
<div style="display: flex; margin-bottom: 10px;"> <div style="display: flex; margin-bottom: 10px;">
<div style="flex:1"> <div style="flex:1">
文字 文字
...@@ -20,7 +97,7 @@ ...@@ -20,7 +97,7 @@
</div> </div>
</div> </div>
<div style="flex:1" > <div *ngIf="contentObj.answerType=='Image'" style="flex:1" >
<div style="display: flex; "> <div style="display: flex; ">
<div style="flex:1"> <div style="flex:1">
图片 图片
......
...@@ -53,3 +53,9 @@ ...@@ -53,3 +53,9 @@
} }
} }
} }
.clearfix:before,.clearfix:after {
content: "";
display: block;
clear: both;
}
\ No newline at end of file
...@@ -11,7 +11,7 @@ import defauleFormData from '../../assets/play/default/formData/defaultData.js' ...@@ -11,7 +11,7 @@ import defauleFormData from '../../assets/play/default/formData/defaultData.js'
export class FormComponent implements OnInit, OnChanges, OnDestroy { export class FormComponent implements OnInit, OnChanges, OnDestroy {
_item: any; _item: any;
KEY = 'DataKey_PU08'; KEY = 'DataKey_PU01';
checkOptionsOne = [] checkOptionsOne = []
set item(item) { set item(item) {
...@@ -23,9 +23,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -23,9 +23,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
contentObj = { contentObj = {
"version": "1.0", "version": "1.0",
key: "DataKey_PU01", key: "DataKey_PU01",
dataArray: [ question: {
{ text: "", image_url: "" } type: "Image"
] },
answerType: "Text",
dataArray: []
} }
@Output() @Output()
...@@ -34,6 +36,28 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -34,6 +36,28 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
} }
handleQuestionTypeChange(){
if(this.contentObj.question.type != 'LongAudio'){
this.contentObj.answerType='Text'
}
this.saveItem()
}
ngOnInit() { ngOnInit() {
this.item = {}; this.item = {};
this.item.contentObj = {}; this.item.contentObj = {};
...@@ -113,7 +137,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -113,7 +137,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
} }
onImageUploadSuccessByItem(e, item, key) { onImageUploadSuccessByItem(e, item, key) {
item[key].image_url = e.url item[key] = e.url
this.save(); this.save();
} }
......
...@@ -14,6 +14,7 @@ import { ...@@ -14,6 +14,7 @@ import {
ShapeCircle, ShapeCircle,
MyAnimation MyAnimation
} from "./Unit"; } from "./Unit";
import { matchesElement } from '@angular/animations/browser/src/render/shared';
export class Cartoon { export class Cartoon {
...@@ -410,7 +411,7 @@ export class Cartoon { ...@@ -410,7 +411,7 @@ export class Cartoon {
createAnimation(imageKey, length, runTime, endCallback?, order?:boolean) { createAnimation(imageKey, length, runTime, endCallback?, order?:boolean) {
let element = new MyAnimation() let element = new MyAnimation()
element.id = "ANI-" + imageKey element.id = "ANI-" + imageKey + "-" + Math.floor(Math.random()*10000)
if(order){ if(order){
for (let index = length; index > 0; index--) { for (let index = length; index > 0; index--) {
element.addFrameByImg(this.images.get(`${imageKey} (${index})`)) element.addFrameByImg(this.images.get(`${imageKey} (${index})`))
......
This diff is collapsed.
...@@ -5,5 +5,5 @@ export default { ...@@ -5,5 +5,5 @@ export default {
type: "Image" type: "Image"
}, },
answerType: "Text", answerType: "Text",
dataArray: ["This is for test", "Apple", "Building", "Lovely Puppy"] dataArray: ["One", "Two", "Three", "Four"]
} }
\ 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