This commit is contained in:
dongruihua
2023-03-02 14:59:09 +08:00
3 changed files with 113 additions and 93 deletions

View File

@@ -220,15 +220,6 @@
></span>
<router-link to="/ReadingClubManage">业务支援读书会管理</router-link>
</a-menu-item>
<a-menu-item key="sub6-3">
<span
:class="{
circleActive: selectedKeys[0] === 'sub6-3',
circle: selectedKeys[0]!=='sub6-3',
}"
></span>
<router-link to="/AudienceManage">受众管理</router-link>
</a-menu-item>
<a-menu-item key="sub6-4">
<span
:class="{
@@ -240,6 +231,27 @@
</a-menu-item>
</a-sub-menu>
<a-sub-menu key="sub7">
<template #icon>
<div class="imgBox">
<img
style="width: 22px; height: 22px"
src="../assets/images/navleft/review.png"
/>
</div>
</template>
<template #title>受众管理</template>
<a-menu-item key="sub7-1">
<span
:class="{
circleActive: selectedKeys[0] === 'sub6-7',
circle: selectedKeys[0]!=='sub6-7',
}"
></span>
<router-link to="/AudienceManage">受众管理</router-link>
</a-menu-item>
</a-sub-menu>
<a-menu-item key="sub5" v-if="checkMenu('systemManage')">
<div class="imgBox">
<img style="width: 16px; height: 16px" src="../assets/images/navleft/system.png"/>

View File

