From ea64beb217a91fe60374daa34741b5b4c2567a56 Mon Sep 17 00:00:00 2001 From: Wang Chen Chen <932560435@qq.com> Date: Wed, 1 Nov 2023 10:05:24 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=B0=86=20IJsonResult=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E5=88=B0=20types/api.d.ts=20=E6=96=87=E4=BB=B6=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web-ui/src/api/config.ts | 2 +- web-ui/src/api/dept.ts | 2 +- web-ui/src/api/device.ts | 2 +- web-ui/src/api/dict.ts | 2 +- web-ui/src/api/login.ts | 1 - web-ui/src/api/loginLog.ts | 2 +- web-ui/src/api/menu.ts | 2 +- web-ui/src/api/project.ts | 2 +- web-ui/src/api/role.ts | 2 +- web-ui/src/api/server.ts | 1 - web-ui/src/api/template.ts | 2 +- web-ui/src/api/tenant.ts | 2 +- web-ui/src/api/upload.ts | 1 - web-ui/src/api/user.ts | 2 +- web-ui/src/types/base.ts | 28 -------------------------- web-ui/src/views/pre/user/index.vue | 2 -- web-ui/tests/components/Notify.test.ts | 6 +----- web-ui/types/api.d.ts | 27 ++++++++++++++++++++++--- 18 files changed, 36 insertions(+), 52 deletions(-) diff --git a/web-ui/src/api/config.ts b/web-ui/src/api/config.ts index ac33f19..38525e8 100644 --- a/web-ui/src/api/config.ts +++ b/web-ui/src/api/config.ts @@ -1,4 +1,4 @@ -import { IJsonResult, IPageResult, ISearchQuery } from "@/types/base" +import { ISearchQuery } from "@/types/base" import { ISysConfig } from "@/types/sys" import { httpDelete, httpGet, httpPost, httpPut } from "@/utils/service" diff --git a/web-ui/src/api/dept.ts b/web-ui/src/api/dept.ts index 15d5b0a..747400c 100644 --- a/web-ui/src/api/dept.ts +++ b/web-ui/src/api/dept.ts @@ -1,4 +1,4 @@ -import { IJsonResult, IPageResult, ISearchQuery } from "@/types/base" +import { ISearchQuery } from "@/types/base" import { IPmsDept } from "@/types/pms" import { httpDelete, httpGet, httpPost, httpPut } from "@/utils/service" diff --git a/web-ui/src/api/device.ts b/web-ui/src/api/device.ts index b39ccd9..f631766 100644 --- a/web-ui/src/api/device.ts +++ b/web-ui/src/api/device.ts @@ -1,4 +1,4 @@ -import { IJsonResult, IPageResult, ISearchQuery } from "@/types/base" +import { ISearchQuery } from "@/types/base" import { ICmsDevice } from "@/types/cms" import { httpDelete, httpGet, httpPost, httpPut } from "@/utils/service" diff --git a/web-ui/src/api/dict.ts b/web-ui/src/api/dict.ts index f33d568..89adc77 100644 --- a/web-ui/src/api/dict.ts +++ b/web-ui/src/api/dict.ts @@ -1,4 +1,4 @@ -import { IJsonResult, IPageResult, ISearchQuery } from "@/types/base" +import { ISearchQuery } from "@/types/base" import { httpDelete, httpGet, httpPost, httpPut } from "@/utils/service" import { IMapDictData, IDictType, IDictData, IDictSearchQuery } from "@/types/dict" diff --git a/web-ui/src/api/login.ts b/web-ui/src/api/login.ts index 08568b4..73775e7 100644 --- a/web-ui/src/api/login.ts +++ b/web-ui/src/api/login.ts @@ -1,4 +1,3 @@ -import { IJsonResult } from "@/types/base" import { ILoginData, ILoginUserInfo, IOAuth2Token, IUserPerms } from "@/types/pms" import { httpGet, httpPost } from "@/utils/service" diff --git a/web-ui/src/api/loginLog.ts b/web-ui/src/api/loginLog.ts index c197bf6..43be5a7 100644 --- a/web-ui/src/api/loginLog.ts +++ b/web-ui/src/api/loginLog.ts @@ -1,4 +1,4 @@ -import { IJsonResult, IPageResult, ISearchQuery } from "@/types/base" +import { ISearchQuery } from "@/types/base" import { ILoginLog, IOperLog } from "@/types/lms" import { httpPost, httpGet } from "@/utils/service" diff --git a/web-ui/src/api/menu.ts b/web-ui/src/api/menu.ts index ba39225..449ea3f 100644 --- a/web-ui/src/api/menu.ts +++ b/web-ui/src/api/menu.ts @@ -1,4 +1,4 @@ -import { IJsonResult, IPageResult, ISearchQuery } from "@/types/base" +import { ISearchQuery } from "@/types/base" import { ISysMenu } from "@/types/pms" import { httpDelete, httpGet, httpPost, httpPut } from "@/utils/service" diff --git a/web-ui/src/api/project.ts b/web-ui/src/api/project.ts index 3c8c956..c710fc2 100644 --- a/web-ui/src/api/project.ts +++ b/web-ui/src/api/project.ts @@ -1,4 +1,4 @@ -import { IJsonResult, IPageResult, ISearchQuery, ISimpleProject } from "@/types/base" +import { ISearchQuery, ISimpleProject } from "@/types/base" import { ICmsProject } from "@/types/cms" import { httpDelete, httpGet, httpPost, httpPut } from "@/utils/service" diff --git a/web-ui/src/api/role.ts b/web-ui/src/api/role.ts index 06bf7a5..05c2418 100644 --- a/web-ui/src/api/role.ts +++ b/web-ui/src/api/role.ts @@ -1,4 +1,4 @@ -import { IJsonResult, IPageResult, ISearchQuery, IUpdateMenus } from "@/types/base" +import { ISearchQuery, IUpdateMenus } from "@/types/base" import { IPmsRole } from "@/types/pms" import { httpDelete, httpGet, httpPost, httpPut } from "@/utils/service" diff --git a/web-ui/src/api/server.ts b/web-ui/src/api/server.ts index 07ee51d..4d8c92c 100644 --- a/web-ui/src/api/server.ts +++ b/web-ui/src/api/server.ts @@ -1,4 +1,3 @@ -import { IJsonResult } from "@/types/base" import { IServerInfo } from "@/types/sys" import { httpGet } from "@/utils/service" diff --git a/web-ui/src/api/template.ts b/web-ui/src/api/template.ts index 73253af..a69ff58 100644 --- a/web-ui/src/api/template.ts +++ b/web-ui/src/api/template.ts @@ -1,4 +1,4 @@ -import { IJsonResult, IPageResult, ISearchQuery, IUpdateMenus } from "@/types/base" +import { ISearchQuery, IUpdateMenus } from "@/types/base" import { ISysTemplate } from "@/types/sys" import { httpDelete, httpGet, httpPost, httpPut } from "@/utils/service" diff --git a/web-ui/src/api/tenant.ts b/web-ui/src/api/tenant.ts index 61894e7..f60333e 100644 --- a/web-ui/src/api/tenant.ts +++ b/web-ui/src/api/tenant.ts @@ -1,4 +1,4 @@ -import { IJsonResult, IPageResult, ISearchQuery, ISimpleTenant } from "@/types/base" +import { ISearchQuery, ISimpleTenant } from "@/types/base" import { ISysTenant, ICreateTenant, ICreateTenantAdmin } from "@/types/sys" import { httpDelete, httpGet, httpPost, httpPut } from "@/utils/service" diff --git a/web-ui/src/api/upload.ts b/web-ui/src/api/upload.ts index c84a033..fa9e9e1 100644 --- a/web-ui/src/api/upload.ts +++ b/web-ui/src/api/upload.ts @@ -1,4 +1,3 @@ -import { IJsonResult } from "@/types/base" import { httpDelete } from "@/utils/service" // 删除 oss 上的图片 diff --git a/web-ui/src/api/user.ts b/web-ui/src/api/user.ts index 07ff231..ec40a06 100644 --- a/web-ui/src/api/user.ts +++ b/web-ui/src/api/user.ts @@ -1,4 +1,4 @@ -import { IJsonResult, IPageResult, ISearchQuery } from "@/types/base" +import { ISearchQuery } from "@/types/base" import { IPmsUser, IUserListTenant } from "@/types/pms" import { httpPost, httpPut, httpGet, httpDelete } from "@/utils/service" diff --git a/web-ui/src/types/base.ts b/web-ui/src/types/base.ts index 733eadb..4b23da9 100644 --- a/web-ui/src/types/base.ts +++ b/web-ui/src/types/base.ts @@ -1,31 +1,3 @@ -// json 返回值 -export interface IJsonResult { - /* 状态码 200: 成功! 100: 失败! 其他: 都是报错! */ - status: number - /* 返回消息 */ - message: string - /* 数据 */ - data: T -} - -// 分页 -export interface IPagination { - /* 总页数 */ - total: number - /* 数据列表 */ - list: T[] -} - -// 分页 返回值 -export interface IPageResult { - /* 状态码 200: 成功! 100: 失败! 其他: 都是报错! */ - status: number - /* 返回消息 */ - message: string - /* 分页数据 */ - data: IPagination -} - // 搜索分页查询 export interface ISearchQuery { // 包含操作用户信息 diff --git a/web-ui/src/views/pre/user/index.vue b/web-ui/src/views/pre/user/index.vue index 62e23b1..f9d1179 100644 --- a/web-ui/src/views/pre/user/index.vue +++ b/web-ui/src/views/pre/user/index.vue @@ -313,8 +313,6 @@ import { cloneDeep } from "lodash-es" // 判读 当前选中的租户是否 默认租户 const { isDefaultTenantId } = useTenantStoreHook() -console.log("isDefaultTenantId() :>>", isDefaultTenantId()) - const dictStore = useDictStoreHook() /** 加载 */ diff --git a/web-ui/tests/components/Notify.test.ts b/web-ui/tests/components/Notify.test.ts index 1c82fa8..bc0aab7 100644 --- a/web-ui/tests/components/Notify.test.ts +++ b/web-ui/tests/components/Notify.test.ts @@ -22,11 +22,7 @@ describe("NotifyList", () => { it("List 长度不为 0", () => { const wrapper = shallowMount(NotifyList, { props: { - list: [ - { - title: "" - } - ] + list: [] } }) expect(wrapper.find("el-empty").exists()).toBe(false) diff --git a/web-ui/types/api.d.ts b/web-ui/types/api.d.ts index e20fee0..8529c5c 100644 --- a/web-ui/types/api.d.ts +++ b/web-ui/types/api.d.ts @@ -1,6 +1,27 @@ -/** 所有 api 接口的响应数据都应该准守该格式 */ -interface ApiResponseData { +// json 返回值 +interface IJsonResult { + /* 状态码 200: 成功! 100: 失败! 其他: 都是报错! */ status: number - data: T + /* 返回消息 */ message: string + /* 数据 */ + data: T +} + +// 分页 +interface IPagination { + /* 总页数 */ + total: number + /* 数据列表 */ + list: T[] +} + +// 分页 返回值 +interface IPageResult { + /* 状态码 200: 成功! 100: 失败! 其他: 都是报错! */ + status: number + /* 返回消息 */ + message: string + /* 分页数据 */ + data: IPagination }