mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 12:26:47 +08:00
删除交互修复
This commit is contained in:
@@ -36,7 +36,10 @@
|
||||
<div class="main_item">
|
||||
<div class="signbox">
|
||||
<div class="sign">
|
||||
<img src="@/assets/images/coursewareManage/asterisk.png" alt="" />
|
||||
<img
|
||||
src="@/assets/images/coursewareManage/asterisk.png"
|
||||
alt="asterisk"
|
||||
/>
|
||||
</div>
|
||||
<span>创建题干:</span>
|
||||
</div>
|
||||
@@ -252,24 +255,24 @@ export default {
|
||||
};
|
||||
|
||||
const handleDel = ({ id, curItem }) => {
|
||||
console.log(888888888);
|
||||
console.log(id);
|
||||
console.log(curItem);
|
||||
// 接口删除
|
||||
if (curItem.voteStemId) {
|
||||
api.deleteVoteStem(curItem.voteStemId).then((res) => {
|
||||
console.log(56444);
|
||||
console.log(res);
|
||||
if (res.data.code === 200) {
|
||||
virtualDel(id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
virtualDel();
|
||||
}
|
||||
};
|
||||
const virtualDel = (id) => {
|
||||
// 前端删除
|
||||
state.allFormsData.forEach((item, index) => {
|
||||
if (item.id === id) {
|
||||
state.allFormsData.splice(index, 1);
|
||||
}
|
||||
});
|
||||
console.log(5656777777777);
|
||||
console.log(state.allFormsData);
|
||||
state.allFormsData.map((item, index) => {
|
||||
item.id = index + 1;
|
||||
return item;
|
||||
|
||||
@@ -421,8 +421,9 @@ export default {
|
||||
questionType: "1",
|
||||
orderNumber: curItem.orderNumber,
|
||||
}).then((res) => {
|
||||
console.log(56444);
|
||||
console.log(res);
|
||||
if (res.data.code === 200) {
|
||||
virtualDel(id);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (type === 2) {
|
||||
@@ -431,8 +432,9 @@ export default {
|
||||
questionType: "2",
|
||||
orderNumber: curItem.orderNumber,
|
||||
}).then((res) => {
|
||||
console.log(56444);
|
||||
console.log(res);
|
||||
if (res.data.code === 200) {
|
||||
virtualDel(id);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (type === 3) {
|
||||
@@ -441,8 +443,9 @@ export default {
|
||||
questionType: "3",
|
||||
optionId: curItem.optionId,
|
||||
}).then((res) => {
|
||||
console.log(56444);
|
||||
console.log(res);
|
||||
if (res.data.code === 200) {
|
||||
virtualDel(id);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (type === 4) {
|
||||
@@ -451,11 +454,16 @@ export default {
|
||||
questionType: "4",
|
||||
optionId: curItem.optionId,
|
||||
}).then((res) => {
|
||||
console.log(56444);
|
||||
console.log(res);
|
||||
if (res.data.code === 200) {
|
||||
virtualDel(id);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
virtualDel();
|
||||
}
|
||||
};
|
||||
const virtualDel = (id) => {
|
||||
// 前端删除
|
||||
state.allFormsData.forEach((item, index) => {
|
||||
if (item.id === id) {
|
||||
|
||||
@@ -112,10 +112,15 @@ export default {
|
||||
questionType: "1",
|
||||
optionId,
|
||||
}).then((res) => {
|
||||
console.log(56444);
|
||||
console.log(res);
|
||||
if (res.data.code === 200) {
|
||||
virtualDel(id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
virtualDel(id);
|
||||
}
|
||||
};
|
||||
const virtualDel = (id) => {
|
||||
// 前端删除
|
||||
curItem.value.singleList.forEach((item, index) => {
|
||||
if (item.id === id) {
|
||||
|
||||
Reference in New Issue
Block a user