diff --git a/src/pages/overall/overall-course/course-head/course-head.vue b/src/pages/overall/overall-course/course-head/course-head.vue index 6d3e6a6..9ac9b74 100644 --- a/src/pages/overall/overall-course/course-head/course-head.vue +++ b/src/pages/overall/overall-course/course-head/course-head.vue @@ -51,7 +51,7 @@
- +
@@ -62,9 +62,9 @@
Any additional comments? (this is optional)
+ v-model="rating.comment" maxlength="4500" show-word-limit :autosize="{minRows: 2, maxRows: 4}"> - Anonymous + Anonymous @@ -90,6 +90,7 @@ @Prop({required: true}) clickable: boolean; ratingDialog = false; + ratingPosting = false; ratingCriteria = [ {title: 'Enjoyable', desc: 'How enjoyable is the course?'}, {title: 'Knowledge', desc: 'How interesting is the content of the course? ' + @@ -98,10 +99,7 @@ {title: 'Eloquence', desc: `Are the teacher's lectures easy to understand?`}, {title: 'Fairness', desc: `How fair is the teacher's grading? Is credit given in proportion to effort?`} ]; - ratingData = [0,0,0,0,0]; - ratingComment = ''; - ratingAnonymous = false; - ratingPosting = false; + rating = this.course.rating; /** * Redirect to the course page @@ -128,7 +126,7 @@ */ changeStars(index: number, star: number) { - this.ratingData[index] = star + 1; + this.rating.ratings[index] = star + 1; this.$forceUpdate(); } @@ -139,12 +137,7 @@ { this.ratingPosting = true; - App.http.post('/course-info/rating/set', {rating: { - id_ci: this.course.id_ci, - anonymous: this.ratingAnonymous, - ratings: this.ratingData, - comment: this.ratingComment} - }).then(response => + App.http.post('/course-info/rating/set', {rating: this.rating}).then(response => { if (response.success) {