feat: 适配首页公告卡片并完善通知公告

This commit is contained in:
2024-04-27 17:02:00 +08:00
parent 99498a3e54
commit f130d5e44d
16 changed files with 241 additions and 276 deletions

View File

@@ -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<Common.DashboardAccessTrendResp[]>(`${BASE_URL}/access/trend/${days}`)
}
/** @desc 查询公告列表 */
export function listDashboardNotice() {
return http.get<Common.DashboardNoticeResp[]>(`${BASE_URL}/notice`)
}

View File

@@ -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
}

View File

@@ -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<PageRes<System.AnnouncementResp[]>>(`${BASE_URL}`, query)
}
export function getAnnouncement(id: string) {
return http.get<System.AnnouncementResp>(`${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<number>) {
return http.del(`${BASE_URL}/${ids}`)
}

View File

@@ -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'

29
src/apis/system/notice.ts Normal file
View File

@@ -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<PageRes<System.NoticeResp[]>>(`${BASE_URL}`, query)
}
/** @desc 查询公告详情 */
export function getNotice(id: string) {
return http.get<System.NoticeResp>(`${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<number>) {
return http.del(`${BASE_URL}/${ids}`)
}

View File

@@ -119,6 +119,25 @@ export interface DeptQuery {
sort: Array<string>
}
/** 系统公告类型 */
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
}