| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- import {axios} from "@/requests/axios.config";
- import courseSelectionAPIs from "@/api/course/courseSelection";
- const prefix = "/course";
- function createCourse(data) {
- console.log(data);
- return axios.post(`${prefix}/create`, data);
- }
- function getAllCourses() {
- return axios.get(`${prefix}/all`);
- }
- function getAllCoderCourses() {
- return axios.get(`${prefix}/coder_all`);
- }
- function getExampleCourses() {
- return axios.get(`${prefix}/example`);
- }
- function getTeacherCourses() {
- return axios.get(`${prefix}/teacher`);
- }
- function getStudentCourses() {
- return axios.get(`${prefix}/student`);
- }
- function getCourseById(id) {
- return axios.get(`${prefix}/getCourseById`, {
- params: {
- id
- },
- });
- }
- function updateCourse(data) {
- return axios.put(`${prefix}/update`, data);
- }
- function deleteCourse(courseId) {
- return axios.delete(`${prefix}/delete`, {
- params: {
- courseId,
- }
- });
- }
- function getCourseByCoderId(coderId) {
- return axios.get(`${prefix}/getCourseByCoderId`, {
- params: {
- coderId,
- }
- });
- }
- function getCourseByEvalId(evalId) {
- return axios.get(`${prefix}/getCourseByEvalId`, {
- params: {
- evalId,
- }
- });
- }
- function checkCourseNameUnique(id, name) {
- return axios.get(`${prefix}/checkName`, {
- params: {id, name}
- });
- }
- function checkCourseCodeUnique(id, code) {
- return axios.get(`${prefix}/checkCode`, {
- params: {id, code}
- });
- }
- function uploadCourseImage(name, image) {
- let data = new FormData();
- data.append("name", name);
- data.append("file", image);
- return axios.post(`${prefix}/uploadImage`, data, {
- headers: {
- "Content-Type": "multipart/form-data"
- }
- });
- }
- function uploadCarouselChart(input) {
- return axios.post(`${prefix}/uploadCarouseChart`, input);
- }
- function queryCarouselChart() {
- return axios.get(`${prefix}/queryCarouselChart`, {
- params: {}
- });
- }
- function findCourseByName(data) {
- return axios.get(`${prefix}/findCourseByName`, {
- params: {
- name: data,
- }
- });
- }
- const courseAPIs = {
- createCourse,
- getAllCourses,
- getAllCoderCourses,
- getTeacherCourses,
- getStudentCourses,
- getCourseById,
- deleteCourse,
- updateCourse,
- getExampleCourses,
- ...courseSelectionAPIs,
- getCourseByCoderId,
- checkCourseNameUnique,
- checkCourseCodeUnique,
- getCourseByEvalId,
- uploadCourseImage,
- uploadCarouselChart,
- queryCarouselChart,
- findCourseByName,
- };
- export default courseAPIs;
|