mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-11 03:46:45 +08:00
补删除简单和评分修复bug
This commit is contained in:
@@ -414,7 +414,7 @@ export default {
|
|||||||
|
|
||||||
const handleDel = ({ id, type, curItem }) => {
|
const handleDel = ({ id, type, curItem }) => {
|
||||||
// 接口删除
|
// 接口删除
|
||||||
if (state.assessmentId && curItem.orderNumber) {
|
if (state.assessmentId && (curItem.orderNumber || curItem.optionId)) {
|
||||||
if (type === 1) {
|
if (type === 1) {
|
||||||
deleteChoiceQuestion({
|
deleteChoiceQuestion({
|
||||||
assessmentId: state.assessmentId,
|
assessmentId: state.assessmentId,
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
v-for="(item, index) in curItem.mutilList"
|
v-for="(item, index) in curItem.mutilList"
|
||||||
:key="index"
|
:key="index"
|
||||||
:item="item"
|
:item="item"
|
||||||
@input="inputMutil"
|
|
||||||
@src="imgSrcMutil"
|
@src="imgSrcMutil"
|
||||||
@delImg="delImgMutil"
|
@delImg="delImgMutil"
|
||||||
@del="delMutil"
|
@del="delMutil"
|
||||||
@@ -95,13 +94,6 @@ export default {
|
|||||||
imgVal: "",
|
imgVal: "",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const inputMutil = ({ id, val }) => {
|
|
||||||
curItem.value.mutilList.forEach((item) => {
|
|
||||||
if (item.id === id) {
|
|
||||||
item.inputVal = val;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const imgSrcMutil = ({ id, src }) => {
|
const imgSrcMutil = ({ id, src }) => {
|
||||||
curItem.value.mutilList.forEach((item) => {
|
curItem.value.mutilList.forEach((item) => {
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
@@ -117,6 +109,23 @@ export default {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
const delMutil = ({ id, optionId }) => {
|
const delMutil = ({ id, optionId }) => {
|
||||||
|
// 接口删除
|
||||||
|
if (assessmentId.value && optionId) {
|
||||||
|
deleteChoiceQuestion({
|
||||||
|
assessmentId: assessmentId.value,
|
||||||
|
questionType: "2",
|
||||||
|
optionId,
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
virtualDel(id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
virtualDel(id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const virtualDel = (id) => {
|
||||||
|
// 前端删除
|
||||||
curItem.value.mutilList.forEach((item, index) => {
|
curItem.value.mutilList.forEach((item, index) => {
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
curItem.value.mutilList.splice(index, 1);
|
curItem.value.mutilList.splice(index, 1);
|
||||||
@@ -125,22 +134,12 @@ export default {
|
|||||||
curItem.value.mutilList.map((item, index) => {
|
curItem.value.mutilList.map((item, index) => {
|
||||||
item.id = index + 1;
|
item.id = index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
deleteChoiceQuestion({
|
|
||||||
assessmentId: assessmentId.value,
|
|
||||||
questionType: "2",
|
|
||||||
optionId,
|
|
||||||
}).then((res) => {
|
|
||||||
console.log(56444);
|
|
||||||
console.log(res);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
curItem,
|
curItem,
|
||||||
handleTypesDel,
|
handleTypesDel,
|
||||||
handleMutilAdd,
|
handleMutilAdd,
|
||||||
inputMutil,
|
|
||||||
imgSrcMutil,
|
imgSrcMutil,
|
||||||
delImgMutil,
|
delImgMutil,
|
||||||
delMutil,
|
delMutil,
|
||||||
|
|||||||
Reference in New Issue
Block a user