From 5e457b4afef2a65aaca4e762e3828f9e2472c077 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 23 Dec 2025 23:32:37 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=85=A8=E5=B1=80=E7=9A=84=20delet?= =?UTF-8?q?e=20=E5=B0=81=E8=A3=85=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/infra/file/index.ts | 22 ++++++++++++++++++++++ src/api/system/notify/template/index.ts | 2 +- src/http/http.ts | 5 ++++- src/pages-infra/file/detail/index.vue | 21 +++++---------------- 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/api/infra/file/index.ts b/src/api/infra/file/index.ts index 7cfcba7..fa51247 100644 --- a/src/api/infra/file/index.ts +++ b/src/api/infra/file/index.ts @@ -3,6 +3,18 @@ import { http } from '@/http/http' import { useTokenStore } from '@/store/token' import { useUserStore } from '@/store/user' +/** 文件信息 */ +export interface FileVO { + id?: number + configId?: number + path: string + name?: string + url?: string + size?: number + type?: string + createTime?: Date +} + /** 文件预签名信息 */ export interface FilePresignedUrlRespVO { configId: number // 配置编号 @@ -31,6 +43,16 @@ export function createFile(data: FileCreateReqVO) { return http.post('/infra/file/create', data) } +/** 获取文件详情 */ +export function getFile(id: number) { + return http.get(`/infra/file/get?id=${id}`) +} + +/** 删除文件 */ +export function deleteFile(id: number) { + return http.delete(`/infra/file/delete?id=${id}`) +} + /** * 上传文件到后端 * diff --git a/src/api/system/notify/template/index.ts b/src/api/system/notify/template/index.ts index e93ff73..8d6422e 100644 --- a/src/api/system/notify/template/index.ts +++ b/src/api/system/notify/template/index.ts @@ -45,7 +45,7 @@ export function updateNotifyTemplate(data: NotifyTemplate) { /** 删除站内信模板 */ export function deleteNotifyTemplate(id: number) { - return http.delete(`/system/notify-template/delete`, { id }) + return http.delete(`/system/notify-template/delete?id=${id}`) } /** 发送站内信 */ diff --git a/src/http/http.ts b/src/http/http.ts index de9d081..f134449 100644 --- a/src/http/http.ts +++ b/src/http/http.ts @@ -143,6 +143,7 @@ export function http(options: CustomRequestOptions) { * @param url 后台地址 * @param query 请求query参数 * @param header 请求头,默认为json格式 + * @param options 其他配置项 * @returns */ export function httpGet(url: string, query?: Record, header?: Record, options?: Partial) { @@ -161,6 +162,7 @@ export function httpGet(url: string, query?: Record, header?: Re * @param data 请求body参数 * @param query 请求query参数,post请求也支持query,很多微信接口都需要 * @param header 请求头,默认为json格式 + * @param options 其他配置项 * @returns */ export function httpPost(url: string, data?: Record, query?: Record, header?: Record, options?: Partial) { @@ -190,9 +192,10 @@ export function httpPut(url: string, data?: Record, query?: Reco /** * DELETE 请求(无请求体,仅 query) */ -export function httpDelete(url: string, query?: Record, header?: Record, options?: Partial) { +export function httpDelete(url: string, data?: Record, query?: Record, header?: Record, options?: Partial) { return http({ url, + data, query, method: 'DELETE', header, diff --git a/src/pages-infra/file/detail/index.vue b/src/pages-infra/file/detail/index.vue index 8b37225..a042609 100644 --- a/src/pages-infra/file/detail/index.vue +++ b/src/pages-infra/file/detail/index.vue @@ -51,26 +51,15 @@