import { baseRequest } from '@/utils/request'

const request = (url, ...arg) => baseRequest(`/api/webapp/` + url, ...arg)

export default {
	pageList: (query) => request('api/admin/question/page', query, 'post'),
	edit: (query) => request('api/admin/question/edit', query, 'post'),
	select: (id) => request('api/admin/question/select/' + id, '', 'post'),
	deleteQuestion: (id) => request('api/admin/question/delete/' + id, '', 'post'),
	importExcel: (file) => {
		const formData = new FormData()
		formData.append('file', file)
		return request('api/admin/question/loadExcel', formData, 'post', {
			headers: {
				'Content-Type': 'multipart/form-data'
			}
		})
	},
	// 导入数据检查接口
	checkExcel: (file) => {
		const formData = new FormData()
		formData.append('file', file)
		return request('api/admin/question/checkExcel', formData, 'post', {
			headers: {
				'Content-Type': 'multipart/form-data'
			}
		})
	}
}
