From af460b5dc33fc38dc1a3c927c2d4fc2aef197dd7 Mon Sep 17 00:00:00 2001 From: ray <1490493387@qq.com> Date: Fri, 18 Oct 2024 22:28:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20:recycle:=20aPI=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=A0=B9=E6=8D=AE=E6=A8=A1=E5=9D=97=E5=88=92=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/{auth.ts => auth/index.ts} | 0 src/api/{codegen.ts => codegen/index.ts} | 0 src/api/dict.ts | 148 ------------------ src/api/{file.ts => file/index.ts} | 0 src/api/{ => system}/config.ts | 0 src/api/{ => system}/dept.ts | 0 src/api/{ => system}/dict-data.ts | 0 src/api/{ => system}/log.ts | 0 src/api/{ => system}/menu.ts | 0 src/api/{ => system}/notice.ts | 0 src/api/{ => system}/role.ts | 0 src/api/{ => system}/user.ts | 0 src/components/Notice/index.vue | 2 +- src/lang/package/en.ts | 2 +- src/store/index.ts | 1 + src/utils/auth.ts | 8 +- src/utils/request.ts | 7 +- src/views/codegen/index.vue | 6 +- src/views/dashboard/components/VisitTrend.vue | 2 +- src/views/dashboard/index.vue | 14 +- src/views/demo/curd/config/add.ts | 2 +- src/views/demo/curd/config/content.ts | 4 +- src/views/demo/curd/config/edit.ts | 2 +- src/views/demo/curd/config/search.ts | 2 +- src/views/demo/curd/index.vue | 10 +- .../{icon-selector.vue => icon-select.vue} | 2 +- src/views/demo/table-select/config/select.ts | 2 +- src/views/demo/upload.vue | 120 +++++++------- src/views/demo/websocket.vue | 15 +- src/views/profile/index.vue | 4 +- src/views/system/config/index.vue | 6 +- src/views/system/dept/index.vue | 6 +- src/views/system/dict/data.vue | 4 +- src/views/system/dict/index.vue | 8 +- src/views/system/log/index.vue | 4 +- src/views/system/menu/index.vue | 6 +- .../system/notice/components/NoticeDetail.vue | 2 +- src/views/system/notice/index.vue | 20 +-- src/views/system/notice/my-notice.vue | 6 +- src/views/system/role/index.vue | 12 +- src/views/system/user/dept-tree.vue | 2 +- src/views/system/user/import.vue | 2 +- src/views/system/user/index.vue | 16 +- 43 files changed, 150 insertions(+), 297 deletions(-) rename src/api/{auth.ts => auth/index.ts} (100%) rename src/api/{codegen.ts => codegen/index.ts} (100%) delete mode 100644 src/api/dict.ts rename src/api/{file.ts => file/index.ts} (100%) rename src/api/{ => system}/config.ts (100%) rename src/api/{ => system}/dept.ts (100%) rename src/api/{ => system}/dict-data.ts (100%) rename src/api/{ => system}/log.ts (100%) rename src/api/{ => system}/menu.ts (100%) rename src/api/{ => system}/notice.ts (100%) rename src/api/{ => system}/role.ts (100%) rename src/api/{ => system}/user.ts (100%) rename src/views/demo/{icon-selector.vue => icon-select.vue} (90%) diff --git a/src/api/auth.ts b/src/api/auth/index.ts similarity index 100% rename from src/api/auth.ts rename to src/api/auth/index.ts diff --git a/src/api/codegen.ts b/src/api/codegen/index.ts similarity index 100% rename from src/api/codegen.ts rename to src/api/codegen/index.ts diff --git a/src/api/dict.ts b/src/api/dict.ts deleted file mode 100644 index 9566e889..00000000 --- a/src/api/dict.ts +++ /dev/null @@ -1,148 +0,0 @@ -import request from "@/utils/request"; - -const DICT_BASE_URL = "/api/v1/dict"; - -const DictAPI = { - /** - * 获取字典分页列表 - * - * @param queryParams 查询参数 - * @returns 字典分页结果 - */ - getPage(queryParams: DictPageQuery) { - return request>({ - url: `${DICT_BASE_URL}/page`, - method: "get", - params: queryParams, - }); - }, - - /** - * 获取字典表单数据 - * - * @param id 字典ID - * @returns 字典表单数据 - */ - getFormData(id: number) { - return request>({ - url: `${DICT_BASE_URL}/${id}/form`, - method: "get", - }); - }, - - /** - * 新增字典 - * - * @param data 字典表单数据 - */ - add(data: DictForm) { - return request({ - url: `${DICT_BASE_URL}`, - method: "post", - data: data, - }); - }, - - /** - * 修改字典 - * - * @param id 字典ID - * @param data 字典表单数据 - */ - update(id: number, data: DictForm) { - return request({ - url: `${DICT_BASE_URL}/${id}`, - method: "put", - data: data, - }); - }, - - /** - * 删除字典 - * - * @param ids 字典ID,多个以英文逗号(,)分隔 - */ - deleteByIds(ids: string) { - return request({ - url: `${DICT_BASE_URL}/${ids}`, - method: "delete", - }); - }, - - /** - * 获取字典列表 - * - * @returns 字典列表 - */ - getList() { - return request({ - url: `${DICT_BASE_URL}/list`, - method: "get", - }); - }, -}; - -export default DictAPI; - -/** - * 字典查询参数 - */ -export interface DictPageQuery extends PageQuery { - /** - * 关键字(字典名称/编码) - */ - keywords?: string; - - /** - * 字典状态(1:启用,0:禁用) - */ - status?: number; -} - -/** - * 字典分页对象 - */ -export interface DictPageVO { - /** - * 字典ID - */ - id: number; - /** - * 字典名称 - */ - name: string; - /** - * 字典编码 - */ - dictCode: string; - /** - * 字典状态(1:启用,0:禁用) - */ - status: number; -} - -/** - * 字典 - */ -export interface DictForm { - /** - * 字典ID - */ - id?: number; - /** - * 字典名称 - */ - name?: string; - /** - * 字典编码 - */ - dictCode?: string; - /** - * 字典状态(1-启用,0-禁用) - */ - status?: number; - /** - * 备注 - */ - remark?: string; -} diff --git a/src/api/file.ts b/src/api/file/index.ts similarity index 100% rename from src/api/file.ts rename to src/api/file/index.ts diff --git a/src/api/config.ts b/src/api/system/config.ts similarity index 100% rename from src/api/config.ts rename to src/api/system/config.ts diff --git a/src/api/dept.ts b/src/api/system/dept.ts similarity index 100% rename from src/api/dept.ts rename to src/api/system/dept.ts diff --git a/src/api/dict-data.ts b/src/api/system/dict-data.ts similarity index 100% rename from src/api/dict-data.ts rename to src/api/system/dict-data.ts diff --git a/src/api/log.ts b/src/api/system/log.ts similarity index 100% rename from src/api/log.ts rename to src/api/system/log.ts diff --git a/src/api/menu.ts b/src/api/system/menu.ts similarity index 100% rename from src/api/menu.ts rename to src/api/system/menu.ts diff --git a/src/api/notice.ts b/src/api/system/notice.ts similarity index 100% rename from src/api/notice.ts rename to src/api/system/notice.ts diff --git a/src/api/role.ts b/src/api/system/role.ts similarity index 100% rename from src/api/role.ts rename to src/api/system/role.ts diff --git a/src/api/user.ts b/src/api/system/user.ts similarity index 100% rename from src/api/user.ts rename to src/api/system/user.ts diff --git a/src/components/Notice/index.vue b/src/components/Notice/index.vue index 5e3a9f0e..e0a3b271 100644 --- a/src/components/Notice/index.vue +++ b/src/components/Notice/index.vue @@ -184,7 +184,7 @@ - diff --git a/src/views/demo/websocket.vue b/src/views/demo/websocket.vue index 9d585ba1..75bf366b 100644 --- a/src/views/demo/websocket.vue +++ b/src/views/demo/websocket.vue @@ -77,17 +77,18 @@ :class="{ 'tip-message': message.type === 'tip', message: message.type !== 'tip', - 'message--sent': message.sender === userStore.user.username, - 'message--received': message.sender !== userStore.user.username, + 'message--sent': message.sender === userStore.userInfo.username, + 'message--received': + message.sender !== userStore.userInfo.username, }" >
{{ message.sender }} @@ -131,7 +132,7 @@ const queneMessage = ref( "hi , " + receiver.value + " , 我是" + - userStore.user.username + + userStore.userInfo.username + " , 想和你交个朋友 ! " ); @@ -206,7 +207,7 @@ function sendToAll() { body: topicMessage.value, }); messages.value.push({ - sender: userStore.user.username, + sender: userStore.userInfo.username, content: topicMessage.value, }); } @@ -219,7 +220,7 @@ function sendToUser() { body: queneMessage.value, }); messages.value.push({ - sender: userStore.user.username, + sender: userStore.userInfo.username, content: queneMessage.value, }); } diff --git a/src/views/profile/index.vue b/src/views/profile/index.vue index fbf68c1c..0fbc29aa 100644 --- a/src/views/profile/index.vue +++ b/src/views/profile/index.vue @@ -190,7 +190,7 @@ - + @@ -300,7 +300,7 @@ import UserAPI, { MobileBindingForm, EmailBindingForm, UserProfileForm, -} from "@/api/user"; +} from "@/api/system/user"; import FileAPI from "@/api/file"; diff --git a/src/views/system/config/index.vue b/src/views/system/config/index.vue index f60215ed..ac099608 100644 --- a/src/views/system/config/index.vue +++ b/src/views/system/config/index.vue @@ -1,7 +1,7 @@