diff --git a/frontend/src/pages/oj/views/problem/Problem.vue b/frontend/src/pages/oj/views/problem/Problem.vue index 0f24a9e5b..7d6ed959e 100644 --- a/frontend/src/pages/oj/views/problem/Problem.vue +++ b/frontend/src/pages/oj/views/problem/Problem.vue @@ -574,7 +574,8 @@ export default { language: this.language, code: this.code, contest_id: this.contestID, - assignment_id: this.assignmentID + assignment_id: this.assignmentID, + course_id: this.courseID } if (this.captchaRequired) { data.captcha = this.captchaCode diff --git a/frontend/src/pages/prof/api.js b/frontend/src/pages/prof/api.js index a25f6bae3..dee7ca4bf 100644 --- a/frontend/src/pages/prof/api.js +++ b/frontend/src/pages/prof/api.js @@ -148,6 +148,36 @@ export default { params: params }) }, + getCourseProblem (courseId, problemId, limit, offset) { + return ajax('lecture/professor/course/problem/', 'get', { + params: { + course_id: courseId, + problem_id: problemId, + limit: limit, + offset: offset + } + }) + }, + createCourseProblem (data) { + return ajax('lecture/professor/course/problem/', 'post', { + data + }) + }, + editCourseProblem (data) { + return ajax('lecture/professor/course/problem/', 'put', { + data + }) + }, + deleteCourseProblem (id) { + return ajax('lecture/professor/course/problem/', 'delete', { + params: { id: id } + }) + }, + addCourseProblemFromPublic (data) { + return ajax('lecture/professor/course/add_problem_from_public/', 'post', { + data + }) + }, // only assignmentId param => return problemList instead getAssignmentProblem (assignmentId, problemId) { const params = { problem_id: problemId, assignment_id: assignmentId } diff --git a/frontend/src/pages/prof/components/SideMenu.vue b/frontend/src/pages/prof/components/SideMenu.vue index 38d912922..d1a5bd0ea 100644 --- a/frontend/src/pages/prof/components/SideMenu.vue +++ b/frontend/src/pages/prof/components/SideMenu.vue @@ -53,6 +53,17 @@ /> Dashboard + + + Problems + @@ -212,7 +214,9 @@ export default { 'Operation' ], selectedAssignmentId: null, - studentTotal: 0 + selectedCourseId: null, + studentTotal: 0, + courseId: '' } }, async mounted () { @@ -283,8 +287,9 @@ export default { createAssignmentProblem (assignment) { if (this.routeName === 'course-assignment-list') { this.$router.push({ - name: 'create-course-problem', + name: 'create-assignment-problem', params: { + courseId: this.courseId, assignmentId: assignment.id, courseInfo: this.pageLocations[0].text, assignmentInfo: assignment.title @@ -295,7 +300,7 @@ export default { editAssignmentProblem (assignment, problemId) { if (this.routeName === 'course-assignment-list') { this.$router.push({ - name: 'edit-course-problem', + name: 'edit-assignment-problem', params: { courseId: this.courseId, assignmentId: assignment.id, @@ -355,8 +360,9 @@ export default { } await api.editAssignment(data) }, - showImportPublicProblemModal (assignmentId) { + showImportPublicProblemModal (assignmentId, courseId) { this.selectedAssignmentId = assignmentId + this.selectedCourseId = courseId this.$bvModal.show('import-public-problem-modal') }, async getUserTotal () { diff --git a/frontend/src/pages/prof/views/assignment/ImportPublicProblem.vue b/frontend/src/pages/prof/views/assignment/ImportPublicProblem.vue index 6fabe23b1..d523e88d3 100644 --- a/frontend/src/pages/prof/views/assignment/ImportPublicProblem.vue +++ b/frontend/src/pages/prof/views/assignment/ImportPublicProblem.vue @@ -94,7 +94,7 @@ import { DIFFICULTY_COLOR } from '@/utils/constants' export default { name: 'ImportPublicProblem', mixins: [ProblemMixin], - props: ['assignmentId'], + props: ['assignmentId', 'courseId', 'mode'], data () { return { form: { @@ -197,12 +197,17 @@ export default { return } const data = { + course_id: this.courseId, assignment_id: this.assignmentId, problem_id: this.form.selectedProblemId, display_id: this.form.displayId } try { - await profApi.addProblemFromPublic(data) + if (this.mode === 'assignment') { + await profApi.addProblemFromPublic(data) + } else { + await profApi.addCourseProblemFromPublic(data) + } } catch (err) { } this.$set(this.form, 'selectedProblemId', null) diff --git a/frontend/src/pages/prof/views/general/CourseBookmark.vue b/frontend/src/pages/prof/views/general/CourseBookmark.vue index 72c88acda..8708be342 100644 --- a/frontend/src/pages/prof/views/general/CourseBookmark.vue +++ b/frontend/src/pages/prof/views/general/CourseBookmark.vue @@ -95,7 +95,6 @@ export default { try { const resp = await api.getCourseList() this.courseList = resp.data.data.results - console.log(this.courseList) } catch (err) { } }, diff --git a/frontend/src/pages/prof/views/general/CourseDashboard.vue b/frontend/src/pages/prof/views/general/CourseDashboard.vue index cb5274b1c..4f1b399cd 100644 --- a/frontend/src/pages/prof/views/general/CourseDashboard.vue +++ b/frontend/src/pages/prof/views/general/CourseDashboard.vue @@ -15,10 +15,8 @@ cols = "1" class="course-dashboard" > - - + +