import { request } from '../request' /** 获取所有题目列表 */ export function fetchGetQuestionListAll() { return request({ url: '/Base/ActivityMain/GetQuestionListAll', method: 'get', }) } /** 新增题目 */ export function fetchAddQuestion(data?: Api.Question.AddParams) { return request({ url: '/Base/ActivityMain/AddBase_QuestionList', method: 'post', data: data || {}, }) } /** 更新题目 */ export function fetchUpdateQuestion(data?: Api.Question.AddParams) { return request({ url: '/Base/ActivityMain/UpdateQuestionList', method: 'post', data: data || {}, }) } /** 删除题目 */ export function fetchDeleteQuestion(id: number) { return request({ url: `/Base/ActivityMain/DeleteQuestionList/?Id=${id}`, method: 'post', }) } /** 获取所有问题库列表(分页) */ export function fetchGetQuestionLibraryListAll(params: Api.Question.GetQuestionLibraryListAllParams) { return request({ url: '/Base/ActivityMain/GetQuestionListDetail', method: 'get', params: { QuestionId: params.questionId, PageIndex: params.pageIndex, PageSizes: params.pageSizes, keyWords: params.keyWords, }, }) } /** 新增一条问题库 */ export function fetchAddQuestionLibrary(params: Api.Question.AddQuestionLibraryParams, file?: File | null) { const formData = new FormData() if (file) { formData.append('Image', file) } return request({ url: '/Base/ActivityMain/AddQuestionListDetail', method: 'post', // params: { // QuestionId: params.questionId, // Name: params.name, // Answer: params.answer, // Type: params.type, // IsGood: params.IsGood, // ImageUrl: params.imageUrl, // }, data: { QuestionId: params.questionId, Name: params.name, Answer: params.answer, Type: params.type, IsGood: params.IsGood, ImageUrl: params.imageUrl, IsDisabled: params.IsDisabled, }, }) } /** 禁用/启用 一条问题库 */ export function fetchDisableQuestionLibrary(params: Api.Question.DisableQuestionLibraryParams[]) { return request({ url: '/Base/ActivityMain/UpdateQuestionListDetailList', method: 'post', data: params, }) } /** 更新一条问题库 */ export function fetchUpdateQuestionLibrary(params: Api.Question.AddQuestionLibraryParams, file?: File | null) { const formData = new FormData() if (file) { formData.append('Image', file) } return request({ url: '/Base/ActivityMain/UpdateQuestionListDetail', method: 'post', // params: { // Id: params.id, // QuestionId: params.questionId, // Name: params.name, // Answer: params.answer, // Type: params.type, // IsGood: params.IsGood, // ImageUrl: params.imageUrl, // }, data: { Id: params.id, QuestionId: params.questionId, Name: params.name, Answer: params.answer, Type: params.type, IsGood: params.IsGood, ImageUrl: params.imageUrl, IsDisabled: params.IsDisabled, }, }) } /** 删除一条问题库 */ export function fetchDeleteQuestionLibrary(ids: number[]) { return request({ url: `/Base/ActivityMain/DeleteQuestionListDetail`, method: 'post', data: ids, }) }