From f130d5e44d078f33ad388026ea64ba2e57fe41ee Mon Sep 17 00:00:00 2001 From: Charles7c Date: Sat, 27 Apr 2024 17:02:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=82=E9=85=8D=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E5=85=AC=E5=91=8A=E5=8D=A1=E7=89=87=E5=B9=B6=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=85=AC=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/common/home.ts | 7 +- src/apis/common/type.ts | 9 +- src/apis/system/announcement.ts | 24 ---- src/apis/system/index.ts | 2 +- src/apis/system/notice.ts | 29 +++++ src/apis/system/type.ts | 42 +++---- .../components/HeaderRightBar/Message.vue | 23 +--- src/views/home/components/AccessTrendCard.vue | 4 +- src/views/home/components/NoticeCard.vue | 51 ++++++-- src/views/system/dict/DictAddModal.vue | 4 +- src/views/system/dict/index.vue | 1 - src/views/system/file/main/FileAside.vue | 31 ----- .../notice/AnnouncementDetailDrawer.vue | 50 -------- ...ncementAddModal.vue => NoticeAddModal.vue} | 51 +++----- src/views/system/notice/NoticeDetailModal.vue | 71 +++++++++++ src/views/system/notice/index.vue | 118 ++++++------------ 16 files changed, 241 insertions(+), 276 deletions(-) delete mode 100644 src/apis/system/announcement.ts create mode 100644 src/apis/system/notice.ts delete mode 100644 src/views/system/notice/AnnouncementDetailDrawer.vue rename src/views/system/notice/{AnnouncementAddModal.vue => NoticeAddModal.vue} (77%) create mode 100644 src/views/system/notice/NoticeDetailModal.vue diff --git a/src/apis/common/home.ts b/src/apis/common/home.ts index efbae9d..e2849ae 100644 --- a/src/apis/common/home.ts +++ b/src/apis/common/home.ts @@ -4,6 +4,11 @@ import type * as Common from './type' const BASE_URL = '/dashboard' /** @desc 查询访问趋势 */ -export function listAccessTrend(days: number) { +export function listDashboardAccessTrend(days: number) { return http.get(`${BASE_URL}/access/trend/${days}`) } + +/** @desc 查询公告列表 */ +export function listDashboardNotice() { + return http.get(`${BASE_URL}/notice`) +} diff --git a/src/apis/common/type.ts b/src/apis/common/type.ts index 35b1516..a5418f4 100644 --- a/src/apis/common/type.ts +++ b/src/apis/common/type.ts @@ -4,9 +4,16 @@ export interface ImageCaptchaResp { img: string } -/** 仪表盘访问趋势 */ +/** 仪表盘访问趋势类型 */ export interface DashboardAccessTrendResp { date: string pvCount: number ipCount: number } + +/** 仪表盘公告类型 */ +export interface DashboardNoticeResp { + id: number + title: string + type: number +} diff --git a/src/apis/system/announcement.ts b/src/apis/system/announcement.ts deleted file mode 100644 index a4777d4..0000000 --- a/src/apis/system/announcement.ts +++ /dev/null @@ -1,24 +0,0 @@ -import http from '@/utils/http' -import type * as System from './type' - -const BASE_URL = '/system/announcement' - -export function listAnnouncement(query: System.AnnouncementQuery) { - return http.get>(`${BASE_URL}`, query) -} - -export function getAnnouncement(id: string) { - return http.get(`${BASE_URL}/${id}`) -} - -export function addAnnouncement(req: any) { - return http.post(BASE_URL, req) -} - -export function updateAnnouncement(req: any, id: string) { - return http.put(`${BASE_URL}/${id}`, req) -} - -export function delAnnouncement(ids: string | Array) { - return http.del(`${BASE_URL}/${ids}`) -} diff --git a/src/apis/system/index.ts b/src/apis/system/index.ts index 6f38158..27d9408 100644 --- a/src/apis/system/index.ts +++ b/src/apis/system/index.ts @@ -2,7 +2,7 @@ export * from './user' export * from './role' export * from './menu' export * from './dept' -export * from './announcement' +export * from './notice' export * from './dict' export * from './file' export * from './storage' diff --git a/src/apis/system/notice.ts b/src/apis/system/notice.ts new file mode 100644 index 0000000..fd1e01d --- /dev/null +++ b/src/apis/system/notice.ts @@ -0,0 +1,29 @@ +import http from '@/utils/http' +import type * as System from './type' + +const BASE_URL = '/system/notice' + +/** @desc 查询公告列表 */ +export function listNotice(query: System.NoticeQuery) { + return http.get>(`${BASE_URL}`, query) +} + +/** @desc 查询公告详情 */ +export function getNotice(id: string) { + return http.get(`${BASE_URL}/${id}`) +} + +/** @desc 新增公告 */ +export function addNotice(data: any) { + return http.post(BASE_URL, data) +} + +/** @desc 修改公告 */ +export function updateNotice(data: any, id: string) { + return http.put(`${BASE_URL}/${id}`, data) +} + +/** @desc 删除公告 */ +export function deleteNotice(ids: string | Array) { + return http.del(`${BASE_URL}/${ids}`) +} diff --git a/src/apis/system/type.ts b/src/apis/system/type.ts index 5ba611d..5fe20ab 100644 --- a/src/apis/system/type.ts +++ b/src/apis/system/type.ts @@ -119,6 +119,25 @@ export interface DeptQuery { sort: Array } +/** 系统公告类型 */ +export interface NoticeResp { + id: string + title: string + content: string + status: number + type: string + effectiveTime: string + terminateTime: string + createUserString: string + createTime: string + updateUserString: string + updateTime: string +} +export interface NoticeQuery extends PageQuery { + title?: string + type?: string +} + /** 系统字典类型 */ export interface DictResp { id: string @@ -222,26 +241,3 @@ export interface BindSocialAccountRes { source: string description: string } - -/** 公告类型 */ -export interface AnnouncementResp { - id: string - title: string - content: string - status: number - type?: string - effectiveTime?: string - terminateTime?: string - createUser: string - createTime: string - updateUser: string - updateTime: string - createUserString: string - updateUserString: string -} - -export interface AnnouncementQuery extends PageQuery { - title?: string - status?: number - type?: string -} diff --git a/src/layout/components/HeaderRightBar/Message.vue b/src/layout/components/HeaderRightBar/Message.vue index 899d0ce..8b46697 100644 --- a/src/layout/components/HeaderRightBar/Message.vue +++ b/src/layout/components/HeaderRightBar/Message.vue @@ -1,13 +1,13 @@ diff --git a/src/views/system/dict/DictAddModal.vue b/src/views/system/dict/DictAddModal.vue index 1ec8ee6..514fd71 100644 --- a/src/views/system/dict/DictAddModal.vue +++ b/src/views/system/dict/DictAddModal.vue @@ -74,9 +74,9 @@ const onUpdate = async (id: string) => { // 保存 const save = async () => { + const isInvalid = await formRef.value?.formRef?.validate() + if (isInvalid) return false try { - const isInvalid = await formRef.value?.formRef?.validate() - if (isInvalid) return false if (isUpdate.value) { await updateDict(form, dataId.value) Message.success('修改成功') diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index 8d27a66..3696422 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -2,7 +2,6 @@
- -
- - - - - - - - - - - - -
@@ -50,13 +26,6 @@ const route = useRoute() const router = useRouter() const selectedKey = ref('0') -const filePercentList = [ - { label: '图片', value: 0.7, color: '#4F6BF6' }, - { label: '文档', value: 0.3, color: '#FFA000' }, - { label: '视频', value: 0.4, color: '#A15FDE' }, - { label: '音频', value: 0.2, color: '#FD6112' }, - { label: '其他', value: 0.5, color: '#52B852' } -] // 监听路由变化 watch( diff --git a/src/views/system/notice/AnnouncementDetailDrawer.vue b/src/views/system/notice/AnnouncementDetailDrawer.vue deleted file mode 100644 index 44b2c28..0000000 --- a/src/views/system/notice/AnnouncementDetailDrawer.vue +++ /dev/null @@ -1,50 +0,0 @@ - - - - - diff --git a/src/views/system/notice/AnnouncementAddModal.vue b/src/views/system/notice/NoticeAddModal.vue similarity index 77% rename from src/views/system/notice/AnnouncementAddModal.vue rename to src/views/system/notice/NoticeAddModal.vue index 6f53757..3e8e6d3 100644 --- a/src/views/system/notice/AnnouncementAddModal.vue +++ b/src/views/system/notice/NoticeAddModal.vue @@ -2,12 +2,11 @@ - + @@ -65,19 +64,18 @@ - + diff --git a/src/views/system/notice/NoticeDetailModal.vue b/src/views/system/notice/NoticeDetailModal.vue new file mode 100644 index 0000000..b54ebc9 --- /dev/null +++ b/src/views/system/notice/NoticeDetailModal.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/src/views/system/notice/index.vue b/src/views/system/notice/index.vue index f625991..74f99aa 100644 --- a/src/views/system/notice/index.vue +++ b/src/views/system/notice/index.vue @@ -1,7 +1,7 @@