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

/**
 * 分页查询在线书列表
 * @param query
 */
export const fetchList = (query?: any) => {
  return request({
    url: '/stuwork/onlinebooks/page',
    method: 'get',
    params: query
  });
};

/**
 * 获取在线书列表（用于下拉选择）
 * @param query
 */
export const getList = (query?: any) => {
  return request({
    url: '/stuwork/onlinebooks/list',
    method: 'get',
    params: query
  });
};

/**
 * 新增在线书
 * @param data
 */
export const addObj = (data: any) => {
  return request({
    url: '/stuwork/onlinebooks',
    method: 'post',
    data
  });
};

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

/**
 * 编辑在线书
 * @param data
 */
export const editObj = (data: any) => {
  return request({
    url: '/stuwork/onlinebooks/edit',
    method: 'post',
    data
  });
};

/**
 * 删除在线书
 * @param ids
 */
export const delObj = (ids: string[]) => {
  return request({
    url: '/stuwork/onlinebooks/delete',
    method: 'post',
    data: ids
  });
};

