import Http from '~~/utils/http'; import {PaginationVo, ResOptions} from "~~/api/types"; export default new class Common extends Http> { private readonly upload = '/common/upload' private readonly caseList = '/cases/lists' private readonly bottomMenu = '/index/bottomMenu' private readonly search_url = '/index/search' private readonly login_url = '/user/login' private readonly carousel_url = '/index/carousel' private readonly index_url = '/index/index' private readonly captcha_url = 'http://research.mcnetmart.com/index.php?s=/captcha' handleUpload(file: any) { const formData = new FormData(); formData.append('file', file) return this.post(this.upload, formData) } getCaseList(params: PaginationVo) { return this.get(this.caseList, params) } getBottomMenu() { return this.get(this.bottomMenu) } login(data: any) { return this.post(this.login_url,this.toFormData(data)) } searchApi(params: PaginationVo & {category_id?: number}){ return this.get(this.search_url, params) } getCarousel(){ return this.get(this.carousel_url, {category: '首页'}) } getIndexConfig(){ return this.get(this.index_url) } getCaptcha(){ return this.get(this.captcha_url) } }