diff --git a/src/api/list.ts b/src/api/list.ts index e361bcfbc..4015486f0 100644 --- a/src/api/list.ts +++ b/src/api/list.ts @@ -1,12 +1,15 @@ import { http } from "../utils/http"; -interface postType extends Promise { - data?: object; +type Result = { + data?: { + /** 列表数据 */ + list: Array; + }; code?: number; msg?: string; -} +}; // 卡片列表 -export const getCardList = (data?: object): postType => { - return http.request("post", "/getCardList", { data }); +export const getCardList = (data?: object) => { + return http.request("post", "/getCardList", { data }); }; diff --git a/src/api/mock.ts b/src/api/mock.ts index 93b437275..8207debfe 100644 --- a/src/api/mock.ts +++ b/src/api/mock.ts @@ -1,6 +1,11 @@ import { http } from "../utils/http"; +type Result = { + code: number; + info: Array; +}; + // 地图数据 export const mapJson = (params?: object) => { - return http.request("get", "/getMapInfo", { params }); + return http.request("get", "/getMapInfo", { params }); }; diff --git a/src/api/system.ts b/src/api/system.ts index 4dcd15f46..a5904e72d 100644 --- a/src/api/system.ts +++ b/src/api/system.ts @@ -1,22 +1,27 @@ import { http } from "../utils/http"; -interface ResponseType extends Promise { - data?: object; +type Result = { + data?: { + /** 列表数据 */ + list: Array; + /** 总数 */ + total: number; + }; code?: number; msg?: string; -} +}; // 获取用户管理列表 -export const getUserList = (data?: object): ResponseType => { - return http.request("post", "/user", { data }); +export const getUserList = (data?: object) => { + return http.request("post", "/user", { data }); }; // 获取角色管理列表 -export const getRoleList = (data?: object): ResponseType => { - return http.request("post", "/role", { data }); +export const getRoleList = (data?: object) => { + return http.request("post", "/role", { data }); }; // 获取部门管理列表 -export const getDeptList = (data?: object): ResponseType => { - return http.request("post", "/dept", { data }); +export const getDeptList = (data?: object) => { + return http.request("post", "/dept", { data }); }; diff --git a/src/api/user.ts b/src/api/user.ts index a9bac54d0..5492f3d57 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -1,14 +1,14 @@ import { http } from "../utils/http"; -interface userType extends Promise { +type Result = { svg?: string; code?: number; info?: object; -} +}; // 获取验证码 -export const getVerify = (): userType => { - return http.request("get", "/captcha"); +export const getVerify = () => { + return http.request("get", "/captcha"); }; // 登录 diff --git a/src/components/ReMap/src/Amap.vue b/src/components/ReMap/src/Amap.vue index d62423fc6..e4a341514 100644 --- a/src/components/ReMap/src/Amap.vue +++ b/src/components/ReMap/src/Amap.vue @@ -19,10 +19,6 @@ defineOptions({ name: "Amap" }); -type resultType = { - info: Array; -}; - let MarkerCluster; let map: MapConfigureInter; @@ -96,8 +92,8 @@ onBeforeMount(() => { // 获取模拟车辆信息 mapJson() - .then((res: resultType) => { - let points: object = res.info.map((v: any) => { + .then(({ info }) => { + let points: object = info.map(v => { return { lnglat: [v.lng, v.lat], ...v diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index 619e64fb0..4a235663f 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -1,8 +1,8 @@