@@ -67,3 +67,17 @@ export async function post(url: string, data?: any): Promise<any> {
throw error;
});
}
+
+// 封装文件上传请求
+export async function uploadFile(url: string, data?: any): Promise<any> {
+ return instance
+ .post(url, data, {
+ headers: {
+ "Content-type": "multipart/form-data",
+ },
+ })
+ .then((response) => response.data)
+ .catch((error) => {
+ throw error;
+ });
+}