Compare commits
2 Commits
c078fa081e
...
a0cab6f763
Author | SHA1 | Date | |
---|---|---|---|
a0cab6f763 | |||
f9b959f3d4 |
@ -1,57 +1,52 @@
|
|||||||
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) => {
|
||||||
const header={
|
let token = uni.getStorageSync('authorization')
|
||||||
authorization:TOKEN
|
return uploadFiles('/artwork/upload-chunk', data)
|
||||||
}
|
}
|
||||||
let token = uni.getStorageSync('authorization');
|
|
||||||
return uploadFiles('/artwork/upload-chunk',data)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user