fix: upload-file
parent
8009263549
commit
1c8edc4299
|
@ -8,19 +8,29 @@ Page({
|
|||
const tempFilePaths = res.tempFilePaths
|
||||
const files = res.tempFiles;
|
||||
wx.uploadFile({
|
||||
url: 'https://finchat-mop.finogeeks.club/api/v1/netDiskProxy/needCheckAuth/self?type=file&content={}&thumbnail=false×tamp=1581254809&uuid=12345&appid=6000133&sign=21AE06173F566598FF9A055277AA55C4', //仅为示例,非真实的接口地址
|
||||
url: 'https://finchat-mop.finogeeks.club/api/v1/netdisk/upload/self?type=file&content={}', //仅为示例,非真实的接口地址
|
||||
filePath: tempFilePaths[0],
|
||||
name: 'file',
|
||||
formData: {
|
||||
'uploadFile': files[0],
|
||||
header: {
|
||||
'X-Consumer-Custom-ID': 'test',
|
||||
},
|
||||
success (res){
|
||||
const data = res.data
|
||||
//do something
|
||||
console.log(res);
|
||||
success: res => {
|
||||
// 返回文件 ID
|
||||
const data = JSON.parse(res.data)
|
||||
console.log('uploadImage success, res is:', data)
|
||||
const url = `https://finchat-mop.finogeeks.club/api/v1/mop/netdisk/download/${data.netdiskID}`
|
||||
console.log('uploadImage success, res is:', url)
|
||||
self.setData({
|
||||
imageSrc: url
|
||||
});
|
||||
wx.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
},
|
||||
fail (res) {
|
||||
console.log(res);
|
||||
fail({errMsg}) {
|
||||
console.log('uploadImage fail, errMsg is', errMsg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue