fix: upload-file
parent
8009263549
commit
1c8edc4299
|
@ -8,19 +8,29 @@ Page({
|
||||||
const tempFilePaths = res.tempFilePaths
|
const tempFilePaths = res.tempFilePaths
|
||||||
const files = res.tempFiles;
|
const files = res.tempFiles;
|
||||||
wx.uploadFile({
|
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],
|
filePath: tempFilePaths[0],
|
||||||
name: 'file',
|
name: 'file',
|
||||||
formData: {
|
header: {
|
||||||
'uploadFile': files[0],
|
'X-Consumer-Custom-ID': 'test',
|
||||||
},
|
},
|
||||||
success (res){
|
success: res => {
|
||||||
const data = res.data
|
// 返回文件 ID
|
||||||
//do something
|
const data = JSON.parse(res.data)
|
||||||
console.log(res);
|
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) {
|
fail({errMsg}) {
|
||||||
console.log(res);
|
console.log('uploadImage fail, errMsg is', errMsg)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue