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> ></span>
<router-link to="/ReadingClubManage">业务支援读书会管理</router-link> <router-link to="/ReadingClubManage">业务支援读书会管理</router-link>
</a-menu-item> </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"> <a-menu-item key="sub6-4">
<span <span
:class="{ :class="{
@@ -240,6 +231,27 @@
</a-menu-item> </a-menu-item>
</a-sub-menu> </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')"> <a-menu-item key="sub5" v-if="checkMenu('systemManage')">
<div class="imgBox"> <div class="imgBox">
<img style="width: 16px; height: 16px" src="../assets/images/navleft/system.png"/> <img style="width: 16px; height: 16px" src="../assets/images/navleft/system.png"/>

View File

@@ -82,8 +82,8 @@
</div> </div>
<div class="name"> <div class="name">
<div <div
class="d" class="d"
style="width: 10px; style="width: 10px;
height: 10px; height: 10px;
margin-top: 2px; margin-top: 2px;
margin-right: 2px;"></div> margin-right: 2px;"></div>
@@ -118,9 +118,9 @@
<div class="select" style="margin-right:90px;"> <div class="select" style="margin-right:90px;">
<span>学习模式</span> <span>学习模式</span>
<span <span
style="border: 1px solid rgba(0, 0, 0, 0.25);width: 120px;height: 38px; border-radius: 10px;text-align: center;line-height: 38px;"> 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> </span>
<unlock-mode :routerInfo="routerInfo.routerInfo" :types="types"> <unlock-mode :routerInfo="routerInfo.routerInfo" :types="types">
@@ -216,8 +216,8 @@
animation="500"> animation="500">
<template #item="{ element,index }"> <template #item="{ element,index }">
<div <div
v-if="!element.deleted" v-if="!element.deleted"
style=" style="
height: 50px; height: 50px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@@ -241,7 +241,7 @@
left: -25px;"></div> left: -25px;"></div>
<a-checkbox :id="element.id" v-model:checked="element.checked"></a-checkbox> <a-checkbox :id="element.id" v-model:checked="element.checked"></a-checkbox>
<div style="margin-top: 2px; margin-left: 8px"> <div style="margin-top: 2px; margin-left: 8px">
{{ TASK_TYPE[element.type]?.name || '' }} {{ TASK_TYPE[element.type]?.name || "" }}
</div> </div>
</div> </div>
</div> </div>
@@ -280,10 +280,10 @@
<div class="opa"> <div class="opa">
<div class="opacation"> <div class="opacation">
<span <span
style="color: #4ea6ff; style="color: #4ea6ff;
margin-right: 25px; margin-right: 25px;
cursor: pointer;" cursor: pointer;"
@click="editTaskForType(element,index)"> @click="editTaskForType(element,index)">
编辑 编辑
</span> </span>
<span style="color: #4ea6ff; cursor: pointer" @click="deleteTask(element,index)"> <span style="color: #4ea6ff; cursor: pointer" @click="deleteTask(element,index)">
@@ -374,48 +374,47 @@ import {ROUTER_DETAIL_MODIFY} from "@/api/apis";
import {request} from "@/api/request"; import {request} from "@/api/request";
import dialog from "@/utils/dialog"; import dialog from "@/utils/dialog";
const {query: {routerId}} = useRoute(); const { query: { routerId } } = useRoute();
const modal = ref(false) const modal = ref(false);
const ischapterEdit = ref(false) const ischapterEdit = ref(false);
const visiblene = ref(false) const visiblene = ref(false);
const cancleLoading = ref(false) const cancleLoading = 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 types = 1 // 1 路径图 2 项目 const types = 1; // 1 路径图 2 项目
const courseRef = ref({})
const formValue = ref({draftTaskList: []})
const routerInfo = ref({chapterList: [{name: '关卡一', draftTaskList: []}], routerInfo: {}})
const courseRef = ref({});
const formValue = ref({ draftTaskList: [] });
const routerInfo = ref({ chapterList: [{ name: "关卡一", draftTaskList: [] }], routerInfo: {} });
const selectAll = computed(() => { 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) { if (!selectedNum) {
return 0 return 0;
} }
if (selectedNum === routerInfo.value.chapterList[activeIndex.value].draftTaskList.length) { if (selectedNum === routerInfo.value.chapterList[activeIndex.value].draftTaskList.length) {
return 1 return 1;
} }
return 2 return 2;
}) });
watch(() => routerInfo.value.chapterList, () => { watch(() => routerInfo.value.chapterList, () => {
routerInfo.value.chapterList.forEach((t, i) => { routerInfo.value.chapterList.forEach((t, i) => {
t.sort = i; t.sort = i;
t.draftTaskList?.forEach((s, j) => { t.draftTaskList?.forEach((s, j) => {
s.sort = j s.sort = j;
}) });
}) });
}, {deep: true}) }, { deep: true });
const showModal = (e,type) => { const showModal = (e, type) => {
ischapterEdit.value = (type === "edit"); ischapterEdit.value = (type === "edit");
console.log(ischapterEdit.value) console.log(ischapterEdit.value);
if(type == 'edit'){ if (type == "edit") {
console.log("关卡信息:" + e.name); console.log("关卡信息:" + e.name);
formValue.value = e;//回传修改的信息 formValue.value = e;//回传修改的信息
}else{ } else {
//关卡信息初始化 //关卡信息初始化
formValue.value = {}; formValue.value = {};
} }
@@ -430,26 +429,30 @@ const editChapter = () => {
if (!formValue.value.name) { if (!formValue.value.name) {
return message.warning("请输入关卡名称"); return message.warning("请输入关卡名称");
} }
if(ischapterEdit.value){ if (ischapterEdit.value) {
routerInfo.value.chapterList = [{...formValue.value, draftTaskList: []}]; routerInfo.value.chapterList = [{ ...formValue.value, draftTaskList: [] }];
} else {
routerInfo.value.chapterList.push({ ...formValue.value, draftTaskList: [] });
} }
else{ formValue.value = { draftTaskList: [] };
routerInfo.value.chapterList.push({...formValue.value, draftTaskList: []}) closeModal();
}
formValue.value = {draftTaskList: []}
closeModal()
}; };
//删除关卡 //删除关卡
const deleteChapter = () => { const deleteChapter = () => {
dialog({ dialog({
content: '确定要删除关卡吗?', content: "确定要删除关卡吗?",
ok: () => { ok: () => {
if (routerInfo.value.chapterList.length === 1) { if (routerInfo.value.chapterList.length === 1) {
message.warning("至少保留一个关卡"); 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); activeIndex.value && (activeIndex.value = activeIndex.value - 1);
message.info("删除关卡成功"); message.info("删除关卡成功");
}, },
@@ -458,8 +461,8 @@ const deleteChapter = () => {
const getDetail = async () => { const getDetail = async () => {
await GetRouterDraftDetail(routerId).then((res) => { await GetRouterDraftDetail(routerId).then((res) => {
routerInfo.value = res.data.data routerInfo.value = res.data.data;
}) });
}; };
onMounted(() => { onMounted(() => {
@@ -467,19 +470,19 @@ onMounted(() => {
}); });
const changebgc = (index) => { const changebgc = (index) => {
activeIndex.value = index activeIndex.value = index;
}; };
const subdeleteAll = () => { 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;
} }
dialog({ dialog({
content: '确定要删除所选任务吗?', content: "确定要删除所选任务吗?",
ok: () => { ok: () => {
for (let i = 0; i < routerInfo.value.chapterList[activeIndex.value].draftTaskList.length; i++) { 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.checked) {
if (t.id) { if (t.id) {
t.checked = false; t.checked = false;
@@ -497,10 +500,10 @@ const subdeleteAll = () => {
//全选任务或全不选任务 //全选任务或全不选任务
const selectRowAll = () => { const selectRowAll = () => {
if (selectAll.value === 1) { if (selectAll.value === 1) {
routerInfo.value.chapterList[activeIndex.value].draftTaskList.forEach(t => t.checked = false) routerInfo.value.chapterList[activeIndex.value].draftTaskList.forEach(t => t.checked = false);
return 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 = () => { const moveTask = () => {
@@ -513,15 +516,15 @@ const moveTask = () => {
}; };
//编辑的按钮 //编辑的按钮
const editTaskForType = (ele, index) => { const editTaskForType = (ele, index) => {
courseRef.value['el' + ele.type].openDrawer(index, ele) courseRef.value["el" + ele.type].openDrawer(index, ele);
}; };
function deleteTask(element, index) { function deleteTask(element, index) {
dialog({ dialog({
content: '确定要删除此任务吗?', content: "确定要删除此任务吗?",
ok: () => { ok: () => {
message.success("删除成功"); 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 = () => { const showChangeModal = () => {
if (routerInfo.value?.chapterList?.length <= 1) { if (routerInfo.value?.chapterList?.length <= 1) {
message.warning("请添加关卡!"); message.warning("请添加关卡!");
return return;
} }
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;
} }
visiblene.value = true visiblene.value = true;
}; };
const closeChangeModal = () => { const closeChangeModal = () => {
visiblene.value = false visiblene.value = false;
}; };
//暂存 //暂存
const temporaryStorage = async () => { const temporaryStorage = async () => {
confirmLoading.value = true confirmLoading.value = true;
await request(ROUTER_DETAIL_MODIFY, routerInfo.value) await request(ROUTER_DETAIL_MODIFY, routerInfo.value);
await getDetail() await getDetail();
message.success("暂存成功"); message.success("暂存成功");
confirmLoading.value = false confirmLoading.value = false;
}; };
const submitStorage = async () => { const submitStorage = async () => {
if (routerInfo.value.routerInfo.status === 1) { if (routerInfo.value.routerInfo.status === 1) {
dialog({ dialog({
content: '该路径图已经发布,修改后如未点击暂存当前操作未保存数据将丢失,确认保存?', content: "该路径图已经发布,修改后如未点击暂存当前操作未保存数据将丢失,确认保存?",
ok: async () => { ok: async () => {
confirmLoading.value = true confirmLoading.value = true;
await releaseRouter(routerId) await releaseRouter(routerId);
message.success("关卡和任务数据已保存"); message.success("关卡和任务数据已保存");
confirmLoading.value = false confirmLoading.value = false;
}, },
}) });
return return;
} }
confirmLoading.value = true confirmLoading.value = true;
await request(ROUTER_DETAIL_MODIFY, routerInfo.value) await request(ROUTER_DETAIL_MODIFY, routerInfo.value);
message.success("关卡和任务数据已保存") message.success("关卡和任务数据已保存");
confirmLoading.value = false confirmLoading.value = false;
}; };
//取消 //取消
const cancelStorage = async () => { const cancelStorage = async () => {
cancleLoading.value = true cancleLoading.value = true;
await getDetail() await getDetail();
message.success("取消成功"); message.success("取消成功");
cancleLoading.value = false cancleLoading.value = false;
}; };
</script> </script>
@@ -605,7 +608,7 @@ const cancelStorage = async () => {
width: calc(100%); width: calc(100%);
height: 40px; height: 40px;
background: linear-gradient(rgba(78, 166, 255, 0.2) 0%, background: linear-gradient(rgba(78, 166, 255, 0.2) 0%,
rgba(78, 166, 255, 0) 100%); rgba(78, 166, 255, 0) 100%);
} }
.del_main { .del_main {
@@ -722,7 +725,7 @@ const cancelStorage = async () => {
position: relative; position: relative;
justify-content: center; justify-content: center;
background: linear-gradient(rgba(78, 166, 255, 0.2) 0%, background: linear-gradient(rgba(78, 166, 255, 0.2) 0%,
rgba(78, 166, 255, 0) 100%); rgba(78, 166, 255, 0) 100%);
.inhe { .inhe {
width: 80%; width: 80%;
@@ -835,8 +838,8 @@ const cancelStorage = async () => {
width: 624px; width: 624px;
height: 68px; height: 68px;
background: linear-gradient(180deg, background: linear-gradient(180deg,
rgba(78, 166, 255, 0.2) 0%, rgba(78, 166, 255, 0.2) 0%,
rgba(78, 166, 255, 0) 100%); rgba(78, 166, 255, 0) 100%);
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -2076,7 +2079,7 @@ const cancelStorage = async () => {
width: calc(100%); width: calc(100%);
height: 40px; height: 40px;
background: linear-gradient(rgba(78, 166, 255, 0.2) 0%, background: linear-gradient(rgba(78, 166, 255, 0.2) 0%,
rgba(78, 166, 255, 0) 100%); rgba(78, 166, 255, 0) 100%);
} }
.del_main { .del_main {

View File

@@ -541,7 +541,12 @@ 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) 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); activeIndex.value && (activeIndex.value = activeIndex.value - 1);
}, },
}); });