This commit is contained in:
fan 2024-03-05 09:42:39 +08:00
commit 4495db6d77

View File

@ -13,7 +13,7 @@
<el-card :key="modIndex" class="tabs-module-card"> <el-card :key="modIndex" class="tabs-module-card">
<div style="margin-bottom:10px;font-size: 20px;height: 30px;text-align: center;line-height: 30px;">{{ mod.moduleName }}</div> <div style="margin-bottom:10px;font-size: 20px;height: 30px;text-align: center;line-height: 30px;">{{ mod.moduleName }}</div>
<div style="margin-bottom:10px">考试时间{{ mod.duration }}分钟</div> <div style="margin-bottom:10px">考试时间{{ mod.duration }}分钟</div>
<div style="margin-bottom:50px"> 任务目录 <div class="tabs-module-card-tree"> 任务目录
<el-tree <el-tree
:data="moduleTreeDatas[modIndex].children" :data="moduleTreeDatas[modIndex].children"
current-node-key current-node-key
@ -45,7 +45,7 @@
import paperList from './paperList'; import paperList from './paperList';
import drapLeft from '@/views/components/drapLeft/index'; import drapLeft from '@/views/components/drapLeft/index';
import ScoreRule from './scoreRule'; import ScoreRule from './scoreRule';
import { getPaperDetail, getContextScoreDetail, beginContestExercise} from '@/api/contest'; import { getTaskTreeDatas, getPaperDetail, beginContestExercise} from '@/api/contest';
let id = 1; let id = 1;
export default { export default {
@ -66,7 +66,8 @@ export default {
taskTreeDatas:[], taskTreeDatas:[],
defaultProps: { defaultProps: {
disabled: true disabled: true
} },
allTaskDatas:{}
}; };
}, },
computed: { computed: {
@ -74,6 +75,17 @@ export default {
return this.$store.state.app.width; return this.$store.state.app.width;
} }
}, },
created() {
getTaskTreeDatas().then((res) => {
this.allTaskDatas = res.data.reduce((acc, obj) => {
acc[obj.name] = obj.id;
return acc;
}, {});
}).catch(error => {
this.$message.error(error.message);
});
},
methods: { methods: {
drapWidth(width) { drapWidth(width) {
this.widthLeft = Number(width); this.widthLeft = Number(width);
@ -115,6 +127,16 @@ export default {
}, },
transformTree(data) { transformTree(data) {
const result = {label:data.name, children:[], id:id++, type:'taskCatalog' }; const result = {label:data.name, children:[], id:id++, type:'taskCatalog' };
data.taskIds.forEach(taskId => {
let label = '';
for (const key in this.allTaskDatas) {
if (this.allTaskDatas[key] === taskId) {
label = key;
break;
}
}
result.children.push({label, id:id++, type:'tasks', parentId:result.id });
});
if (data.group.length) { if (data.group.length) {
const changeGroup = data.group.map(taskCatalog=> const changeGroup = data.group.map(taskCatalog=>
this.transformTree(taskCatalog) this.transformTree(taskCatalog)
@ -169,6 +191,20 @@ export default {
padding:10px; padding:10px;
background: transparent; background: transparent;
color: #fff; color: #fff;
.tabs-module-card-tree{
max-height:calc(100vh - 370px);
overflow: auto;
margin-bottom:50px;
&::-webkit-scrollbar{
background: #06284a;
}
&::-webkit-scrollbar-thumb{
background: #0c0909;
}
&::-webkit-scrollbar-track{
background: #06284a;
}
}
.tabs-module-card-button{ .tabs-module-card-button{
position: absolute; position: absolute;
bottom: 10px; bottom: 10px;