Commit 3fe625cf authored by 李维's avatar 李维

dev commit

parent 178c8d28
......@@ -88,7 +88,7 @@
</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;" />
<input type="text" nz-input placeholder="" [(ngModel)]="contentObj.dataArray[i].text" (blur)="handleTextChange($event, i)" style="width: 250px;" />
</div>
</div>
</div>
......@@ -98,7 +98,7 @@
图片
</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>
<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>
......
......@@ -25,7 +25,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
return this._item;
}
contentObj = {
"version": "1.0",
"version": "1.1",
key: "DataKey_PU01",
question: {
type: "Image",
......@@ -53,25 +53,21 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
handleQuestionTypeChange(){
if(this.contentObj.question.type != 'LongAudio'){
if(this.contentObj.answerType != "Text"){
this.contentObj.answerType='Text'
let len = this.contentObj.dataArray.length
this.contentObj.dataArray = Array(len).fill("")
}
this.contentObj.answerType='Text'
}
this.saveItem()
}
handleAnswerTypeChange(){
// console.log("Change")
let len = this.contentObj.dataArray.length
this.contentObj.dataArray = Array(len).fill("")
// 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.contentObj.dataArray[index].text = e.target.value
this.saveItem()
this.refresh();
}
......@@ -159,7 +155,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
onImageUploadSuccessByItem(e, item, key) {
this.contentObj.dataArray[key] = e.url
this.contentObj.dataArray[key].image_url = e.url
this,this.refresh()
this.save();
}
......
......@@ -166,7 +166,9 @@ export class PlayComponent implements OnInit, OnDestroy {
mapToImageArray(contentObj){
let array = []
this.g_formData.dataArray.forEach(element => {
array.push(element)
if(element.image_url){
array.push(element.image_url)
}
});
if(this.g_formData.question.image_url){
array.push(this.g_formData.question.image_url)
......@@ -244,13 +246,6 @@ export class PlayComponent implements OnInit, OnDestroy {
initBackground(){
let element = this.g_cartoon.createCartoonElementImageFunc("background-main", "bg_face", (w, h)=>{
// let sx = this.g_canvasWidth / w
// let sy = this.g_canvasHeight / h
// let s = Math.min(sx, sy)
// return {
// sx: s,
// sy: s
// }
let sx = this.g_canvasWidth / w
let sy = this.g_canvasHeight / h
let s = Math.min(sx, sy)
......@@ -269,14 +264,14 @@ export class PlayComponent implements OnInit, OnDestroy {
xia.ref.alpha = 0
element.koushui = (callback?)=>{
element.starAni = this.g_cartoon.createAnimation("icon_kou", 4, 200, ()=>{
element.starAni = this.g_cartoon.createAnimation("icon_kou", 4, 300, ()=>{
element.starAni.visible = false;
this.deleteElementInRender(element.starAni.id)
callback && callback()
})
element.starAni.setScaleXY(this.g_mapScale)
element.starAni.x = element.ref.x + 300 * this.g_mapScale
element.starAni.y = element.ref.y + 397 * this.g_mapScale
element.starAni.y = element.ref.y + 398 * this.g_mapScale
this.render(element.starAni, zIndexMap.animation)
element.starAni.play()
}
......@@ -310,7 +305,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// 问题卡片 文字
initQuestionCard_Text(){
this.g_formData.dataArray.forEach((element, index) => {
this.m_questionCard_All.push(this.createQuestionCardText(index, element))
this.m_questionCard_All.push(this.createQuestionCardText(index, element.text))
});
this.m_questionCard_All = this.randomArray_shuffle(this.m_questionCard_All)
this.alignCenter(this.m_questionCard_All, 40*this.g_mapScale, true)
......@@ -438,10 +433,10 @@ export class PlayComponent implements OnInit, OnDestroy {
// 问题卡片 图片
initQuestionCard_Image(){
this.g_formData.dataArray.forEach((item, index)=>{
this.m_questionCard_All.push(this.createQuestionCardImage(index, item))
this.m_questionCard_All.push(this.createQuestionCardImage(index, item.image_url))
})
this.m_questionCard_All = this.randomArray_shuffle(this.m_questionCard_All)
this.alignCenter(this.m_questionCard_All, 20*this.g_mapScale, true)
this.alignCenter(this.m_questionCard_All, 40*this.g_mapScale, true)
}
createQuestionCardImage(index, data){
......
export default {
"version": "1.0",
"version": "1.1",
key: "DataKey_PU01",
question: {
type: "Image"
type: "Text",
text: "Sort alphabetically",
image_url: "",
shortAudio_url: "",
longAudio_url: ""
},
answerType: "Text",
dataArray: ["One", "Two", "Three", "Four"]
dataArray: [{text: "Blueberry", image_url: ""}, {text: "Cherry", image_url: ""}, {text: "Pineapple", image_url: ""}]
}
\ 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