Commit c3a54d5c1eea5555ada2caa56742cee21e5417e9
1 parent
7d2cd24624
Exists in
master
and in
2 other branches
fixed bugs
Showing
1 changed file
with
19 additions
and
16 deletions
Show diff stats
src/pages/Course/courseDetail.vue
... | ... | @@ -109,7 +109,7 @@ |
109 | 109 | </v-layout> |
110 | 110 | </v-flex> |
111 | 111 | </v-layout> |
112 | - <v-flex xs12 v-if="editChapter.chapterPoints !=[]"> | |
112 | + <!-- <v-flex xs12 v-if="editChapter.chapterPoints.length != 0"> | |
113 | 113 | <v-layout |
114 | 114 | wrap |
115 | 115 | v-for="(editChapterPoint,index) in editChapter.chapterPoints" |
... | ... | @@ -125,11 +125,10 @@ |
125 | 125 | </v-flex> |
126 | 126 | <v-flex xs2 class="pt-4"> |
127 | 127 | <v-icon @click="deleteUrl(index)">cancel</v-icon> |
128 | - <!-- <v-icon @click="update()">add_circle</v-icon> --> | |
129 | 128 | </v-flex> |
130 | 129 | </v-layout> |
131 | 130 | </v-layout> |
132 | - </v-flex> | |
131 | + </v-flex>--> | |
133 | 132 | <v-flex xs12> |
134 | 133 | <div v-for="(updateImage,index) in updates" :key="index"> |
135 | 134 | <v-layout wrap> |
... | ... | @@ -656,7 +655,7 @@ export default { |
656 | 655 | getCourse: {}, |
657 | 656 | finds: [{ value: "" }], |
658 | 657 | findsChapterPoint: [{ value: "" }], |
659 | - updates: [{ value: "" }], | |
658 | + updates: [], | |
660 | 659 | youTubeLink: {}, |
661 | 660 | addCourseDetail: { |
662 | 661 | chapters: [ |
... | ... | @@ -705,7 +704,9 @@ export default { |
705 | 704 | editedIndex: -1, |
706 | 705 | editedItem: {}, |
707 | 706 | editedCourse: {}, |
708 | - editChapter: {}, | |
707 | + editChapter: { | |
708 | + chapterPoints: [] | |
709 | + }, | |
709 | 710 | index: "", |
710 | 711 | addChapterItem: {}, |
711 | 712 | addChapterItemObj: {}, |
... | ... | @@ -806,6 +807,10 @@ export default { |
806 | 807 | editChapterItem(item) { |
807 | 808 | this.editedIndex = this.chapters.indexOf(item); |
808 | 809 | this.editChapter = Object.assign({}, item); |
810 | + this.updates = []; | |
811 | + for (let i = 0; i < this.editChapter.chapterPoints.length; i++) { | |
812 | + this.updates.push({ value: this.editChapter.chapterPoints[i] }); | |
813 | + } | |
809 | 814 | this.editChapterDetailDialog = true; |
810 | 815 | }, |
811 | 816 | deleteItem(item) { |
... | ... | @@ -911,14 +916,11 @@ export default { |
911 | 916 | }, |
912 | 917 | saveChapter() { |
913 | 918 | this.editedItem.courseDetailId = this.editedItem._id; |
914 | - console.log("this.updates", this.updates); | |
919 | + // console.log("this.updates", this.updates); | |
920 | + var chapterPoints = []; | |
915 | 921 | for (let i = 0; i < this.updates.length; i++) { |
916 | - if (this.updates[i].value != "") { | |
917 | - var chapterPoints = []; | |
918 | - chapterPoints.push(this.updates[i].value); | |
919 | - } else { | |
920 | - chapterPoints = this.editChapter.chapterPoints; | |
921 | - } | |
922 | + console.log("this.updates[i]", this.updates[i]); | |
923 | + chapterPoints.push(this.updates[i].value); | |
922 | 924 | } |
923 | 925 | var updateData = { |
924 | 926 | courseDetailId: this.courseId, |
... | ... | @@ -927,6 +929,7 @@ export default { |
927 | 929 | description: this.editChapter.description, |
928 | 930 | chapterPoints: chapterPoints |
929 | 931 | }; |
932 | + console.log("chapterPoints", updateData); | |
930 | 933 | this.editLoading = true; |
931 | 934 | http() |
932 | 935 | .put("/updateChapters", updateData) |
... | ... | @@ -936,7 +939,7 @@ export default { |
936 | 939 | this.text = response.data.message; |
937 | 940 | this.color = "green"; |
938 | 941 | this.editLoading = false; |
939 | - this.removeUpdatePoints(); | |
942 | + // this.removeUpdatePoints(); | |
940 | 943 | this.getCourseDetailsList(); |
941 | 944 | }) |
942 | 945 | .catch(error => { |
... | ... | @@ -1001,9 +1004,9 @@ export default { |
1001 | 1004 | update: function() { |
1002 | 1005 | this.updates.push({ value: "" }); |
1003 | 1006 | }, |
1004 | - removeUpdatePoints: function() { | |
1005 | - this.updates = [{ value: "" }]; | |
1006 | - }, | |
1007 | + // removeUpdatePoints: function() { | |
1008 | + // this.updates = [{ value: "" }]; | |
1009 | + // }, | |
1007 | 1010 | deleteFind: function(index) { |
1008 | 1011 | this.finds.splice(index, 1); |
1009 | 1012 | if (index === 0) this.addFind(); | ... | ... |