完成小区相关的接口对接
This commit is contained in:
59
src/api/system/community/index.ts
Normal file
59
src/api/system/community/index.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { communitylist_rows_type } from './type';
|
||||
|
||||
// 查询小区列表
|
||||
export function getCommunitylistAPI(): AxiosPromise<communitylist_rows_type[]> {
|
||||
return request({
|
||||
url: '/village/list',
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
/** 通过小区id获取小区信息 */
|
||||
export function getVillageByIdAPI(id: string): AxiosPromise<communitylist_rows_type> {
|
||||
return request({
|
||||
url: `/village/${id}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
/** 删除小区 */
|
||||
export function deleteVillageByIdAPI(id: number): AxiosPromise<null> {
|
||||
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<T>(data: T) {
|
||||
return request({
|
||||
url: `/village`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
/** 添加小区 */
|
||||
export function editVillageAPI<T>(data: T) {
|
||||
return request({
|
||||
url: `/village`,
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
/**切换小区 */
|
||||
export function switchVillageAPI(villageId: number) {
|
||||
return request({
|
||||
url: `/village/switchVillage/${villageId}`,
|
||||
method: 'POST'
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user