mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-14 05:16:45 +08:00
--fix 路径图整体修改
This commit is contained in:
@@ -5,3 +5,4 @@ export const getRouterOverview = (routerId) => http.get(`/admin/router/overview?
|
||||
|
||||
//新建或编辑路径图
|
||||
export const editRoutered = (obj) => http.post('/admin/router/edit', obj)
|
||||
export const editRouterModel = (obj) => http.post('/admin/router/editModel', obj)
|
||||
@@ -1,33 +1,34 @@
|
||||
<template>
|
||||
<div @click="openDrawer">
|
||||
<slot></slot>
|
||||
</div>
|
||||
<a-drawer
|
||||
:visible="unlockModeVisible"
|
||||
class="drawerStyle unlockmode"
|
||||
placement="right"
|
||||
width="70%"
|
||||
@after-visible-change="afterVisibleChange"
|
||||
:visible="visible"
|
||||
class="drawerStyle unlockmode"
|
||||
placement="right"
|
||||
width="700"
|
||||
>
|
||||
<div class="drawerMain">
|
||||
<div class="header">
|
||||
<div class="headerTitle">选择解锁模式</div>
|
||||
<img
|
||||
style="width: 29px; height: 29px; cursor: pointer"
|
||||
src="../../assets/images/basicinfo/close.png"
|
||||
@click="closeDrawer"
|
||||
style="width: 29px; height: 29px; cursor: pointer"
|
||||
src="../../assets/images/basicinfo/close.png"
|
||||
@click="closeDrawer"
|
||||
/>
|
||||
</div>
|
||||
<div class="main">
|
||||
<div class="classify">
|
||||
<div
|
||||
v-for="(item, index) in classify"
|
||||
:key="index"
|
||||
class="classifyItem"
|
||||
@click="selectClassify(item)"
|
||||
:style="{
|
||||
color: item.type === selectClassifyType ? '#FFFFFF' : '#999999',
|
||||
v-for="(item, index) in classify"
|
||||
:key="index"
|
||||
class="classifyItem"
|
||||
@click="selectClassify(item)"
|
||||
:style="{
|
||||
color: item.type === classifyActive ? '#FFFFFF' : '#999999',
|
||||
'background-color':
|
||||
item.type === selectClassifyType ? '#4ea6ff' : '#FFFFFF',
|
||||
border:
|
||||
item.type === selectClassifyType
|
||||
item.type === classifyActive ? '#4ea6ff' : '#FFFFFF',
|
||||
border: item.type === classifyActive
|
||||
? '1px solid #4ea6ff'
|
||||
: '1px solid #999999',
|
||||
}"
|
||||
@@ -35,26 +36,29 @@
|
||||
{{ item.text }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="selectClassifyType === 1" class="type1">
|
||||
<div v-if="classifyActive === 1" @click="updateLockMode(1)" class="type1">
|
||||
<span style="font-weight: 500">描述:</span
|
||||
><span>不设学习限制,学员可以在任何时间学习</span>
|
||||
</div>
|
||||
<div v-if="selectClassifyType === 2" class="type1 type3">
|
||||
<div v-if="classifyActive === 2" @click="updateLockMode(2)"
|
||||
class="type1 type3">
|
||||
<div>
|
||||
<span style="font-weight: 500">描述:</span
|
||||
><span>前一个阶段达成目标后解锁下一个阶段</span>
|
||||
</div>
|
||||
<div class="radio" style="display: flex">
|
||||
<div style="margin-top: 1px">解锁条件:</div>
|
||||
<a-radio-group v-model:value="radioSelect" @change="changeUnlockMode">
|
||||
<a-radio-group v-model:value="routerInfoData.unlockMode">
|
||||
<div>
|
||||
<a-radio :value="2"
|
||||
>逐个任务解锁,完成一个任务后解锁下一个</a-radio
|
||||
>逐个任务解锁,完成一个任务后解锁下一个
|
||||
</a-radio
|
||||
>
|
||||
</div>
|
||||
<div style="margin-top: 24px">
|
||||
<a-radio :value="3"
|
||||
>完成当前阶段所有必修任务解锁下一阶段</a-radio
|
||||
>完成当前阶段所有必修任务解锁下一阶段
|
||||
</a-radio
|
||||
>
|
||||
</div>
|
||||
</a-radio-group>
|
||||
@@ -69,93 +73,53 @@
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {reactive, toRefs} from "vue";
|
||||
export default {
|
||||
name: "UnlockMode",
|
||||
props:{
|
||||
unlockModeVisible:{
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
objData:{
|
||||
type: Object
|
||||
}
|
||||
<script setup>
|
||||
import {computed, defineEmits, defineProps, ref, watch} from "vue";
|
||||
import {editRouterModel} from "@/api/indexLearningPath";
|
||||
|
||||
const emit = defineEmits({})
|
||||
const visible = ref(false)
|
||||
const classify = [
|
||||
{
|
||||
type: 1,
|
||||
text: "自由学习模式",
|
||||
},
|
||||
setup(props, ctx) {
|
||||
console.log("获取属性",props)
|
||||
const state = reactive({
|
||||
classify: [
|
||||
{
|
||||
type: 1,
|
||||
text: "自由学习模式",
|
||||
},
|
||||
{
|
||||
type: 2,
|
||||
text: "闯关模式",
|
||||
},
|
||||
],
|
||||
selectClassifyType: 1,
|
||||
checked: true,
|
||||
radioSelect: 1,
|
||||
formData: {
|
||||
unlockMode:'',
|
||||
}
|
||||
});
|
||||
const closeDrawer = () => {
|
||||
state.selectClassifyType = 1;
|
||||
state.checked = true;
|
||||
state.radioSelect = 1;
|
||||
ctx.emit("update:unlockModeVisible", false);
|
||||
ctx.emit("closeUnlockModal", false)
|
||||
};
|
||||
|
||||
|
||||
|
||||
const saveUnlock =() =>{
|
||||
console.log(ctx,state.formData.unlockMode)
|
||||
ctx.emit("saveUnlock",state.formData.unlockMode)
|
||||
}
|
||||
|
||||
const afterVisibleChange = (bool) => {
|
||||
if(bool){
|
||||
for(let key in state.formData){
|
||||
state.formData[key] = props.objData[key]
|
||||
}
|
||||
if(state.formData.unlockMode === 1){
|
||||
state.selectClassifyType = 1
|
||||
}else if(state.formData.unlockMode === 2 || state.formData.unlockMode === 3){
|
||||
state.selectClassifyType = 2
|
||||
state.radioSelect = state.formData.unlockMode
|
||||
}
|
||||
}
|
||||
console.log("点开弹窗",state.formData,state.unlockMode)
|
||||
};
|
||||
|
||||
const selectClassify = (e) => {
|
||||
state.selectClassifyType = e.type;
|
||||
if(e.type === 1){
|
||||
state.formData.unlockMode = e.type
|
||||
}
|
||||
};
|
||||
|
||||
const changeUnlockMode = (e) =>{
|
||||
|
||||
state.formData.unlockMode = e.target.value
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
afterVisibleChange,
|
||||
closeDrawer,
|
||||
saveUnlock,
|
||||
selectClassify,
|
||||
changeUnlockMode
|
||||
};
|
||||
{
|
||||
type: 2,
|
||||
text: "闯关模式",
|
||||
},
|
||||
];
|
||||
const props = defineProps({
|
||||
routerInfo: {}
|
||||
})
|
||||
const routerInfoData = ref({})
|
||||
const classifyActive = computed(() => routerInfoData.value.unlockMode === 1 ? 1 : 2)
|
||||
watch(() => props.routerInfo, () => {
|
||||
routerInfoData.value = props.routerInfo
|
||||
})
|
||||
const closeDrawer = () => {
|
||||
visible.value = false
|
||||
};
|
||||
</script>
|
||||
|
||||
function selectClassify({type}) {
|
||||
routerInfoData.value.unlockMode = type
|
||||
}
|
||||
|
||||
const saveUnlock = () => {
|
||||
emit("update:userInfo", routerInfoData.value)
|
||||
editRouterModel(routerInfoData.value)
|
||||
closeDrawer()
|
||||
}
|
||||
|
||||
function updateLockMode(type) {
|
||||
routerInfoData.value.unlockMode = type
|
||||
}
|
||||
|
||||
function openDrawer() {
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.unlockmode {
|
||||
.drawerMain {
|
||||
@@ -164,6 +128,7 @@ export default {
|
||||
overflow-x: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.header {
|
||||
height: 73px;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
@@ -172,6 +137,7 @@ export default {
|
||||
align-items: center;
|
||||
// background-color: red;
|
||||
margin-bottom: 20px;
|
||||
|
||||
.headerTitle {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
@@ -180,11 +146,14 @@ export default {
|
||||
// margin-left: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.classify {
|
||||
display: flex;
|
||||
|
||||
.classifyItem {
|
||||
width: 160px;
|
||||
height: 38px;
|
||||
@@ -201,6 +170,7 @@ export default {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.type1 {
|
||||
margin-top: 50px;
|
||||
font-size: 14px;
|
||||
@@ -208,10 +178,12 @@ export default {
|
||||
color: #333333;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.radio {
|
||||
margin-top: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.btnn {
|
||||
height: 72px;
|
||||
width: 100%;
|
||||
@@ -222,6 +194,7 @@ export default {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.16);
|
||||
|
||||
.btn1 {
|
||||
width: 100px;
|
||||
height: 40px;
|
||||
@@ -231,6 +204,7 @@ export default {
|
||||
background-color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn2 {
|
||||
cursor: pointer;
|
||||
width: 100px;
|
||||
|
||||
@@ -60,8 +60,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a-modal v-model:visible="modal" :centered="true" :footer="null" :closable="clos" wrapClassName="AddLevell"
|
||||
@cancel="closeModal">
|
||||
<a-modal v-model:visible="modal" :centered="true" :footer="null" wrapClassName="AddLevell" @cancel="closeModal">
|
||||
<div class="header">
|
||||
<div class="headmain">
|
||||
<div class="add">编辑/添加关卡</div>
|
||||
@@ -76,10 +75,10 @@
|
||||
</div>
|
||||
<div class="fir">关卡名称:</div>
|
||||
<div class="input">
|
||||
<a-input style="width: 100%" v-model:value="routerInfo.chapterList[activeIndex].name" :maxlength="20"
|
||||
<a-input style="width: 100%" v-model:value="formValue.name" :maxlength="20"
|
||||
placeholder="请输入关卡名称"/>
|
||||
</div>
|
||||
<div class="co">{{ routerInfo.chapterList[activeIndex].name || 0 }}/20</div>
|
||||
<div class="co">{{ formValue.name?.length || 0 }}/20</div>
|
||||
</div>
|
||||
<div class="name">
|
||||
<div
|
||||
@@ -90,11 +89,11 @@
|
||||
margin-right: 2px;"></div>
|
||||
<div class="fir">关卡说明:</div>
|
||||
<div class="input">
|
||||
<a-textarea style="width: 100%" v-model:value="routerInfo.chapterList[activeIndex].remark"
|
||||
<a-textarea style="width: 100%" v-model:value="formValue.remark"
|
||||
:maxlength="100" placeholder="请输入关卡说明"
|
||||
:rows="5"/>
|
||||
</div>
|
||||
<div class="co1">{{ routerInfo.chapterList[activeIndex].remark || 0 }}/100</div>
|
||||
<div class="co1">{{ formValue.remark?.length || 0 }}/100</div>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<button class="btn1" @click="closeModal">取消</button>
|
||||
@@ -102,9 +101,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="aeLoading" :style="{ display: addLoading ? 'flex' : 'none' }">
|
||||
<a-spin :spinning="addLoading" :tip="updateChapterID ? '修改中...' : ''"/>
|
||||
</div>
|
||||
</a-modal>
|
||||
<div class="right">
|
||||
<div class="addhead">
|
||||
@@ -121,18 +117,16 @@
|
||||
<div class="rightt">
|
||||
<div class="select" style="margin-right:90px;">
|
||||
<span>学习模式:</span>
|
||||
<a-select v-model:value="routerInfo.unlockMode" ref="select" size="small"
|
||||
<a-select v-model:value="routerInfo.routerInfo.unlockMode" ref="select" size="small"
|
||||
style="width: 150px" disabled>
|
||||
<a-select-option :value="0">自由学习模式</a-select-option>
|
||||
<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>
|
||||
<a-button type="primary" size="large" style="border-radius: 8px;margin-left: 24px;"
|
||||
@click="showModeVisible">切换模式
|
||||
</a-button>
|
||||
<unlock-mode ref="unlockModeModal" v-model:unlockModeVisible="unlockModeVisible"
|
||||
:objData="routerInfo" @saveUnlock="saveUnlock" @closeUnlockModal="closeUnlockModal"/>
|
||||
<unlock-mode :routerInfo="routerInfo.routerInfo">
|
||||
<a-button type="primary" size="large" style="border-radius: 8px;margin-left: 24px;">切换模式
|
||||
</a-button>
|
||||
</unlock-mode>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<router-link :to="{ path: '/leveladd', query:{ routerId: routerId } }">
|
||||
@@ -171,13 +165,13 @@
|
||||
<div class="btn btn1" @click="showChangeModal">
|
||||
<div class="btnText">移动任务到关卡</div>
|
||||
</div>
|
||||
<div class="btn btn2" @click="showDeleteALLModal(1)">
|
||||
<div class="btn btn2" @click="showDeleteALLModal">
|
||||
<div class="imgIcon"></div>
|
||||
<div class="btnText">批量删除</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tableBox">
|
||||
<div v-if="routerInfo?.chapterList[activeIndex]?.draftTaskList?.length" class="tableBox">
|
||||
<div style="
|
||||
height: 50px;
|
||||
display: flex;
|
||||
@@ -208,11 +202,6 @@
|
||||
? require('../../assets/images/selectAll.png')
|
||||
: require('../../assets/images/select.png')
|
||||
" @click="selectRowAll"/>
|
||||
<!-- <a-checkbox
|
||||
v-model:checked="selectAll"
|
||||
@change="selectRowAll"
|
||||
>
|
||||
</a-checkbox> -->
|
||||
<div style="margin-top: 2px; margin-left: 8px">类型</div>
|
||||
</div>
|
||||
<div style="width: 120px; text-align: center">任务名称</div>
|
||||
@@ -249,8 +238,7 @@
|
||||
margin-right: 9px;
|
||||
position: absolute;
|
||||
left: -25px;"></div>
|
||||
<a-checkbox :id="element.routerTaskId" v-model:checked="element.checked" @change="changeRow">
|
||||
</a-checkbox>
|
||||
<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 || '' }}
|
||||
</div>
|
||||
@@ -312,7 +300,7 @@
|
||||
</Draggable>
|
||||
</div>
|
||||
<!-- 无数据样式 -->
|
||||
<div class="notable" :style="{ display: stm_hs ? 'block' : 'none' }">
|
||||
<div v-else class="notable">
|
||||
<div class="notablebox">
|
||||
<div class="boxbody">
|
||||
<div class="boximg"></div>
|
||||
@@ -340,15 +328,9 @@
|
||||
<a-button class="btn btn1" @click="cancelStorage" :loading="cancleLoading">取消</a-button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 添加学员抽屉 -->
|
||||
<add-stu v-model:AddSvisible="AddSvisible"/>
|
||||
<!-- 导入学员抽屉 -->
|
||||
<imp-stu v-model:AddImpStuvisible="AddImpStuvisible"/>
|
||||
<!-- 添加讨论侧弹窗 -->
|
||||
<!-- 添加活动侧弹窗 -->
|
||||
<!-- 批量删除学员弹窗 -->
|
||||
<a-modal v-model:visible="deleteAll" :footer="null" :closable="closeDeleteAll" wrapClassName="CopyModal"
|
||||
centered="true">
|
||||
<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">
|
||||
@@ -373,7 +355,7 @@
|
||||
</a-modal>
|
||||
<!-- 是否确认删除任务弹窗 -->
|
||||
<!-- 确认删除阶段弹窗 -->
|
||||
<a-modal v-model:visible="deleteModal" :footer="null" :closable="cC" wrapClassName="ConfirmModal" centered="true">
|
||||
<a-modal v-model:visible="deleteModal" :footer="null" wrapClassName="ConfirmModal" :centered="true">
|
||||
<div class="delete">
|
||||
<div class="del_header"></div>
|
||||
<div class="del_main">
|
||||
@@ -397,7 +379,7 @@
|
||||
</div>
|
||||
</a-modal>
|
||||
<!-- 移动任务到阶段 -->
|
||||
<a-modal style="padding: 0" :closable="sh" v-model:visible="visiblene" :footer="null" centered="true"
|
||||
<a-modal style="padding: 0" v-model:visible="visiblene" :footer="null" :centered="true"
|
||||
wrapClassName="moveModal">
|
||||
<div class="con">
|
||||
<div class="header">
|
||||
@@ -408,10 +390,13 @@
|
||||
</div>
|
||||
<div class="mid">
|
||||
<div class="inher">
|
||||
<div class="cur">已选中{{ selectRow.length }}个任务</div>
|
||||
<div class="cur">
|
||||
已选中{{ routerInfo?.chapterList[activeIndex]?.draftTaskList?.filter(t => t.checked)?.length || 0 }}个任务
|
||||
</div>
|
||||
<div class="select">
|
||||
<a-select v-model:value="curLevel" style="width: 100%" placeholder="请选择阶段" :options="level"
|
||||
@change="handleChangeStage" allowClear></a-select>
|
||||
<a-select v-model:value="moveChapterIndex" style="width: 100%" placeholder="请选择阶段" allowClear
|
||||
:options="routerInfo.chapterList.map(({name:label},value)=>({label,value,disabled:value===activeIndex}))"
|
||||
></a-select>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<button style="cursor: pointer" class="sameb btn1" @click="closeChangeModal">
|
||||
@@ -454,15 +439,12 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import {onMounted, onUnmounted, ref} from "vue";
|
||||
import AddStu from "../../components/drawers/AddLevelAddStu";
|
||||
import ImpStu from "../../components/drawers/AddLevelImportStu";
|
||||
import {computed, onMounted, onUnmounted, ref} from "vue";
|
||||
import {GetRouterDraftDetail, releaseRouter} from "@/api/indexTask";
|
||||
import {message} from "ant-design-vue";
|
||||
import {editTask} from "@/api/indexTaskadd";
|
||||
import {editRoutered} from '@/api/indexLearningPath'
|
||||
import {useRoute} from "vue-router";
|
||||
import UnlockMode from "../../components/drawers/UnlockMode.vue";
|
||||
import UnlockMode from "@/components/drawers/UnlockMode.vue";
|
||||
import {TASK_TYPE} from "@/utils/const";
|
||||
import Draggable from "vuedraggable";
|
||||
import {ROUTER_DETAIL_MODIFY} from "@/api/apis";
|
||||
@@ -470,15 +452,32 @@ import {request} from "@/api/request";
|
||||
|
||||
const {query: {routerId}} = useRoute();
|
||||
const modal = ref(false)
|
||||
const unlockModeModal = ref(false)
|
||||
const visiblene = ref(false)
|
||||
const deleteAll = ref(false)
|
||||
const deleteModal = ref(false)
|
||||
const deleteChapterModal = ref(false)
|
||||
const unlockModeVisible = ref(false)
|
||||
const cancleLoading = ref(false)
|
||||
const templateLoading = ref(false)
|
||||
const confirmLoading = ref(false)
|
||||
const moveChapterIndex = ref('')
|
||||
const activeIndex = ref(0)
|
||||
const deleteIndex = ref(0)
|
||||
|
||||
const courseRef = ref({})
|
||||
const routerInfo = ref({chapterList: [{name: '关卡一', taskList: []}], routerInfo: {}})
|
||||
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
|
||||
if (!selectedNum) {
|
||||
return 0
|
||||
}
|
||||
if (selectedNum === routerInfo.value.chapterList[activeIndex.value].draftTaskList.length) {
|
||||
return 1
|
||||
}
|
||||
return 2
|
||||
})
|
||||
const showModal = () => {
|
||||
modal.value = true;
|
||||
};
|
||||
@@ -486,20 +485,14 @@ const closeModal = () => {
|
||||
modal.value = false;
|
||||
};
|
||||
|
||||
// 关闭模式弹框
|
||||
const closeUnlockModal = () => {
|
||||
unlockModeModal.value = false;
|
||||
}
|
||||
|
||||
const saveUnlock = (num) => {
|
||||
routerInfo.value.unlockMode = num
|
||||
editRoutered(routerInfo.value)
|
||||
closeUnlockModal()
|
||||
}
|
||||
|
||||
//新建关卡
|
||||
const editChapter = () => {
|
||||
// if (!state.value1) return message.warning("请输入关卡名称");
|
||||
if (!formValue.value.name) {
|
||||
return message.warning("请输入关卡名称");
|
||||
}
|
||||
routerInfo.value.chapterList.push({...formValue.value})
|
||||
formValue.value = {draftTaskList: []}
|
||||
closeModal()
|
||||
};
|
||||
//打开删除关卡弹窗
|
||||
const showDeleteChapter = () => {
|
||||
@@ -532,115 +525,49 @@ onUnmounted(() => {
|
||||
const changebgc = (index) => {
|
||||
activeIndex.value = index
|
||||
};
|
||||
const showDeleteALLModal = (type) => {
|
||||
console.log(type)
|
||||
// if (state.selectRow.length === 0) {
|
||||
// message.warning("请选择要删除的任务");
|
||||
// }
|
||||
// deleteAll = true;
|
||||
// deleteType = type;
|
||||
const showDeleteALLModal = () => {
|
||||
if (!routerInfo.value?.chapterList[activeIndex.value]?.draftTaskList?.filter(t => t.checked)?.length) {
|
||||
message.warning("请选择要删除的任务!");
|
||||
return
|
||||
}
|
||||
deleteAll.value = true
|
||||
};
|
||||
const closedeleteAll = () => {
|
||||
// state.deleteAll = false;
|
||||
// state.deleteType = null;
|
||||
deleteAll.value = false
|
||||
};
|
||||
const subdeleteAll = () => {
|
||||
// state.deleteType = null;
|
||||
routerInfo.value.chapterList[activeIndex.value].draftTaskList = routerInfo.value.chapterList[activeIndex.value].draftTaskList.filter(t => !t.checked);
|
||||
closedeleteAll()
|
||||
};
|
||||
const showDeleteModal = (id) => {
|
||||
console.log(id)
|
||||
// state.deleteID = id;
|
||||
// state.deleteModal = true;
|
||||
const showDeleteModal = (_, index) => {
|
||||
deleteModal.value = true;
|
||||
deleteIndex.value = index;
|
||||
};
|
||||
const closeConfirm = () => {
|
||||
// state.deleteModal = false;
|
||||
// state.deleteID = "";
|
||||
// state.editID = "";
|
||||
deleteModal.value = false;
|
||||
};
|
||||
|
||||
//选择单个任务
|
||||
const changeRow = (e) => {
|
||||
console.log(e)
|
||||
//selectRow:已经选择的任务的id数组
|
||||
// let arr = state.selectRow;
|
||||
// if (e.target.checked) {
|
||||
// arr.push(e.target.id);
|
||||
// } else {
|
||||
// arr.map((value, index) => {
|
||||
// if (value == e.target.id) {
|
||||
// arr.splice(index, 1);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// state.selectRow = arr;
|
||||
// //判断是否是全部选择或者是全部未选择来修改selectAll框的样式
|
||||
// if (arr.length !== 0) {
|
||||
// if (arr.length === state.tableData.length) {
|
||||
// state.selectAll = 1;
|
||||
// } else {
|
||||
// state.selectAll = 2;
|
||||
// }
|
||||
// } else {
|
||||
// state.selectAll = 0;
|
||||
// }
|
||||
// console.log("state.selectRow", state.selectRow, state.selectAll);
|
||||
};
|
||||
function deleteLevelTask() {
|
||||
routerInfo.value.chapterList[activeIndex.value].draftTaskList.splice(deleteIndex.value, 1)
|
||||
closeConfirm()
|
||||
}
|
||||
|
||||
//全选任务或全不选任务
|
||||
const selectRowAll = () => {
|
||||
// let arr = state.tableData;
|
||||
// let array = [];
|
||||
// if (state.selectAll === 0 || state.selectAll === 2) {
|
||||
// arr.map((value) => {
|
||||
// // console.log("value", value, index);
|
||||
// value.checked = true;
|
||||
// array.push(value.id);
|
||||
// // if (value == e.target.id) {
|
||||
// // arr.splice(index, 1);
|
||||
// // }
|
||||
// state.selectAll = 1;
|
||||
// });
|
||||
// } else {
|
||||
// array = [];
|
||||
// arr.map((value) => {
|
||||
// // console.log("value", value, index);
|
||||
// value.checked = false;
|
||||
// state.selectAll = 0;
|
||||
// });
|
||||
// }
|
||||
// state.tableData = arr;
|
||||
// state.selectRow = array;
|
||||
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 = true)
|
||||
};
|
||||
//移动任务到关卡
|
||||
const moveTask = () => {
|
||||
// if (state.isactive == state.removeStageId) {
|
||||
// message.destroy();
|
||||
// message.warning("选择的任务已在当前关卡");
|
||||
// } else if (state.removeStageId == null) {
|
||||
// message.destroy();
|
||||
// message.warning("请选择关卡");
|
||||
// } else {
|
||||
// let obj = {
|
||||
// chapterId: state.removeStageId,
|
||||
// routerTaskIdList: state.selectRow,
|
||||
// };
|
||||
// console.log("移动关卡obj", obj);
|
||||
// api
|
||||
// .moveTask(obj)
|
||||
// .then((res) => {
|
||||
// console.log("移动成功", res);
|
||||
// message.destroy();
|
||||
// message.success("移动成功");
|
||||
// localStorage.setItem("chapterId", state.chooseChapterId);
|
||||
// state.selectRow = []; //选择行
|
||||
// state.selectAll = 0; //0:未选择,1:全选,2:部分选择
|
||||
// getDetail();
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// console.log("移动失败", err);
|
||||
// });
|
||||
// state.visiblene = false;
|
||||
// state.curLevel = null;
|
||||
// }
|
||||
routerInfo.value.chapterList[moveChapterIndex.value].draftTaskList.push(...routerInfo.value.chapterList[activeIndex.value].draftTaskList.filter(t => t.checked).map((t) => ({
|
||||
...t,
|
||||
checked: false
|
||||
})));
|
||||
routerInfo.value.chapterList[activeIndex.value].draftTaskList = routerInfo.value.chapterList[activeIndex.value].draftTaskList.filter(t => !t.checked);
|
||||
visiblene.value = false;
|
||||
};
|
||||
//编辑的按钮
|
||||
const editTaskForType = (ele, index) => {
|
||||
@@ -653,25 +580,18 @@ const changeCourseType = (ele) => {
|
||||
message.success("修改成功");
|
||||
};
|
||||
const showChangeModal = () => {
|
||||
// if (state.selectRow.length == 0) {
|
||||
// return message.warning("请选择要移动的任务");
|
||||
// } else {
|
||||
// state.visiblene = true;
|
||||
// }
|
||||
if (routerInfo.value?.chapterList?.length <= 1) {
|
||||
message.warning("请添加关卡!");
|
||||
return
|
||||
}
|
||||
if (!routerInfo.value?.chapterList[activeIndex.value]?.draftTaskList?.filter(t => t.checked)?.length) {
|
||||
message.warning("请选择要移动的任务!");
|
||||
return
|
||||
}
|
||||
visiblene.value = true
|
||||
};
|
||||
const closeChangeModal = () => {
|
||||
// state.visiblene = false;
|
||||
// state.curLevel = null;
|
||||
};
|
||||
const handleChangeStage = () => {
|
||||
// console.log("阶段改变", value, option);
|
||||
// state.removeStageId = option.chapterId;
|
||||
// state.curLevel = option.name;
|
||||
};
|
||||
|
||||
//显示切换模式抽屉
|
||||
const showModeVisible = () => {
|
||||
unlockModeVisible.value = true;
|
||||
visiblene.value = false
|
||||
};
|
||||
|
||||
//暂存
|
||||
|
||||
Reference in New Issue
Block a user