From fb336f319c71291fa09de3e7f67f1ccfab3cb7c8 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Sat, 23 Sep 2023 15:58:40 +0800
Subject: [PATCH] 媒体搜索框
---
src/api/media.ts | 30 ++++++++++++++++++++++++++----
1 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/api/media.ts b/src/api/media.ts
index 9cf48d9..b07bc9f 100644
--- a/src/api/media.ts
+++ b/src/api/media.ts
@@ -1,5 +1,20 @@
+import { message } from 'ant-design-vue'
import request, { IPage, IWorkspaceResponse } from '/@/api/http/request'
const HTTP_PREFIX = '/media/api/v1'
+
+
+export interface MediaQueryParam{
+ subFileType?:any
+ payload?:any
+ startTime?:string
+ endTime?:string
+}
+
+
+
+
+
+
// Get Media Files
export const getMediaFiles = async function (wid: string, pagination: IPage): Promise<IWorkspaceResponse<any>> {
@@ -8,11 +23,18 @@
return result.data
}
// Download Media File
-export const downloadMediaFile = async function (workspaceId: string, fingerprint: string): Promise<any> {
- const url = `${HTTP_PREFIX}/files/${workspaceId}/file/${fingerprint}/url`
+export const downloadMediaFile = async function (workspaceId: string, fileId: string): Promise<any> {
+ const url = `${HTTP_PREFIX}/files/${workspaceId}/file/${fileId}/url`
const result = await request.get(url, { responseType: 'blob' })
- if (result.data.code) {
+ if (result.data.type === 'application/json') {
+ const reader = new FileReader()
+ reader.onload = function (e) {
+ const text = reader.result as string
+ const result = JSON.parse(text)
+ message.error(result.message)
+ }
+ reader.readAsText(result.data, 'utf-8')
+ } else {
return result.data
}
- return result
}
--
Gitblit v1.9.3