import service from '@/utils/request' import { ElMessage } from 'element-plus' // @Tags ProblemInfo // @Summary 创建ProblemInfo // @Security ApiKeyAuth // @accept application/json // @Produce application/json // @Param data body model.ProblemInfo true "创建ProblemInfo" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /problemInfo/createProblemInfo [post] export const createProblemInfo = (data) => { return service({ url: '/problemInfo/createProblemInfo', method: 'post', data }) } export const sendUserProblemInfo = (data) => { return service({ url: '/problemInfo/sendUser', method: 'post', data }) } export const getReadCountList = (params) => { return service({ url: '/readCount/getReadCountList', method: 'get', params }) } export const exportExcel = (data) => { service({ url: '/problemInfo/exportExcel', method: 'post', data, responseType: 'blob' }).then((res) => { handleFileError(res) }) } const handleFileError = (res) => { if (typeof (res.data) !== 'undefined') { if (res.data.type === 'application/json') { const reader = new FileReader() reader.onload = function() { const message = JSON.parse(reader.result).msg ElMessage({ showClose: true, message: message, type: 'error' }) } reader.readAsText(new Blob([res.data])) } } else { var downloadUrl = window.URL.createObjectURL(new Blob([res])) var a = document.createElement('a') a.style.display = 'none' a.href = downloadUrl a.download = new Date().Format('yyyy-MM-dd hh:mm:ss') + '.xlsx' var event = new MouseEvent('click') a.dispatchEvent(event) } } // @Tags ProblemInfo // @Summary 删除ProblemInfo // @Security ApiKeyAuth // @accept application/json // @Produce application/json // @Param data body model.ProblemInfo true "删除ProblemInfo" // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" // @Router /problemInfo/deleteProblemInfo [delete] export const deleteProblemInfo = (data) => { return service({ url: '/problemInfo/deleteProblemInfo', method: 'delete', data }) } // @Tags ProblemInfo // @Summary 删除ProblemInfo // @Security ApiKeyAuth // @accept application/json // @Produce application/json // @Param data body request.IdsReq true "批量删除ProblemInfo" // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" // @Router /problemInfo/deleteProblemInfo [delete] export const deleteProblemInfoByIds = (data) => { return service({ url: '/problemInfo/deleteProblemInfoByIds', method: 'delete', data }) } // @Tags ProblemInfo // @Summary 更新ProblemInfo // @Security ApiKeyAuth // @accept application/json // @Produce application/json // @Param data body model.ProblemInfo true "更新ProblemInfo" // @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}" // @Router /problemInfo/updateProblemInfo [put] export const updateProblemInfo = (data) => { return service({ url: '/problemInfo/updateProblemInfo', method: 'put', data }) } export const updateProblemInfoAudit = (data) => { return service({ url: '/problemInfo/updateProblemInfoAudit', method: 'put', data }) } // @Tags ProblemInfo // @Summary 用id查询ProblemInfo // @Security ApiKeyAuth // @accept application/json // @Produce application/json // @Param data query model.ProblemInfo true "用id查询ProblemInfo" // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}" // @Router /problemInfo/findProblemInfo [get] export const findProblemInfo = (params) => { return service({ url: '/problemInfo/findProblemInfo', method: 'get', params }) } // @Tags ProblemInfo // @Summary 分页获取ProblemInfo列表 // @Security ApiKeyAuth // @accept application/json // @Produce application/json // @Param data query request.PageInfo true "分页获取ProblemInfo列表" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /problemInfo/getProblemInfoList [get] export const getProblemInfoList = (params) => { return service({ url: '/problemInfo/getProblemInfoList', method: 'get', params }) }