Commit b5012225 authored by hw_023_test's avatar hw_023_test

confirm

parent 6968ff34
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
(audioUploaded) = "onAudioUploadSuccessByItem($event,word)" (audioUploaded) = "onAudioUploadSuccessByItem($event,word)"
class="item" class="item"
></app-audio-recorder> ></app-audio-recorder>
<button style="margin-bottom: 10px;" nz-button nzType="danger" (click)="deleteItemWord(it,word)">删除单词和音频</button>
</div> </div>
<button nz-button nzType="primary" class="add-word-btn" (click)="addWord(it)">添加单词</button> <button nz-button nzType="primary" class="add-word-btn" (click)="addWord(it)">添加单词</button>
</div> </div>
......
...@@ -65,6 +65,9 @@ ...@@ -65,6 +65,9 @@
margin-right: 10px; margin-right: 10px;
} }
} }
button{
margin-left: 10px;
}
.add-word-btn{ .add-word-btn{
width: 100%; width: 100%;
} }
......
...@@ -18,6 +18,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -18,6 +18,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
// 储存对象 // 储存对象
_item: any; _item: any;
KEY = 'test_0011'; KEY = 'test_0011';
wordArr = [];
...@@ -143,6 +144,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -143,6 +144,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
deleteItem(data) { deleteItem(data) {
const index = this.picArr.indexOf(data); const index = this.picArr.indexOf(data);
console.log(this.picArr);
console.log(index);
if (index !== -1) { if (index !== -1) {
this.picArr.splice(index, 1); this.picArr.splice(index, 1);
} }
...@@ -151,6 +154,30 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -151,6 +154,30 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.save(); this.save();
} }
deleteItemWord(picdata,wordData) {
const pindex = this.picArr.indexOf(picdata);
// console.log('data',picdata,index);
const wordList = this.picArr[pindex].wordArr;
// console.log('s',wordList);
const windex = wordList.indexOf(wordData);
console.log('id',windex);
if ( pindex !== -1) {
// const this.picArr[pindex].wordArr[windex].splice(windex,1);
this.picArr[pindex].wordArr.splice(windex,1);
// const pic = this.picArr[pindex].wordArr;
// const word = pic[windex];
// console.log('word',word);
}
// const a = this.item.contentObj
// console.log(this.picArr);
// console.log(index);
// if (index !== -1) {
// this.wordArr.splice(index, 1);
// }
console.log('a');
// this.update.emit(this.item);
this.save();
}
......
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