Commit bd59ce3a authored by 李维's avatar 李维

dev commit

parent 5557a5b8
......@@ -40,7 +40,7 @@
<span>卡片类型</span><span> :</span>
</div>
<div style="float: left; width: 300px;">
<nz-radio-group [(ngModel)]="contentObj.answerType" (ngModelChange)="saveItem()" >
<nz-radio-group [(ngModel)]="contentObj.answerType" (ngModelChange)="handleAnswerTypeChange()" >
<label nz-radio [nzValue]="'Text'">文字</label>
<label nz-radio [nzDisabled]="contentObj.question.type != 'LongAudio'" [nzValue]="'Image'">图片</label>
</nz-radio-group>
......@@ -71,12 +71,6 @@
<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">
......@@ -86,25 +80,27 @@
<div class="section" >
<div class="section-content">
<div *ngIf="contentObj.answerType=='Text'" style="flex:1">
<div style="display: flex; margin-bottom: 10px;">
<div style="flex:1">
文字
<div [ngSwitch]="contentObj.answerType">
<div *ngSwitchCase="Text" style="flex:1">
<div style="display: flex; margin-bottom: 10px;">
<div style="flex:1">
文字
</div>
<div style="flex:5">
<!-- <input type="text" nz-input placeholder="" [(ngModel)]="contentObj.dataArray[i]" (blur)="saveItem()" style="width: 250px;" /> -->
<input type="text" nz-input placeholder="" [(ngModel)]="contentObj.dataArray[i]" (blur)="handleTextChange($event, i)" style="width: 250px;" />
</div>
</div>
<div style="flex:5">
<input type="text" nz-input placeholder="" [(ngModel)]="item.text" (blur)="saveItem()" style="width: 250px;" />
</div>
</div>
</div>
<div *ngIf="contentObj.answerType=='Image'" style="flex:1" >
<div style="display: flex; ">
<div style="flex:1">
图片
<div *ngSwitchCase="Image" style="flex:1">
<div style="display: flex; ">
<div style="flex:1">
图片
</div>
<div style="flex:5">
<app-upload-image-with-preview style="width: 100%;" [picUrl]="item" (imageUploaded)="onImageUploadSuccessByItem($event, contentObj.dataArray, i)"></app-upload-image-with-preview>
</div>
</div>
<div style="flex:5">
<app-upload-image-with-preview style="width: 100%;" [picUrl]="item.image_url" (imageUploaded)="onImageUploadSuccessByItem($event, contentObj.dataArray, i)"></app-upload-image-with-preview>
</div>
</div>
</div>
</div>
......
......@@ -13,6 +13,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
_item: any;
KEY = 'DataKey_PU01';
checkOptionsOne = []
Text = "Text"
Image = "Image"
set item(item) {
this._item = item;
......@@ -24,7 +28,11 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
"version": "1.0",
key: "DataKey_PU01",
question: {
type: "Image"
type: "Image",
text: "",
image_url: "",
shortAudio_url: "",
longAudio_url: ""
},
answerType: "Text",
dataArray: []
......@@ -45,14 +53,28 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
handleQuestionTypeChange(){
if(this.contentObj.question.type != 'LongAudio'){
this.contentObj.answerType='Text'
if(this.contentObj.answerType != "Text"){
this.contentObj.answerType='Text'
let len = this.contentObj.dataArray.length
this.contentObj.dataArray = Array(len).fill("")
}
}
this.saveItem()
}
handleAnswerTypeChange(){
// console.log("Change")
let len = this.contentObj.dataArray.length
this.contentObj.dataArray = Array(len).fill("")
this.saveItem()
}
handleTextChange(e, index){
// console.log(e.target.value, index)
this.contentObj.dataArray[index] = e.target.value
this.saveItem()
this.refresh();
}
......@@ -132,12 +154,13 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
addItem(item?, type?) {
item.push({ text: "", image_url: "" })
item.push("")
this.saveItem();
}
onImageUploadSuccessByItem(e, item, key) {
item[key] = e.url
this.contentObj.dataArray[key] = e.url
this,this.refresh()
this.save();
}
......
This diff is collapsed.
......@@ -31,6 +31,7 @@ const localImages = {
'bg_bottom': 'assets/play/bg_bottom.png',
'bg_change': 'assets/play/bg_change_1.png',
'bg_change2': 'assets/play/bg_change2-1.png',
'bg_change3': 'assets/play/bg_change2-2.png',
'bg_kuang1': 'assets/play/bg_kuang1.png',
'bg_kuang2': 'assets/play/bg_kuang2.png',
'bg_laba': 'assets/play/bg_laba.png',
......@@ -60,6 +61,9 @@ const localImages = {
'border_right': 'assets/play/border_right.png',
'border_center': 'assets/play/border_center.png',
'lego-building': 'assets/play/lego-building.jpg',
'bg_face': 'assets/play/bg_face.png',
'btn_laba (1)': 'assets/play/frame/btn_laba (1).png',
'btn_laba (2)': 'assets/play/frame/btn_laba (2).png',
......
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