Commit 39b5d7dd authored by limingzhe's avatar limingzhe

feat: 填空功能提交

parent 1ba521e9
...@@ -156,8 +156,8 @@ ...@@ -156,8 +156,8 @@
<span style="margin-right: 5px;">选择题问题:</span> <span style="margin-right: 5px;">选择题问题:</span>
<app-upload-image-with-preview <app-upload-image-with-preview
[picUrl]="item.choice_ques_pic_url" [picUrl]="item.choice_obj.ques_pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'choice_ques_pic_url')"> (imageUploaded)="onImageUploadSuccess($event, 'ques_pic_url', item.choice_obj)">
</app-upload-image-with-preview> </app-upload-image-with-preview>
</div> </div>
...@@ -167,21 +167,21 @@ ...@@ -167,21 +167,21 @@
<span style="margin-right: 5px; margin-left: 15px;">选择小标题:</span> <span style="margin-right: 5px; margin-left: 15px;">选择小标题:</span>
<app-audio-recorder <app-audio-recorder
[audioUrl]="item.choice_title_audio_url" [audioUrl]="item.choice_obj.title_audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'choice_title_audio_url')" (audioUploaded)="onAudioUploadSuccess($event, 'title_audio_url', item.choice_obj)"
></app-audio-recorder> ></app-audio-recorder>
</div> </div>
<app-upload-image-with-preview <app-upload-image-with-preview
[picUrl]="item.choice_title_pic_url" [picUrl]="item.choice_obj.title_pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'choice_title_pic_url')"> (imageUploaded)="onImageUploadSuccess($event, 'title_pic_url', item.choice_obj)">
</app-upload-image-with-preview> </app-upload-image-with-preview>
</div> </div>
</div> </div>
<div *ngFor="let op of item.optionArr" style="border: 1px solid #ccc; margin: 10px; padding: 10px; border-radius: 5px;"> <div *ngFor="let op of item.choice_obj.optionArr" style="border: 1px solid #ccc; margin: 10px; padding: 10px; border-radius: 5px;">
<div style="margin-top: 20px; display: flex; align-items: center; width: 500px;"> <div style="margin-top: 20px; display: flex; align-items: center; width: 500px;">
<span style="margin-right: 5px;">{{op.id}}:</span> <span style="margin-right: 5px;">{{op.id}}:</span>
<div style="width: 300px;"> <div style="width: 300px;">
...@@ -211,8 +211,8 @@ ...@@ -211,8 +211,8 @@
<span style="margin-right: 5px;">新简答问题:</span> <span style="margin-right: 5px;">新简答问题:</span>
<app-upload-image-with-preview <app-upload-image-with-preview
[picUrl]="item.answer_ques_pic_url" [picUrl]="item.answer_obj.ques_pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'answer_ques_pic_url')"> (imageUploaded)="onImageUploadSuccess($event, 'ques_pic_url', item.answer_obj)">
</app-upload-image-with-preview> </app-upload-image-with-preview>
</div> </div>
...@@ -222,14 +222,14 @@ ...@@ -222,14 +222,14 @@
<span style="margin-right: 5px; margin-left: 15px;">新简答小标题:</span> <span style="margin-right: 5px; margin-left: 15px;">新简答小标题:</span>
<app-audio-recorder <app-audio-recorder
[audioUrl]="item.answer_title_audio_url" [audioUrl]="item.answer_obj.title_audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'answer_title_audio_url')" (audioUploaded)="onAudioUploadSuccess($event, 'title_audio_url', item.answer_obj)"
></app-audio-recorder> ></app-audio-recorder>
</div> </div>
<app-upload-image-with-preview <app-upload-image-with-preview
[picUrl]="item.answer_title_pic_url" [picUrl]="item.answer_obj.title_pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'answer_title_pic_url')"> (imageUploaded)="onImageUploadSuccess($event, 'title_pic_url', item.answer_obj)">
</app-upload-image-with-preview> </app-upload-image-with-preview>
</div> </div>
......
...@@ -106,9 +106,30 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -106,9 +106,30 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
]; ];
} }
if (!this.item.answer_obj) {
this.item.answer_obj = {};
}
if (!this.item.choice_obj) {
this.item.choice_obj = {};
this.item.choice_obj.optionArr = [
{id: 'A', optionArr: [{id: 'A'}, {id: 'B'}]},
{id: 'B', optionArr: [{id: 'A'}, {id: 'B'}]},
{id: 'C', optionArr: [{id: 'A'}, {id: 'B'}]},
{id: 'D', optionArr: [{id: 'A'}, {id: 'B'}]},
];
}
if (!this.item.ques_type) { if (!this.item.ques_type) {
this.item.ques_type = 'single_choice' this.item.ques_type = 'single_choice'
} }
} }
addSubTemplate() { addSubTemplate() {
......
...@@ -1719,6 +1719,9 @@ export function getAngleByPos(px, py, mx, my) { ...@@ -1719,6 +1719,9 @@ export function getAngleByPos(px, py, mx, my) {
export function removeItemFromArr(arr, item) { export function removeItemFromArr(arr, item) {
if (!arr || !item) {
return;
}
const index = arr.indexOf(item); const index = arr.indexOf(item);
if (index !== -1) { if (index !== -1) {
arr.splice(index, 1); arr.splice(index, 1);
......
This diff is collapsed.
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