@@ -656,7 +655,7 @@ export default {
getCourse: {},
finds: [{ value: "" }],
findsChapterPoint: [{ value: "" }],
- updates: [{ value: "" }],
+ updates: [],
youTubeLink: {},
addCourseDetail: {
chapters: [
@@ -705,7 +704,9 @@ export default {
editedIndex: -1,
editedItem: {},
editedCourse: {},
- editChapter: {},
+ editChapter: {
+ chapterPoints: []
+ },
index: "",
addChapterItem: {},
addChapterItemObj: {},
@@ -806,6 +807,10 @@ export default {
editChapterItem(item) {
this.editedIndex = this.chapters.indexOf(item);
this.editChapter = Object.assign({}, item);
+ this.updates = [];
+ for (let i = 0; i < this.editChapter.chapterPoints.length; i++) {
+ this.updates.push({ value: this.editChapter.chapterPoints[i] });
+ }
this.editChapterDetailDialog = true;
},
deleteItem(item) {
@@ -911,14 +916,11 @@ export default {
},
saveChapter() {
this.editedItem.courseDetailId = this.editedItem._id;
- console.log("this.updates", this.updates);
+ // console.log("this.updates", this.updates);
+ var chapterPoints = [];
for (let i = 0; i < this.updates.length; i++) {
- if (this.updates[i].value != "") {
- var chapterPoints = [];
- chapterPoints.push(this.updates[i].value);
- } else {
- chapterPoints = this.editChapter.chapterPoints;
- }
+ console.log("this.updates[i]", this.updates[i]);
+ chapterPoints.push(this.updates[i].value);
}
var updateData = {
courseDetailId: this.courseId,
@@ -927,6 +929,7 @@ export default {
description: this.editChapter.description,
chapterPoints: chapterPoints
};
+ console.log("chapterPoints", updateData);
this.editLoading = true;
http()
.put("/updateChapters", updateData)
@@ -936,7 +939,7 @@ export default {
this.text = response.data.message;
this.color = "green";
this.editLoading = false;
- this.removeUpdatePoints();
+ // this.removeUpdatePoints();
this.getCourseDetailsList();
})
.catch(error => {
@@ -1001,9 +1004,9 @@ export default {
update: function() {
this.updates.push({ value: "" });
},
- removeUpdatePoints: function() {
- this.updates = [{ value: "" }];
- },
+ // removeUpdatePoints: function() {
+ // this.updates = [{ value: "" }];
+ // },
deleteFind: function(index) {
this.finds.splice(index, 1);
if (index === 0) this.addFind();