const onFinish=async(value:any)=>{//提交
let data = await value.slideshowUrl;//图片
if (Array.isArray(data)) {//判断是否有图片
return data;
}
const formData = new FormData();//先new一个FormData
formData.append("file",data.fileList[0].originFileObj);//data.fileList[0]这个你图片的数组,originFileObj必填这个
formData.append("fileSource","APPLET");
let config:AxiosRequestConfig={};
config.headers={};
config.headers["Content-Type"]="multipart/form-data";//上传格式multipart/form-data
let up:any=await Https.post(ApiUrl.uploadFile,formData,config)
let param:any={
fileIdList:[up]
}
if(up!==""){
let fileIdList:any=await Https.post(ApiUrl.fileIdList,param)
let webUrlMap:any;
for(var i in fileIdList.webUrlMap) {
webUrlMap=fileIdList.webUrlMap[i]
}
let params:any={};
params.slideshowName=value.slideshowName;
params.description=value.description;
params.slideshowUrl=webUrlMap;
params.position=value.position;
params.isEnable=value.isEnable;
params.jumpType=value.jumpType;
params.jumpUrl=value.jumpUrl;
await Https.post(ApiUrl.saveSlideshow,params)
}else{
return;
}
history.replace('/home/Reception/RotationChart');
}
来自好菜鸟的代码,不对之处,大神请指出!!
网友评论