-- fix bug

This commit is contained in:
yuping
2023-02-24 23:23:24 +08:00
parent d750267f41
commit 606ec95c66
2 changed files with 66 additions and 156 deletions

View File

@@ -33,11 +33,10 @@
</div> </div>
</div> </div>
</a-popover> </a-popover>
<div class="imgIcon" @click="showModal(element)"></div> <div class="imgIcon" @click="showModal(element)"></div>
</div> </div>
<div class="boxs_right"> <div class="boxs_right">
<div class="imgIcon" @click="showDeleteChapter"></div> <div class="imgIcon" @click="deleteChapter"></div>
</div> </div>
</div> </div>
<div class="items2"> <div class="items2">
@@ -124,12 +123,6 @@
routerInfo.routerInfo.unlockMode == 1 ? '自由学习模式' : routerInfo.routerInfo.unlockMode == 2 || routerInfo.routerInfo.unlockMode == 3 ? '闯关模式' : '' routerInfo.routerInfo.unlockMode == 1 ? '自由学习模式' : routerInfo.routerInfo.unlockMode == 2 || routerInfo.routerInfo.unlockMode == 3 ? '闯关模式' : ''
}} }}
</span> </span>
<!-- <a-select v-model:value="routerInfo.routerInfo.unlockMode" ref="select" size="small"
style="width: 150px" disabled>
<a-select-option :value="1">自由学习模式</a-select-option>
<a-select-option :value="2">闯关模式</a-select-option>
<a-select-option :value="3">闯关模式</a-select-option>
</a-select> -->
<unlock-mode :routerInfo="routerInfo.routerInfo" :types="types"> <unlock-mode :routerInfo="routerInfo.routerInfo" :types="types">
<a-button type="primary" size="large" style="border-radius: 8px;margin-left: 24px;">切换模式 <a-button type="primary" size="large" style="border-radius: 8px;margin-left: 24px;">切换模式
</a-button> </a-button>
@@ -172,7 +165,7 @@
<div class="btn btn1" @click="showChangeModal"> <div class="btn btn1" @click="showChangeModal">
<div class="btnText">移动任务到关卡</div> <div class="btnText">移动任务到关卡</div>
</div> </div>
<div class="btn btn2" @click="showDeleteALLModal"> <div class="btn btn2" @click="subdeleteAll">
<div class="imgIcon"></div> <div class="imgIcon"></div>
<div class="btnText">批量删除</div> <div class="btnText">批量删除</div>
</div> </div>
@@ -281,10 +274,6 @@
<div style="width: 87px; text-align: center"> <div style="width: 87px; text-align: center">
{{ element.duration ? element.duration + "分钟" : "-" }} {{ element.duration ? element.duration + "分钟" : "-" }}
</div> </div>
<!-- <div style="width: 87px; text-align: center">-->
<!-- {{ element.status === 0 ? '草稿' : element.status === 1 ? '已发布' : '' }}-->
<!-- </div>-->
<div style=" <div style="
width: 120px; width: 120px;
text-align: center; text-align: center;
@@ -298,7 +287,7 @@
@click="editTaskForType(element,index)"> @click="editTaskForType(element,index)">
编辑 编辑
</span> </span>
<span style="color: #4ea6ff; cursor: pointer" @click="showDeleteModal(element,index)"> <span style="color: #4ea6ff; cursor: pointer" @click="deleteTask(element,index)">
删除 删除
</span> </span>
</div> </div>
@@ -337,56 +326,6 @@
<a-button class="btn btn1" @click="cancelStorage" :loading="cancleLoading">取消</a-button> <a-button class="btn btn1" @click="cancelStorage" :loading="cancleLoading">取消</a-button>
</div> </div>
</div> </div>
<!-- 批量删除学员弹窗 -->
<a-modal v-model:visible="deleteAll" :footer="null" :closable="closedeleteAll" wrapClassName="CopyModal"
:centered="true">
<div class="delete">
<div class="del_header"></div>
<div class="del_main">
<div class="header">
<div class="icon"></div>
<span>提示</span>
<div class="close_exit" @click="closedeleteAll"></div>
</div>
<div class="body">
<span>请确认是否批量删除任务</span>
</div>
<div class="del_btnbox">
<div class="del_btn btn1" @click="closedeleteAll">
<div class="btnText">取消</div>
</div>
<div class="del_btn btn2" @click="subdeleteAll">
<div class="btnText">确定</div>
</div>
</div>
</div>
</div>
</a-modal>
<!-- 是否确认删除任务弹窗 -->
<!-- 确认删除阶段弹窗 -->
<a-modal v-model:visible="deleteModal" :footer="null" wrapClassName="ConfirmModal" :centered="true">
<div class="delete">
<div class="del_header"></div>
<div class="del_main">
<div class="header">
<div class="icon"></div>
<span>提示</span>
<div class="close_exit" @click="closeConfirm"></div>
</div>
<div class="body">
<span>您确定要删除此任务吗</span>
</div>
<div class="del_btnbox">
<div class="del_btn btn1" @click="closeConfirm">
<div class="btnText">取消</div>
</div>
<div class="del_btn btn2" @click="deleteLevelTask">
<div class="btnText">确定</div>
</div>
</div>
</div>
</div>
</a-modal>
<!-- 移动任务到阶段 --> <!-- 移动任务到阶段 -->
<a-modal style="padding: 0" v-model:visible="visiblene" :footer="null" :centered="true" <a-modal style="padding: 0" v-model:visible="visiblene" :footer="null" :centered="true"
wrapClassName="moveModal"> wrapClassName="moveModal">
@@ -419,36 +358,10 @@
</div> </div>
</div> </div>
</a-modal> </a-modal>
<!-- 是否删除关卡弹窗 -->
<a-modal v-model:visible="deleteChapterModal" :footer="null" :closable="cC" wrapClassName="ConfirmModal"
centered="true">
<div class="delete">
<div class="del_header"></div>
<div class="del_main">
<div class="header">
<div class="icon"></div>
<span>提示</span>
<div class="close_exit" @click="closeDeleteChapter"></div>
</div>
<div class="body">
<span>您确定要删除此关卡</span>
</div>
<div class="del_btnbox">
<div class="del_btn btn1" @click="closeDeleteChapter">
<div class="btnText">取消</div>
</div>
<div class="del_btn btn2" @click="deleteChapter">
<div class="btnText">确定</div>
</div>
</div>
</div>
</div>
</a-modal>
</div> </div>
</template> </template>
<script setup> <script setup>
import {computed, onMounted, onUnmounted, ref, watch} from "vue"; import {computed, onMounted, ref, watch} from "vue";
import {GetRouterDraftDetail, releaseRouter} from "@/api/indexTask"; import {GetRouterDraftDetail, releaseRouter} from "@/api/indexTask";
import {message} from "ant-design-vue"; import {message} from "ant-design-vue";
import {useRoute} from "vue-router"; import {useRoute} from "vue-router";
@@ -457,19 +370,16 @@ import {TASK_TYPE} from "@/utils/const";
import Draggable from "vuedraggable"; import Draggable from "vuedraggable";
import {ROUTER_DETAIL_MODIFY} from "@/api/apis"; import {ROUTER_DETAIL_MODIFY} from "@/api/apis";
import {request} from "@/api/request"; import {request} from "@/api/request";
import dialog from "@/utils/dialog";
const {query: {routerId}} = useRoute(); const {query: {routerId}} = useRoute();
const modal = ref(false) const modal = ref(false)
const visiblene = ref(false) const visiblene = ref(false)
const deleteAll = ref(false)
const deleteModal = ref(false)
const deleteChapterModal = ref(false)
const cancleLoading = ref(false) const cancleLoading = ref(false)
const templateLoading = ref(false) const templateLoading = ref(false)
const confirmLoading = ref(false) const confirmLoading = ref(false)
const moveChapterIndex = ref('') const moveChapterIndex = ref('')
const activeIndex = ref(0) const activeIndex = ref(0)
const deleteIndex = ref(0)
const types = 1 // 1 路径图 2 项目 const types = 1 // 1 路径图 2 项目
const courseRef = ref({}) const courseRef = ref({})
@@ -509,27 +419,24 @@ const editChapter = () => {
if (!formValue.value.name) { if (!formValue.value.name) {
return message.warning("请输入关卡名称"); return message.warning("请输入关卡名称");
} }
routerInfo.value.chapterList.push({...formValue.value,draftTaskList: []}) routerInfo.value.chapterList.push({...formValue.value, draftTaskList: []})
formValue.value = {draftTaskList: []} formValue.value = {draftTaskList: []}
closeModal() closeModal()
}; };
//打开删除关卡弹窗
const showDeleteChapter = () => {
deleteChapterModal.value = true;
};
//关闭删除关卡弹窗
const closeDeleteChapter = () => {
deleteChapterModal.value = false;
};
//删除关卡 //删除关卡
const deleteChapter = () => { const deleteChapter = () => {
if (routerInfo.value.chapterList.length === 1) { dialog({
message.warning("至少保留一个关卡"); content: '确定要删除关卡吗?',
return ok: () => {
} if (routerInfo.value.chapterList.length === 1) {
routerInfo.value.chapterList.splice(activeIndex.value, 1); message.warning("至少保留一个关卡");
activeIndex.value && (activeIndex.value = activeIndex.value-1); return
deleteChapterModal.value = false; }
routerInfo.value.chapterList[activeIndex.value].id ? (routerInfo.value.chapterList[activeIndex.value].deleted = true) : routerInfo.value.chapterList.splice(activeIndex.value, 1);
activeIndex.value && (activeIndex.value = activeIndex.value - 1);
message.info("删除关卡成功");
},
});
}; };
const getDetail = async () => { const getDetail = async () => {
@@ -539,46 +446,36 @@ const getDetail = async () => {
}; };
onMounted(() => { onMounted(() => {
document.getElementsByTagName("main")[0].style.background = "rgb(245, 247, 250,1)";
document.getElementsByTagName("main")[0].style.boxShadow = "none";
getDetail(); getDetail();
}); });
onUnmounted(() => {
document.getElementsByTagName("main")[0].style.background = "#ffffff";
document.getElementsByTagName("main")[0].style.boxShadow = "0px 1px 35px 0px rgba(118, 136, 166, 0.07)";
});
const changebgc = (index) => { const changebgc = (index) => {
activeIndex.value = index activeIndex.value = index
}; };
const showDeleteALLModal = () => {
const subdeleteAll = () => {
if (!routerInfo.value?.chapterList[activeIndex.value]?.draftTaskList?.filter(t => t.checked)?.length) { if (!routerInfo.value?.chapterList[activeIndex.value]?.draftTaskList?.filter(t => t.checked)?.length) {
message.warning("请选择要删除的任务!"); message.warning("请选择要删除的任务!");
return return
} }
deleteAll.value = true dialog({
content: '确定要删除所选任务吗?',
ok: () => {
for (let i = 0; i < routerInfo.value.chapterList[activeIndex.value].draftTaskList.length; i++) {
const t = routerInfo.value.chapterList[activeIndex.value].draftTaskList[i]
if (t.checked) {
if (t.id) {
t.checked = false;
t.deleted = true;
} else {
routerInfo.value.chapterList[activeIndex.value].draftTaskList.splice(i, 1);
i--;
}
}
}
},
});
}; };
const closedeleteAll = () => {
deleteAll.value = false
};
const subdeleteAll = () => {
routerInfo.value.chapterList[activeIndex.value].draftTaskList.filter(t => t.checked).forEach(t => {
t.checked = false;
t.deleted = true;
})
closedeleteAll()
};
const showDeleteModal = (_, index) => {
deleteModal.value = true;
deleteIndex.value = index;
};
const closeConfirm = () => {
deleteModal.value = false;
};
function deleteLevelTask() {
routerInfo.value.chapterList[activeIndex.value].draftTaskList[deleteIndex.value].deleted = true
closeConfirm()
}
//全选任务或全不选任务 //全选任务或全不选任务
const selectRowAll = () => { const selectRowAll = () => {
@@ -602,6 +499,16 @@ const editTaskForType = (ele, index) => {
courseRef.value['el' + ele.type].openDrawer(index, ele) courseRef.value['el' + ele.type].openDrawer(index, ele)
}; };
function deleteTask(element, index) {
dialog({
content: '确定要删除此任务吗?',
ok: () => {
message.success("删除成功");
routerInfo.value.chapterList[activeIndex.value].draftTaskList[index].id ? (element.deleted = true) : routerInfo.value.chapterList[activeIndex.value].draftTaskList.splice(index, 1)
},
});
}
const showChangeModal = () => { const showChangeModal = () => {
if (routerInfo.value?.chapterList?.length <= 1) { if (routerInfo.value?.chapterList?.length <= 1) {
message.warning("请添加关卡!"); message.warning("请添加关卡!");

View File

@@ -477,17 +477,20 @@ const deleteTaskAll = () => {
return return
} }
dialog({ dialog({
content: '确定要批量删除任务吗?', content: '确定要删除所选任务吗?',
ok: () => { ok: () => {
projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.filter(t => t.checked).forEach((t,i) => { for (let i = 0; i < projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.length; i++) {
if(t.id){ const t = projectInfo.value.stageList[activeIndex.value].taskDraftDtoList[i]
t.checked = false; if (t.checked) {
t.deleted = true; if (t.id) {
}else{ t.checked = false;
projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.splice(i,1) t.deleted = true;
} else {
projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.splice(i, 1);
i--;
}
} }
}
})
}, },
}); });
}; };
@@ -497,7 +500,7 @@ const confirmDelTask = (index) => {
content: '确定要删除此任务吗?', content: '确定要删除此任务吗?',
ok: () => { ok: () => {
message.success("删除成功"); message.success("删除成功");
projectInfo.value.stageList[activeIndex.value].taskDraftDtoList[index].id?(projectInfo.value.stageList[activeIndex.value].taskDraftDtoList[index].deleted = true):projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.splice(index,1) projectInfo.value.stageList[activeIndex.value].taskDraftDtoList[index].id ? (projectInfo.value.stageList[activeIndex.value].taskDraftDtoList[index].deleted = true) : projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.splice(index, 1)
}, },
}); });
}; };
@@ -535,7 +538,7 @@ const deleteStage = () => {
content: projectInfo.value.stageList.length === 1 ? "当前为最后一个阶段,删除后任务将被移出,为无阶段模式,确认删除阶段吗?" : '确认删除此阶段吗?', content: projectInfo.value.stageList.length === 1 ? "当前为最后一个阶段,删除后任务将被移出,为无阶段模式,确认删除阶段吗?" : '确认删除此阶段吗?',
ok: () => { ok: () => {
message.success("删除成功"); message.success("删除成功");
projectInfo.value.stageList[activeIndex.value].id?(projectInfo.value.stageList[activeIndex.value].deleted = true):projectInfo.value.stageList.splice(activeIndex.value,1) projectInfo.value.stageList[activeIndex.value].id ? (projectInfo.value.stageList[activeIndex.value].deleted = true) : projectInfo.value.stageList.splice(activeIndex.value, 1)
activeIndex.value && (activeIndex.value = activeIndex.value - 1); activeIndex.value && (activeIndex.value = activeIndex.value - 1);
}, },
}); });
@@ -556,12 +559,12 @@ const removeAllLevel = () => {
content: '确定要删除所有阶段吗?', content: '确定要删除所有阶段吗?',
ok: () => { ok: () => {
message.success("删除成功"); message.success("删除成功");
projectInfo.value.stageList.forEach((t,i) => { projectInfo.value.stageList.forEach((t, i) => {
if(t.id){ if (t.id) {
t.checked = false; t.checked = false;
t.deleted = true; t.deleted = true;
}else{ } else {
projectInfo.value.stageList.splice(i,1) projectInfo.value.stageList.splice(i, 1)
} }
}) })
}, },