import request from '/@/utils/request';

/**
 * 分页查询获奖活动信息列表
 * @param query
 */
export const fetchList = (query?: any) => {
  return request({
    url: '/stuwork/activityawards/page',
    method: 'get',
    params: query
  });
};

/**
 * 新增获奖活动信息
 * @param data
 */
export const addObj = (data: any) => {
  return request({
    url: '/stuwork/activityawards',
    method: 'post',
    data
  });
};

/**
 * 获取详情
 * @param id
 */
export const getDetail = (id: string) => {
  return request({
    url: `/stuwork/activityawards/${id}`,
    method: 'get'
  });
};

/**
 * 编辑获奖活动信息
 * @param data
 */
export const editObj = (data: any) => {
  return request({
    url: '/stuwork/activityawards',
    method: 'put',
    data
  });
};

/**
 * 删除获奖活动信息
 * @param ids
 */
export const delObj = (ids: string[]) => {
  return request({
    url: '/stuwork/activityawards',
    method: 'delete',
    data: ids
  });
};

/**
 * 获取活动主题列表
 */
export const getActivityInfoList = () => {
  return request({
    url: '/stuwork/activityinfo/activityInfoList',
    method: 'get'
  });
};

/**
 * 导入获奖活动信息
 * @param file 文件
 */
export const importExcel = (file: File) => {
  const formData = new FormData();
  formData.append('file', file);
  return request({
    url: '/stuwork/activityawards/import',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
};

