import request from '@/utils/request'; import { AxiosPromise } from 'axios'; import { communitylist_rows_type } from './type'; // 查询小区列表 export function getCommunitylistAPI(): AxiosPromise { return request({ url: '/village/list', method: 'get' }); } /** 通过小区id获取小区信息 */ export function getVillageByIdAPI(id: number): AxiosPromise { return request({ url: `/village/${id}`, method: 'get' }); } /** 删除小区 */ export function deleteVillageByIdAPI(id: number): AxiosPromise { return request({ url: `/village/${id}`, method: 'delete' }); } /** 上传小区图片 */ export function uploadVillageImageAPI(formdata: FormData): AxiosPromise<{ fileName: string; url: string; ossId: string }[]> { return request({ url: `/village/uploadImages`, method: 'post', headers: { 'Content-Type': 'multipart/form-data' }, data: formdata }); } /** 添加小区 */ export function addVillageAPI(data: T) { return request({ url: `/village`, method: 'post', data: data }); } /** 添加小区 */ export function editVillageAPI(data: T) { return request({ url: `/village`, method: 'put', data: data }); } /**切换小区 */ export function switchVillageAPI(villageId: number) { return request({ url: `/village/switchVillage/${villageId}`, method: 'POST' }); }