Compare commits
No commits in common. "a0cab6f7631ce8d26e8fb180bbd12b3055af7eb5" and "c078fa081ee4bfad02181caa97f380dd545b8c0e" have entirely different histories.
a0cab6f763
...
c078fa081e
@ -1,52 +1,57 @@
|
|||||||
import { getEnvBaseUrl } from '@/utils'
|
import { getEnvBaseUrl } from '@/utils'
|
||||||
import { httpPost } from '@/utils/http'
|
import {httpPost} from "@/utils/http"
|
||||||
// import { TOKEN } from './test';
|
import { TOKEN } from './test';
|
||||||
import { apis, uploadFile } from '@/utils/tools'
|
import {apis,uploadFile} from "@/utils/tools"
|
||||||
const baseUrl = getEnvBaseUrl()
|
const baseUrl = getEnvBaseUrl();
|
||||||
|
|
||||||
// /artwork/get-chunk-list 获取文件分断数据
|
// /artwork/get-chunk-list 获取文件分断数据
|
||||||
// /artwork/upload-chunk 分断上传画作图片
|
// /artwork/upload-chunk 分断上传画作图片
|
||||||
export const uploadFiles = (url, params) => {
|
export const uploadFiles = (url,params)=>{
|
||||||
let token = uni.getStorageSync('authorization')
|
let token = uni.getStorageSync('authorization');
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: baseUrl + url,
|
url: baseUrl+url,
|
||||||
filePath: params.tempFilePath,
|
filePath: params.tempFilePath,
|
||||||
name: 'Chunk',
|
name: "Chunk",
|
||||||
formData: params.formData,
|
formData:params.formData,
|
||||||
header: {
|
header: {
|
||||||
authorization: token,
|
'authorization': token,
|
||||||
},
|
|
||||||
complete: (res) => {
|
|
||||||
// console.log('res: ',res);
|
|
||||||
if (res.statusCode == 200) {
|
|
||||||
resolve(res)
|
|
||||||
} else {
|
|
||||||
reject(res)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
complete: (res) => {
|
||||||
|
// console.log('res: ',res);
|
||||||
|
if(res.statusCode == 200) {
|
||||||
|
resolve(res)
|
||||||
|
} else {
|
||||||
|
reject(res)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const getChunkList = (file) => {
|
const getChunkList=(file)=>{
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve,reject)=>{
|
||||||
uni.request({
|
uni.request({
|
||||||
url: baseUrl + '/artwork/get-chunk-list',
|
url:baseUrl+"/artwork/get-chunk-list",
|
||||||
data: file,
|
data:file,
|
||||||
header: {
|
header:{
|
||||||
'Content-Type': 'application/json', //"multipart/form-data"
|
"Content-Type":"application/json", //"multipart/form-data"
|
||||||
},
|
},
|
||||||
success(res) {
|
success(res){
|
||||||
resolve(res)
|
resolve(res)
|
||||||
},
|
},
|
||||||
fail(rej) {
|
fail(rej){
|
||||||
reject(Jrej)
|
reject(Jrej)
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const uploadFileChunk = (data) => {
|
export const uploadFileChunk=(data)=>{
|
||||||
let token = uni.getStorageSync('authorization')
|
const header={
|
||||||
return uploadFiles('/artwork/upload-chunk', data)
|
authorization:TOKEN
|
||||||
|
}
|
||||||
|
let token = uni.getStorageSync('authorization');
|
||||||
|
return uploadFiles('/artwork/upload-chunk',data)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user