Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_hss
cxt 6 years ago
commit 0ec7de91bd

@ -122,44 +122,33 @@ class GraduationTasksSubmitedit extends Component{
} }
} }
//onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
if(!file.percent || file.percent == 100){
// confirm({ this.setState({
// title: '确定要删除这个附件吗?', Modalstype:true,
// okText: '确定', Modalstopval:'确定要删除这个附件吗?',
// cancelText: '取消', ModalSave: ()=>this.deleteAttachment(file),
// // content: 'Some descriptions', ModalCancel:this.cancelAttachment
// onOk: () => { })
// this.deleteAttachment(file) return false;
// }, }
// onCancel() {
// console.log('Cancel');
// },
// });
// return false;
// this.setState({ }
// Modalstype:true,
// Modalstopval:'确定要删除这个附件吗?',
// ModalSave: ()=>this.deleteAttachment(file),
// ModalCancel:this.cancelAttachment
// })
// return false;
//}
cancelAttachment=()=>{ cancelAttachment=()=>{
this.setState({ this.setState({
Modalstype:false, Modalstype:false,
Modalstopval:'确定要删除这个附件吗?', Modalstopval:'',
ModalSave:"", ModalSave:"",
ModalCancel:"" ModalCancel:""
}) })
} }
onAttachmentRemove = (file) => { deleteAttachment = (file) => {
if(!file.percent || file.percent == 100){ if(!file.percent || file.percent == 100){
let {attachments,fileList}=this.state; let {attachments,fileList}=this.state;
const url = `/attachments/${file}.json` let id=file.response ==undefined ? file.id : file.response.id;
const url = `/attachments/${id}.json`
axios.delete(url, { axios.delete(url, {
}) })
.then((response) => { .then((response) => {
@ -176,17 +165,15 @@ class GraduationTasksSubmitedit extends Component{
} }
} }
// this.setState({
// Modalstype:true,
// Modalstopval:response.data.message,
// ModalSave:this.cancelAttachment,
// Loadtype:true,
// attachments:newattachments
// })
this.cancelAttachment();
this.setState({
Modalstype:true,
Modalstopval:response.data.message,
ModalSave:this.cancelAttachment,
Loadtype:true,
attachments:newattachments
})
this.setState((state) => { this.setState((state) => {
const index = state.fileList.indexOf(file); const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice(); const newFileList = state.fileList.slice();

@ -161,28 +161,30 @@ class GraduationTasksSubmitnew extends Component{
cancelAttachment=()=>{ cancelAttachment=()=>{
this.setState({ this.setState({
Modalstype:false, Modalstype:false,
Modalstopval:'确定要删除这个附件吗?', Modalstopval:'',
ModalSave:"", ModalSave:"",
ModalCancel:"" ModalCancel:""
}) })
} }
deleteAttachment = (file) => { deleteAttachment = (file) => {
const url = `/attachments/${file}.json` if(!file.percent || file.percent == 100){
axios.delete(url, { let id = file.response == undefined ? file.id : file.response.id;
}) const url = `/attachments/${id}.json`
axios.delete(url, {})
.then((response) => { .then((response) => {
if (response.data) { if (response.data) {
// const { status } = response.data; // const { status } = response.data;
if (response.data.status === 0) { if (response.data.status === 0) {
console.log('--- success') console.log('--- success')
this.setState({ // this.setState({
Modalstype:true, // Modalstype: true,
Modalstopval:response.data.message, // Modalstopval: response.data.message,
ModalSave:this.cancelAttachment, // ModalSave: this.cancelAttachment,
Loadtype:true, // Loadtype: true,
}) // })
this.cancelAttachment();
this.setState((state) => { this.setState((state) => {
const index = state.fileList.indexOf(file); const index = state.fileList.indexOf(file);
@ -199,6 +201,7 @@ class GraduationTasksSubmitnew extends Component{
console.log(error); console.log(error);
}); });
} }
}
inputSearchValue=(e)=>{ inputSearchValue=(e)=>{

@ -2875,7 +2875,7 @@ class PollNew extends Component {
{ {
item.question.question_type === 2? item.question.question_type === 2?
<span style={{color: "#4B4B4B"}} <span style={{color: "#4B4B4B"}}
className="font-16 mt10 ml10">{(item.question.min_choices === undefined && item.question.max_choices === undefined ? "不限制" : item.question.min_choices === null && item.question.max_choices === null ? "不限制" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "": item.question.min_choices === "null" && item.question.max_choices === "null" ? "不限制" : item.question.min_choices === item.question.max_choices && item.question.max_choices === item.question.min_choices ? "可选"+(item.question.max_choices)+"项" : "可选" +(item.question.min_choices===undefined||item.question.min_choices===null||item.question.min_choices===""||item.question.min_choices==="null"?2:item.question.min_choices) + "-" + (item.question.max_choices===undefined||item.question.max_choices===null||item.question.max_choices===""||item.question.max_choices==="null"?item.question.answers.length:item.question.max_choices) + "项")}</span> className="font-16 mt10 ml10">{(item.question.min_choices === undefined && item.question.max_choices === undefined ? "" : item.question.min_choices === null && item.question.max_choices === null ? "" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "": item.question.min_choices === "null" && item.question.max_choices === "null" ? "" : item.question.min_choices === item.question.max_choices && item.question.max_choices === item.question.min_choices ? "可选"+(item.question.max_choices)+"项" : "可选" +(item.question.min_choices===undefined||item.question.min_choices===null||item.question.min_choices===""||item.question.min_choices==="null"?2:item.question.min_choices) + "-" + (item.question.max_choices===undefined||item.question.max_choices===null||item.question.max_choices===""||item.question.max_choices==="null"?item.question.answers.length:item.question.max_choices) + "项")}</span>
: "" : ""
} }

Loading…
Cancel
Save