提交 26e43d31 authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 4860bfd2
......@@ -133,7 +133,7 @@ export function checkLocalFile(params: { file_name: string }) {
}
// 上传文件
export function uploadLocalFile(data: { file: File; file_name: string; is_continuingly?: number; now_package_num: number; total_package_num: number }) {
export function uploadLocalFile(data: { file: any; file_name: string; is_continuingly?: number; now_package_num: number; total_package_num: number }) {
return httpRequest.post('/api/lab/v1/common/file/upload', data, {
withCredentials: false,
headers: { 'Content-Type': 'multipart/form-data' }
......
import axios from 'axios'
import md5 from 'blueimp-md5'
import { getSignature, uploadFile } from '@/api/base'
import { getLocalFileChunk, uploadLocalFile } from '@/api/base'
export async function upload(blob: Blob) {
const key = 'upload/saas-lab/' + md5(new Date().getTime() + Math.random().toString(36).slice(-8)) + '.png'
const response: any = await getSignature()
export async function upload(file: Blob) {
const response = await getLocalFileChunk({ file_name: 'abc', file_size: file.size })
const params = {
key,
host: response.host,
OSSAccessKeyId: response.accessid,
policy: response.policy,
signature: response.signature,
success_action_status: '200',
file: blob,
url: `${response.host}/${key}`
file,
file_name: response.data.detail.file_name,
now_package_num: 1,
total_package_num: 1
}
await uploadFile(params)
return params.url
const res = await uploadLocalFile(params)
return res.data.detail.uri
}
export async function uploadFileByUrl(url: string) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论