--fix bug

This commit is contained in:
yuping
2023-02-17 00:15:28 +08:00
parent a725f73191
commit effd83db96
3 changed files with 26 additions and 15 deletions

View File

@@ -314,7 +314,6 @@ import OrgClass from "@/components/project/OrgClass";
import ProjectManager from "@/components/project/ProjectManagerNew";
import NameInput from "@/components/project/NameInput";
import ProjectLevel from "@/components/project/ProjectLevel";
import {storage} from "../../api/storage";
import * as api2 from "../../api/indexAudit";
import {validateName} from "@/api/index1";
import dayjs from "dayjs";
@@ -536,7 +535,7 @@ export default {
message.success(state.projectInfo.projectId ? "编辑成功" : "创建成功");
router.push({
path: "/taskpage",
query: { projectId: res.data.data.projectId },
query: { projectId: res.data.data.id },
});
});
};

View File

@@ -949,7 +949,6 @@ import ProjPowerList from "../../components/drawers/ProjPowerList";
import ProjCheckShip from "../../components/drawers/ProjCheckPower";
import * as api from "../../api/index";
import * as api1 from "../../api/index1";
import { storage } from "../../api/storage";
import ProjectManager from "@/components/project/ProjectManagerNew";
import TrainClass from "@/components/project/TrainClass";
import OrgClass from "@/components/project/OrgClass";

View File

@@ -16,7 +16,8 @@
<Draggable v-model="projectInfo.stageList" chosenClass="chosen" ghostClass="ghost" forceFallback="true"
group="stage" animation="500">
<template #item="{ element,index }">
<div class="items" :class="activeIndex === index ? 'active' : ''" @click="changeStageIndex(index)" >
<div class="items" v-if="element.id !==0" :class="activeIndex === index ? 'active' : ''"
@click="changeStageIndex(index)">
<div class="items1">
<div class="boxs_left">
<a-popover placement="topLeft" trigger="click">
@@ -45,9 +46,6 @@
{{ element.name }}
</div>
</template>
<!-- <template #title>
<span>关卡说明</span>
</template> -->
<div class="nname">
{{ element.name }}
</div>
@@ -76,7 +74,6 @@
</div>
</div>
<div class="rightt">
<!-- 2022-11-30注释 后面放开 -->
<div class="select" style="margin-right:90px;">
<span>学习模式</span>
<span
@@ -543,6 +540,7 @@ const cancleLoading = ref(false);
const projectInfo = ref({stageList: [{taskList: [{}]}], projectInfo: {}});
const activeIndex = ref(0);
const moveChapterIndex = ref(0);
const deleteIndex = ref(0);
const formValue = ref({taskList: []});
@@ -557,7 +555,7 @@ const selectAll = computed(() => {
return 2
})
function changeStageIndex(index){
function changeStageIndex(index) {
activeIndex.value = index
}
@@ -566,6 +564,10 @@ const getTask = async () => {
await api.getTask({projectId: route.query.projectId}).then((res) => {
projectInfo.value = res.data.data
});
//如果没有阶段就给个默认的阶段 但是并不存储
if (!projectInfo.value.stageList.length) {
projectInfo.value.stageList.push({id: 0, name: '', remark: '', taskList: []})
}
};
const editTaskForType = (ele, index) => {
@@ -618,19 +620,30 @@ const closeModal = () => {
const showModal = () => {
stage.value = true
};
//添加阶段
const editStage = async () => {
function editStage() {
if (!formValue.value.name) {
return message.warning("请输入关卡名称");
message.warning("请输入阶段名称");
return
}
//替换 默认阶段
if (projectInfo.value.stageList.length === 1 && projectInfo.value.stageList[0].id === 0) {
formValue.value.taskList = [...projectInfo.value.stageList[0].taskList]
projectInfo.value.stageList.push({...formValue.value})
projectInfo.value.stageList.splice(0, 1)
} else {
projectInfo.value.stageList.push({...formValue.value})
activeIndex.value = activeIndex.value + 1
}
projectInfo.value.stageList.push({...formValue.value})
formValue.value = {taskList: []}
stage.value = false
};
}
//打开删除阶段弹窗
const showDeleteStage = () => {
const showDeleteStage = (index) => {
deleteStageModal.value = true;
deleteIndex.value = index;
};
//关闭删除阶段弹窗
const closeDeleteStage = () => {
@@ -638,7 +651,7 @@ const closeDeleteStage = () => {
};
//删除阶段
const deleteStage = () => {
projectInfo.value.stageList.splice(deleteIndex.value,1)
};
onMounted(() => {
document.getElementsByTagName("main")[0].style.background = "rgb(245, 247, 250,1)";