-- fix bug

This commit is contained in:
yuping
2023-03-02 16:51:16 +08:00
parent da565f0933
commit 615d1517c4

View File

@@ -4,7 +4,7 @@
<div class="left clearfix">
<div class="leftmain">
<div class="tit" style="margin-left: 18px">关卡</div>
<div class="btn btn3" @click="showModal({},'add')" style="margin-left: 19px">
<div class="btn btn3" @click="showModal()" style="margin-left: 19px">
<div class="search"></div>
<div class="btnText">添加关卡</div>
</div>
@@ -33,7 +33,7 @@
</div>
</div>
</a-popover>
<div class="imgIcon" @click="showModal(element,'edit')"></div>
<div class="imgIcon" @click="showEditModal(element)"></div>
</div>
<div class="boxs_right">
<div class="imgIcon" @click="deleteChapter"></div>
@@ -376,7 +376,6 @@ import dialog from "@/utils/dialog";
const { query: { routerId } } = useRoute();
const modal = ref(false);
const ischapterEdit = ref(false);
const visiblene = ref(false);
const cancleLoading = ref(false);
const confirmLoading = ref(false);
@@ -408,18 +407,14 @@ watch(() => routerInfo.value.chapterList, () => {
});
}, { deep: true });
const showModal = (e, type) => {
ischapterEdit.value = (type === "edit");
console.log(ischapterEdit.value);
if (type == "edit") {
console.log("关卡信息:" + e.name);
formValue.value = e;//回传修改的信息
} else {
//关卡信息初始化
formValue.value = {};
}
const showModal = () => {
formValue.value = {};
modal.value = true;
};
function showEditModal(ele){
formValue.value =ele;
modal.value = false;
}
const closeModal = () => {
modal.value = false;
};
@@ -429,11 +424,12 @@ const editChapter = () => {
if (!formValue.value.name) {
return message.warning("请输入关卡名称");
}
if (ischapterEdit.value) {
routerInfo.value.chapterList = [{ ...formValue.value, draftTaskList: [] }];
} else {
routerInfo.value.chapterList.push({ ...formValue.value, draftTaskList: [] });
if(formValue.value.id){
closeModal();
return
}
routerInfo.value.chapterList.push({ ...formValue.value, draftTaskList: [] });
activeIndex.value = activeIndex.value + 1
formValue.value = { draftTaskList: [] };
closeModal();
};