This commit is contained in:
fan 2024-03-01 16:44:20 +08:00
commit 1aca5f00ab
3 changed files with 68 additions and 78 deletions

View File

@ -6,44 +6,37 @@
</div> </div>
<div class="module-box"> <div class="module-box">
<div style="height: 50px;text-align: center;line-height: 50px;font-size: 26px;font-weight: bolder;color: #fff;">{{ paperName }}</div> <div style="height: 50px;text-align: center;line-height: 50px;font-size: 26px;font-weight: bolder;color: #fff;">{{ paperName }}</div>
<el-tabs v-model="activeModuleName" class="tabs-box" type="border-card" @tab-click="handleTabClick"> <el-tabs v-model="activeModuleName" class="tabs-box" type="border-card">
<template v-for="(mod, modIndex) in moduleList"> <el-tab-pane label="详情" name="detail">
<el-tab-pane :key="modIndex" :label="mod.moduleName" :name="mod.customModuleId+''"> <div class="tabs-module">
<el-card style="padding:10px"> <template v-for="(mod, modIndex) in moduleList">
<div>考试时间{{ mod.duration }}分钟</div> <el-card :key="modIndex" class="tabs-module-card">
</el-card> <div style="margin-bottom:10px">模块{{ mod.moduleName }}</div>
<el-card style="margin-top: 10px;"> <div style="margin-bottom:10px">考试时间{{ mod.duration }}分钟</div>
<div style="padding:10px"> 任务目录</div> <div style="margin-bottom:50px"> 任务目录
<el-tree <el-tree
:data="taskTreeDatas" :data="moduleTreeDatas[modIndex].children"
node-key="id" current-node-key
default-expand-all node-key="id"
:expand-on-click-node="false" :props="defaultProps"
/> default-expand-all
</el-card> :expand-on-click-node="false"
<el-card style="margin-top: 10px;"> :highlight-current="false"
<div style="padding:10px"> 评分规则</div> style="background: transparent;color: #fff;"
<el-table />
:data="ruleData" </div>
border <div class="tabs-module-card-button">
show-summary <div style="display: flex; justify-content: center;margin-top: 10px;">
:summary-method="getSummaries" <el-button type="primary" size="medium" @click="showScoreRule(mod.moduleScoreRuleId)">评分表</el-button>
style="width: 100%;margin-top: 10px;" <el-button type="primary" size="medium" @click="beginExercise(mod.customModuleId)">开始训练</el-button>
> </div>
<el-table-column type="index" width="50" /> </div>
<el-table-column label="描述" prop="text" /> </el-card>
<el-table-column label="作业程序" prop="worker" /> </template>
<el-table-column label="分值" prop="score" width="50" /> </div>
<el-table-column label="评分标准" prop="criteria" /> </el-tab-pane>
</el-table>
</el-card>
<div style="display: flex; justify-content: center;margin-top: 10px;">
<el-button type="primary" size="medium" @click="beginExercise(mod.customModuleId)">开始训练</el-button>
</div>
</el-tab-pane>
</template>
</el-tabs> </el-tabs>
<score-rule ref="scoreRule" />
</div> </div>
</div> </div>
</template> </template>
@ -51,6 +44,7 @@
<script> <script>
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 { getPaperDetail, getContextScoreDetail} from '@/api/contest'; import { getPaperDetail, getContextScoreDetail} from '@/api/contest';
let id = 1; let id = 1;
@ -58,18 +52,22 @@ export default {
name: 'ContestList', name: 'ContestList',
components: { components: {
paperList, paperList,
drapLeft drapLeft,
ScoreRule
}, },
data() { data() {
return { return {
widthLeft: 380, widthLeft: 380,
paperName:'试卷', paperName:'试卷',
paperId:'', paperId:'',
activeModuleName:'', activeModuleName:'detail',
moduleList:[], moduleList:[],
moduleTreeDatas:[], moduleTreeDatas:[],
taskTreeDatas:[], taskTreeDatas:[],
ruleData:[] ruleData:[],
defaultProps: {
disabled: true
}
}; };
}, },
computed: { computed: {
@ -86,7 +84,6 @@ export default {
this.paperId = paper.id; this.paperId = paper.id;
getPaperDetail(paper.id).then((res) => { getPaperDetail(paper.id).then((res) => {
this.moduleList = res.data.moduleVo.modules; this.moduleList = res.data.moduleVo.modules;
this.activeModuleName = this.moduleList[0].customModuleId + '';
this.moduleTreeDatas = this.moduleList.map(moduleItem=>{ this.moduleTreeDatas = this.moduleList.map(moduleItem=>{
let children = []; let children = [];
if (moduleItem.group.length) { if (moduleItem.group.length) {
@ -110,41 +107,12 @@ export default {
this.$message.error(error.message); this.$message.error(error.message);
}); });
}, },
handleTabClick(tab) { showScoreRule(moduleScoreRuleId) {
const moduleItem = this.moduleTreeDatas.find((item)=>item.customModuleId == tab.name); this.$refs.scoreRule.doShow(moduleScoreRuleId);
this.taskTreeDatas = moduleItem.children;
getContextScoreDetail(moduleItem.moduleScoreRuleId).then(res => {
this.ruleData = res.data.rule ? res.data.rule.units : [];
}).catch(() => { this.ruleData = []; });
}, },
beginExercise(moduleId) { beginExercise(moduleId) {
this.$router.push({path: '/contest/detail', query:{paperId:this.paperId, moduleId }}); this.$router.push({path: '/contest/detail', query:{paperId:this.paperId, moduleId }});
}, },
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总分';
return;
}
if (index === 3) {
const values = data.map(item => Number(item[column.property]));
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += '';
} else {
sums[index] = '/';
}
});
return sums;
},
transformTree(data) { transformTree(data) {
const result = {label:data.name, children:[], id:id++, type:'taskCatalog' }; const result = {label:data.name, children:[], id:id++, type:'taskCatalog' };
if (data.group.length) { if (data.group.length) {
@ -189,11 +157,36 @@ export default {
} }
&::-webkit-scrollbar-track{ &::-webkit-scrollbar-track{
background: #06284a; background: #06284a;
} }
} .tabs-module{
display: flex;
justify-content: space-between;
color: #fff;
.tabs-module-card{
position: relative;
width:49%;
margin-top: 10px;
padding:10px;
background: transparent;
color: #fff;
.tabs-module-card-button{
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
}
}
}
}
} }
} }
.el-card{
border: solid 1px #01468B;
}
/deep/{ /deep/{
.el-tree-node__content:hover, .el-upload-list__item:hover {
background-color: #00172E !important;
}
.el-tabs__nav-scroll{ .el-tabs__nav-scroll{
background: #00172E; background: #00172E;
} }

View File

@ -48,7 +48,7 @@ export default {
this.handleData(data, '1'); this.handleData(data, '1');
this.tableData = data; this.tableData = data;
this.loading = false; this.loading = false;
}).catch(() => { this.$message.error('初始化数据失败!'); this.loading = false; }); }).catch(() => { this.$message.error('初始化数据失败!'); this.loading = false; this.tableData = []; });
}, },
handleClose() { handleClose() {
this.dialogVisible = false; this.dialogVisible = false;

View File

@ -91,9 +91,6 @@ export default {
this.$message.error(error.message); this.$message.error(error.message);
}); });
}, },
queryChildrenTask() {
console.log(111);
},
creatTask() { creatTask() {
this.$refs.addEditTask.doShow(); this.$refs.addEditTask.doShow();
}, },