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

/**
 * 分页查询文明班级列表
 * @param query
 */
export const fetchList = (query?: any) => {
  return request({
    url: '/stuwork/rewardclass/page',
    method: 'get',
    params: query
  });
};

/**
 * 新增文明班级
 * @param data
 */
export const addObj = (data: any) => {
  return request({
    url: '/stuwork/rewardclass',
    method: 'post',
    data
  });
};

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

/**
 * 编辑文明班级
 * @param data
 */
export const editObj = (data: any) => {
  return request({
    url: '/stuwork/rewardclass/edit',
    method: 'post',
    data
  });
};

/**
 * 删除文明班级
 * @param ids
 */
export const delObj = (ids: string[]) => {
  return request({
    url: '/stuwork/rewardclass/delete',
    method: 'post',
    data: ids
  });
};

/**
 * 导入文明班级
 * @param file
 */
export const importExcel = (file: File) => {
  const formData = new FormData();
  formData.append('file', file);
  return request({
    url: '/stuwork/rewardclass/import',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
};

