import axios from '@/plugins/axios' import { useCourseFileServer } from '@/config/server-info' export function uploadCourseFile ({ courseId, file }) { let data = new FormData() data.append('courseId', courseId) data.append('file', file) return axios .post(useCourseFileServer(), data, { headers: { 'Content-Type': 'multipart/form-data' } }) .then(res => res.data) } export function deleteCourseFile ({ courseFileId }) { return axios .delete(useCourseFileServer('/' + courseFileId)) .then(res => {}) } export function getOneCourseFile ({ courseId, key = '', page = 1, size = 10, sort = '' }) { return axios .get(useCourseFileServer('/course/' + courseId), { params: { key, page, size, sort } }) .then(res => res.data) } export function getCourseFileUrl ({ courseFileId }) { return axios .get(useCourseFileServer('/' + courseFileId + '/url')) .then(res => res.data) }