@@ -120,7 +120,7 @@
<span
style="border: 1px solid rgba(0, 0, 0, 0.25);width: 120px;height: 38px; border-radius: 10px;text-align: center;line-height: 38px;">
{{
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>
<unlock-mode :routerInfo="routerInfo.routerInfo" :types="types">
@@ -241,7 +241,7 @@
left: -25px;"></div>
<a-checkbox :id="element.id" v-model:checked="element.checked"></a-checkbox>
<div style="margin-top: 2px; margin-left: 8px">
{{ TASK_TYPE[element.type]?.name || '' }}
{{ TASK_TYPE[element.type]?.name || "" }}
</div>
</div>
</div>
@@ -374,48 +374,47 @@ import {ROUTER_DETAIL_MODIFY} from "@/api/apis";
import {request} from "@/api/request";
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)
const moveChapterIndex = ref('')
const activeIndex = ref(0)
const types = 1 // 1 路径图 2 项目
const courseRef = ref({})
const formValue = ref({draftTaskList: []})
const routerInfo = ref({chapterList: [{name: '关卡一', draftTaskList: []}], routerInfo: {}})
const { query: { routerId } } = useRoute();
const modal = ref(false);
const ischapterEdit = ref(false);
const visiblene = ref(false);
const cancleLoading = ref(false);
const confirmLoading = ref(false);
const moveChapterIndex = ref("");
const activeIndex = ref(0);
const types = 1; // 1 路径图 2 项目
const courseRef = ref({});
const formValue = ref({ draftTaskList: [] });
const routerInfo = ref({ chapterList: [{ name: "关卡一", draftTaskList: [] }], routerInfo: {} });
const selectAll = computed(() => {
const selectedNum = routerInfo.value.chapterList[activeIndex.value].draftTaskList.filter(t => t.checked).length
const selectedNum = routerInfo.value.chapterList[activeIndex.value].draftTaskList.filter(t => t.checked).length;
if (!selectedNum) {
return 0
return 0;
}
if (selectedNum === routerInfo.value.chapterList[activeIndex.value].draftTaskList.length) {
return 1
return 1;
}
return 2
})
return 2;
});
watch(() => routerInfo.value.chapterList, () => {
routerInfo.value.chapterList.forEach((t, i) => {
t.sort = i;
t.draftTaskList?.forEach((s, j) => {
s.sort = j
})
})
}, {deep: true})
s.sort = j;
});
});
}, { deep: true });
const showModal = (e,type) => {
const showModal = (e, type) => {
ischapterEdit.value = (type === "edit");
console.log(ischapterEdit.value)
if(type == 'edit'){
console.log(ischapterEdit.value);
if (type == "edit") {
console.log("关卡信息:" + e.name);
formValue.value = e;//回传修改的信息
}else{
} else {
//关卡信息初始化
formValue.value = {};
}
@@ -430,26 +429,30 @@ const editChapter = () => {
if (!formValue.value.name) {
return message.warning("请输入关卡名称");
}
if(ischapterEdit.value){
routerInfo.value.chapterList = [{...formValue.value, draftTaskList: []}];
if (ischapterEdit.value) {
routerInfo.value.chapterList = [{ ...formValue.value, draftTaskList: [] }];
} else {
routerInfo.value.chapterList.push({ ...formValue.value, draftTaskList: [] });
}
else{
routerInfo.value.chapterList.push({...formValue.value, draftTaskList: []})
}
formValue.value = {draftTaskList: []}
closeModal()
formValue.value = { draftTaskList: [] };
closeModal();
};
//删除关卡
const deleteChapter = () => {
dialog({
content: '确定要删除关卡吗?',
content: "确定要删除关卡吗?",
ok: () => {
if (routerInfo.value.chapterList.length === 1) {
message.warning("至少保留一个关卡");
return
return;
}
if (routerInfo.value.chapterList[activeIndex.value].id) {
routerInfo.value.chapterList[activeIndex.value].deleted = true;
routerInfo.value.chapterList[activeIndex.value].draftTaskList?.forEach((t, i) => t.id ? (t.deleted = true) : routerInfo.value.chapterList[activeIndex.value].draftTaskList.splice(i, 1));
} else {
routerInfo.value.chapterList.splice(activeIndex.value, 1);
}
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("删除关卡成功");
},
@@ -458,8 +461,8 @@ const deleteChapter = () => {
const getDetail = async () => {
await GetRouterDraftDetail(routerId).then((res) => {
routerInfo.value = res.data.data
})
routerInfo.value = res.data.data;
});
};
onMounted(() => {
@@ -467,19 +470,19 @@ onMounted(() => {
});
const changebgc = (index) => {
activeIndex.value = index
activeIndex.value = index;
};
const subdeleteAll = () => {
if (!routerInfo.value?.chapterList[activeIndex.value]?.draftTaskList?.filter(t => t.checked)?.length) {
message.warning("请选择要删除的任务!");
return
return;
}
dialog({
content: '确定要删除所选任务吗?',
content: "确定要删除所选任务吗?",
ok: () => {
for (let i = 0; i < routerInfo.value.chapterList[activeIndex.value].draftTaskList.length; i++) {
const t = routerInfo.value.chapterList[activeIndex.value].draftTaskList[i]
const t = routerInfo.value.chapterList[activeIndex.value].draftTaskList[i];
if (t.checked) {
if (t.id) {
t.checked = false;
@@ -497,10 +500,10 @@ const subdeleteAll = () => {
//全选任务或全不选任务
const selectRowAll = () => {
if (selectAll.value === 1) {
routerInfo.value.chapterList[activeIndex.value].draftTaskList.forEach(t => t.checked = false)
return
routerInfo.value.chapterList[activeIndex.value].draftTaskList.forEach(t => t.checked = false);
return;
}
routerInfo.value.chapterList[activeIndex.value].draftTaskList.forEach(t => t.checked = true)
routerInfo.value.chapterList[activeIndex.value].draftTaskList.forEach(t => t.checked = true);
};
//移动任务到关卡
const moveTask = () => {
@@ -513,15 +516,15 @@ const moveTask = () => {
};
//编辑的按钮
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: '确定要删除此任务吗?',
content: "确定要删除此任务吗?",
ok: () => {
message.success("删除成功");
routerInfo.value.chapterList[activeIndex.value].draftTaskList[index].id ? (element.deleted = true) : routerInfo.value.chapterList[activeIndex.value].draftTaskList.splice(index, 1)
routerInfo.value.chapterList[activeIndex.value].draftTaskList[index].id ? (element.deleted = true) : routerInfo.value.chapterList[activeIndex.value].draftTaskList.splice(index, 1);
},
});
}
@@ -529,51 +532,51 @@ function deleteTask(element, index) {
const showChangeModal = () => {
if (routerInfo.value?.chapterList?.length <= 1) {
message.warning("请添加关卡!");
return
return;
}
if (!routerInfo.value?.chapterList[activeIndex.value]?.draftTaskList?.filter(t => t.checked)?.length) {
message.warning("请选择要移动的任务!");
return
return;
}
visiblene.value = true
visiblene.value = true;
};
const closeChangeModal = () => {
visiblene.value = false
visiblene.value = false;
};
//暂存
const temporaryStorage = async () => {
confirmLoading.value = true
await request(ROUTER_DETAIL_MODIFY, routerInfo.value)
await getDetail()
confirmLoading.value = true;
await request(ROUTER_DETAIL_MODIFY, routerInfo.value);
await getDetail();
message.success("暂存成功");
confirmLoading.value = false
confirmLoading.value = false;
};
const submitStorage = async () => {
if (routerInfo.value.routerInfo.status === 1) {
dialog({
content: '该路径图已经发布,修改后如未点击暂存当前操作未保存数据将丢失,确认保存?',
content: "该路径图已经发布,修改后如未点击暂存当前操作未保存数据将丢失,确认保存?",
ok: async () => {
confirmLoading.value = true
await releaseRouter(routerId)
confirmLoading.value = true;
await releaseRouter(routerId);
message.success("关卡和任务数据已保存");
confirmLoading.value = false
confirmLoading.value = false;
},
})
return
});
return;
}
confirmLoading.value = true
await request(ROUTER_DETAIL_MODIFY, routerInfo.value)
message.success("关卡和任务数据已保存")
confirmLoading.value = false
confirmLoading.value = true;
await request(ROUTER_DETAIL_MODIFY, routerInfo.value);
message.success("关卡和任务数据已保存");
confirmLoading.value = false;
};
//取消
const cancelStorage = async () => {
cancleLoading.value = true
await getDetail()
cancleLoading.value = true;
await getDetail();
message.success("取消成功");
cancleLoading.value = false
cancleLoading.value = false;
};
</script>

View File

@@ -541,7 +541,12 @@ const deleteStage = () => {
content: projectInfo.value.stageList.length === 1 ? "当前为最后一个阶段,删除后任务将被移出,为无阶段模式,确认删除阶段吗?" : '确认删除此阶段吗?',
ok: () => {
message.success("删除成功");
projectInfo.value.stageList[activeIndex.value].id ? (projectInfo.value.stageList[activeIndex.value].deleted = true) : projectInfo.value.stageList.splice(activeIndex.value, 1)
if (projectInfo.value.stageList[activeIndex.value].id) {
projectInfo.value.stageList[activeIndex.value].deleted = true
projectInfo.value.stageList[activeIndex.value].taskDraftDtoList?.forEach((t, i) => t.id ? (t.deleted = true) : projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.splice(i, 1));
} else {
projectInfo.value.stageList.splice(activeIndex.value, 1)
}
activeIndex.value && (activeIndex.value = activeIndex.value - 1);
},
});