删除方法判断还没上传成功时报错问题

dev_aliyun_beta
杨树明 6 years ago
parent a3c928a804
commit 0b43367fa9

@ -320,10 +320,13 @@ class CommonWorkPost extends Component{
// ModalSave: ()=>this.deleteAttachment(file), // ModalSave: ()=>this.deleteAttachment(file),
// ModalCancel:this.cancelAttachment // ModalCancel:this.cancelAttachment
// }) // })
if(file.response!=undefined){
this.deleteAttachment(file) this.deleteAttachment(file)
return false; return false;
} }
}
cancelAttachment=()=>{ cancelAttachment=()=>{
this.setState({ this.setState({
Modalstype:false, Modalstype:false,

@ -243,6 +243,7 @@ class NewWork extends Component{
} }
onAttachmentRemove = (file, stateName) => { onAttachmentRemove = (file, stateName) => {
if(file.response!=undefined){
this.props.confirm({ this.props.confirm({
content: '是否确认删除?', content: '是否确认删除?',
@ -257,6 +258,8 @@ class NewWork extends Component{
return false; return false;
} }
}
deleteAttachment = (file, stateName) => { deleteAttachment = (file, stateName) => {
// 初次上传不能直接取uid // 初次上传不能直接取uid
const url = `/attachments/${file.response ? file.response.id : file.uid}.json` const url = `/attachments/${file.response ? file.response.id : file.uid}.json`

@ -73,9 +73,10 @@ class AccessoryModal extends Component{
// ModalCancel:this.cancelAttachment // ModalCancel:this.cancelAttachment
// }) // })
// return false; // return false;
if(file.response!=undefined){
this.deleteAttachment(file); this.deleteAttachment(file);
} }
}

@ -64,10 +64,12 @@ class AccessoryModal2 extends Component{
// ModalCancel:this.cancelAttachment // ModalCancel:this.cancelAttachment
// }) // })
// return false; // return false;
if(file.response!=undefined){
this.deleteAttachment(file); this.deleteAttachment(file);
} }
}

@ -296,8 +296,7 @@ class Selectsetting extends Component{
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
if(file.response!=undefined){
// const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
const url = `/attachments/${file.response ? file.response.id : file.uid}.json` const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, { axios.delete(url, {
}) })
@ -328,6 +327,9 @@ class Selectsetting extends Component{
fileListtype:false, fileListtype:false,
}) })
} }
// const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
}
onChangeTimepublishs= (date, dateString,key) => { onChangeTimepublishs= (date, dateString,key) => {
let {course_groups}=this.state; let {course_groups}=this.state;

@ -132,7 +132,7 @@ class Sendresource extends Component{
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
debugger if(file.response!=undefined){
const url = `/attachments/${file.response ? file.response.id : file.uid}.json` const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, { axios.delete(url, {
}) })
@ -155,6 +155,7 @@ debugger
fileListtype:false, fileListtype:false,
}) })
} }
}
ModalCancelModalCancel=()=>{ ModalCancelModalCancel=()=>{
this.setState({ this.setState({

@ -157,6 +157,7 @@ class GraduationTasksSubmitedit extends Component{
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
if(file.response!=undefined){
let {attachments,fileList}=this.state; let {attachments,fileList}=this.state;
const url = `/attachments/${file}.json` const url = `/attachments/${file}.json`
axios.delete(url, { axios.delete(url, {
@ -202,6 +203,8 @@ class GraduationTasksSubmitedit extends Component{
}); });
} }
}
inputSearchValue=(e)=>{ inputSearchValue=(e)=>{
if(e.target.value===""){ if(e.target.value===""){

@ -146,7 +146,7 @@ class GraduationTasksSubmitnew extends Component{
// }, // },
// }); // });
// return false; // return false;
if(file.response!=undefined){
this.setState({ this.setState({
Modalstype:true, Modalstype:true,
Modalstopval:'确定要删除这个附件吗?', Modalstopval:'确定要删除这个附件吗?',
@ -156,6 +156,8 @@ class GraduationTasksSubmitnew extends Component{
return false; return false;
} }
}
cancelAttachment=()=>{ cancelAttachment=()=>{
this.setState({ this.setState({
Modalstype:false, Modalstype:false,

@ -173,6 +173,7 @@ class GraduationTasksnew extends Component {
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
if(file.response!=undefined){
const url = `/attachments/${file.response ? file.response.id : file.uid}.json` const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
// const url = `/attachments/${file}.json` // const url = `/attachments/${file}.json`
axios.delete(url, {}) axios.delete(url, {})
@ -199,6 +200,8 @@ class GraduationTasksnew extends Component {
}); });
} }
}
//滚动 //滚动
ifHasAnchorJustScorll() { ifHasAnchorJustScorll() {
// let anchor = this.getURLStuff("anchor"); // let anchor = this.getURLStuff("anchor");

@ -73,6 +73,7 @@ class CreateGroupByImportModal extends Component{
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
if(file.response!=undefined){
this.props.confirm({ this.props.confirm({
content: '是否确认删除?', content: '是否确认删除?',
@ -86,6 +87,8 @@ class CreateGroupByImportModal extends Component{
return false; return false;
} }
}
deleteAttachment = (file) => { deleteAttachment = (file) => {
const url = `/attachments/${file.response ? file.response.id : file.uid}.json` const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, { axios.delete(url, {

@ -1384,6 +1384,7 @@ export default class TPMsettings extends Component {
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
if(file.response!=undefined){
confirm({ confirm({
title: '确定要删除这个附件吗?', title: '确定要删除这个附件吗?',
okText: '确定', okText: '确定',
@ -1400,6 +1401,8 @@ export default class TPMsettings extends Component {
return false; return false;
} }
}
deleteAttachment = (file) => { deleteAttachment = (file) => {
console.log(file); console.log(file);
let id=file.response ==undefined ? file.id : file.response.id let id=file.response ==undefined ? file.id : file.response.id

@ -772,6 +772,7 @@ class Newshixuns extends Component {
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
if(file.response!=undefined){
confirm({ confirm({
title: '确定要删除这个附件吗?', title: '确定要删除这个附件吗?',
okText: '确定', okText: '确定',
@ -787,6 +788,8 @@ class Newshixuns extends Component {
}); });
return false; return false;
} }
}
deleteAttachment = (file) => { deleteAttachment = (file) => {
console.log(file); console.log(file);
let id=file.response ==undefined ? file.id : file.response.id let id=file.response ==undefined ? file.id : file.response.id

Loading…
Cancel
Save