From 89c7ddeb37bb9355e7272f9ed2bfdeb8faabdedc Mon Sep 17 00:00:00 2001 From: zhangwei <1504152376@qq.com> Date: 星期四, 14 八月 2025 17:09:22 +0800 Subject: [PATCH] '-' --- src/api/upload/index.ts | 41 ++++++++++++++++++++++++++++++----------- 1 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/api/upload/index.ts b/src/api/upload/index.ts index de0fae2..727dbe8 100644 --- a/src/api/upload/index.ts +++ b/src/api/upload/index.ts @@ -5,19 +5,38 @@ */ import { http } from "@/utils/http"; -import { baseUrlApi } from "../util"; +import { baseUrlApi, uploadUrlApi } from "../util"; import type { Result } from "../types"; -//涓婁紶鍜岃瘑鍒惀涓氭墽鐓� -export const upBizLicense = (data?: object) => { - return http.request<Result>("post", baseUrlApi("/api/upFile/upBizLicense"), { - data - }); +// 鑾峰彇涓婁紶Token +export const getUploadToken = () => { + return http.request<Result>("get", baseUrlApi("/api/upFile/token")); }; -// 涓婁紶韬唤璇� -export const uploadIdCord = (params?: object) => { - return http.request<Result>("post", baseUrlApi("/api/upFile/uploadIdCord"), { - params - }); +export const uploadFileAli11 = (data, key) => { + return http.request<Result>( + "post", + uploadUrlApi(`/${key}`), + { data }, + { + headers: { + "Content-Type": "multipart/form-data", // 璁剧疆鍐呭绫诲瀷涓� multipart/form-data锛岃繖瀵逛簬鏂囦欢涓婁紶鏄繀椤荤殑 + "Access-Control-Allow-Origin": "*" + } + } + ); +}; + +export const uploadFileAli = (data, url) => { + return http.request<Result>( + "post", + `${url}`, + { data }, + { + headers: { + "Content-Type": "multipart/form-data", // 璁剧疆鍐呭绫诲瀷涓� multipart/form-data锛岃繖瀵逛簬鏂囦欢涓婁紶鏄繀椤荤殑 + "Access-Control-Allow-Origin": "*" + } + } + ); }; -- Gitblit v1.9.1