diff --git a/src/components/vote/VoteQuestion.vue b/src/components/vote/VoteQuestion.vue index 3aef2b9f..723f99d2 100644 --- a/src/components/vote/VoteQuestion.vue +++ b/src/components/vote/VoteQuestion.vue @@ -97,6 +97,18 @@ export default { }); }; const del = ({ id, optionId }) => { + if (optionId) { + api.deleteVoteStemOption(optionId).then((res) => { + if (res.data.code === 200) { + virtualDel(id); + } + }); + } else { + virtualDel(id); + } + }; + const virtualDel = (id) => { + // 前端删除 curItem.value.optionDetailList.forEach((item, index) => { if (item.id === id) { curItem.value.optionDetailList.splice(index, 1); @@ -105,11 +117,6 @@ export default { curItem.value.optionDetailList.map((item, index) => { item.id = index + 1; }); - - api.deleteVoteStemOption(optionId).then((res) => { - console.log(56444); - console.log(res); - }); }; return { diff --git a/src/components/vote/VoteQuestionItem.vue b/src/components/vote/VoteQuestionItem.vue index 347b6245..0bd03820 100644 --- a/src/components/vote/VoteQuestionItem.vue +++ b/src/components/vote/VoteQuestionItem.vue @@ -95,7 +95,6 @@ export default { const formData = new FormData(); formData.append("file", file); - console.log(file); fileUp(formData).then((res) => { if (res.data.code === 200) { state.hasImgName = file.name;