From 00fc1b202cfce0d44b4fcec9a1e0ede4151677ca Mon Sep 17 00:00:00 2001 From: kclf <1195754634@qq.com> Date: Mon, 5 Dec 2022 11:23:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=81=97=E6=BC=8F=E9=83=A8?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/vote/VoteQuestion.vue | 17 ++++++++++++----- src/components/vote/VoteQuestionItem.vue | 1 - 2 files changed, 12 insertions(+), 6 deletions(-) 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;