This commit is contained in:
2025-09-16 21:39:30 +08:00
parent f933b30d85
commit 3585e28594
5 changed files with 100 additions and 21 deletions

View File

@@ -1,5 +1,6 @@
import request from "../utils/request.js";
import Method from "./Method.js";
import Qiniu from "../utils/Qiniu.js";
const system = {
getData: async (params) => {
@@ -31,31 +32,26 @@ const system = {
});
})
},
uploadFile: async (file) => {
const formData = new FormData();
formData.append('file', file);
getUploadToken: async () => {
return request({
UN_AES: true,
url: '/admin/upload/upload',
method: Method.POST,
data: formData,
headers: {
'Content-Type': 'multipart/form-data; boundary=--------------------------611824495457697861278283'
}
url: `/${import.meta.env.VITE_BUILD_MODE === 'admin' ? 'admin' : 'index'}/Upload/webToken`,
method: Method.GET,
});
},
uploadFile: async (file) => {
const qiniu = await Qiniu.getInstance();
const path = await qiniu.uploadFile(file);
return {
data: path,
}
},
uploadFile2: async (file) => {
const formData = new FormData();
formData.append('file', file);
return request({
UN_AES: true,
url: '/index/upload/upload',
method: Method.POST,
data: formData,
headers: {
'Content-Type': 'multipart/form-data; boundary=--------------------------611824495457697861278283'
}
});
const qiniu = await Qiniu.getInstance();
const path = await qiniu.uploadFile(file);
return {
data: path,
}
},
}