第一个页面调整

This commit is contained in:
joylink_zhaoerwei 2024-03-01 16:20:10 +08:00
parent 7810cfc993
commit ccaefdeb5e
2 changed files with 67 additions and 70 deletions

View File

@ -7,43 +7,36 @@
<div class="module-box">
<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">
<template v-for="(mod, modIndex) in moduleList">
<el-tab-pane :key="modIndex" :label="mod.moduleName" :name="mod.customModuleId+''">
<el-card style="padding:10px">
<div>考试时间{{ mod.duration }}分钟</div>
</el-card>
<el-card style="margin-top: 10px;">
<div style="padding:10px"> 任务目录</div>
<el-tree
:data="taskTreeDatas"
node-key="id"
default-expand-all
:expand-on-click-node="false"
/>
</el-card>
<el-card style="margin-top: 10px;">
<div style="padding:10px"> 评分规则</div>
<el-table
:data="ruleData"
border
show-summary
:summary-method="getSummaries"
style="width: 100%;margin-top: 10px;"
>
<el-table-column type="index" width="50" />
<el-table-column label="描述" prop="text" />
<el-table-column label="作业程序" prop="worker" />
<el-table-column label="分值" prop="score" width="50" />
<el-table-column label="评分标准" prop="criteria" />
</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-tab-pane label="详情" name="detail">
<div class="tabs-module">
<template v-for="(mod, modIndex) in moduleList">
<el-card :key="modIndex" class="tabs-module-card">
<div style="margin-bottom:10px">模块{{ mod.moduleName }}</div>
<div style="margin-bottom:10px">考试时间{{ mod.duration }}分钟</div>
<div style="margin-bottom:50px"> 任务目录
<el-tree
:data="moduleTreeDatas[modIndex].children"
current-node-key
node-key="id"
:props="defaultProps"
default-expand-all
:expand-on-click-node="false"
:highlight-current="false"
style="background: transparent;color: #fff;"
/>
</div>
<div class="tabs-module-card-button">
<div style="display: flex; justify-content: center;margin-top: 10px;">
<el-button type="primary" size="medium" @click="showScoreRule(mod.moduleScoreRuleId)">评分表</el-button>
<el-button type="primary" size="medium" @click="beginExercise(mod.customModuleId)">开始训练</el-button>
</div>
</div>
</el-card>
</template>
</div>
</el-tab-pane>
</el-tabs>
<score-rule ref="scoreRule" />
</div>
</div>
</template>
@ -51,6 +44,7 @@
<script>
import paperList from './paperList';
import drapLeft from '@/views/components/drapLeft/index';
import ScoreRule from './scoreRule';
import { getPaperDetail, getContextScoreDetail} from '@/api/contest';
let id = 1;
@ -58,18 +52,22 @@ export default {
name: 'ContestList',
components: {
paperList,
drapLeft
drapLeft,
ScoreRule
},
data() {
return {
widthLeft: 380,
paperName:'试卷',
paperId:'',
activeModuleName:'',
activeModuleName:'detail',
moduleList:[],
moduleTreeDatas:[],
taskTreeDatas:[],
ruleData:[]
ruleData:[],
defaultProps: {
disabled: true
}
};
},
computed: {
@ -86,7 +84,6 @@ export default {
this.paperId = paper.id;
getPaperDetail(paper.id).then((res) => {
this.moduleList = res.data.moduleVo.modules;
this.activeModuleName = this.moduleList[0].customModuleId + '';
this.moduleTreeDatas = this.moduleList.map(moduleItem=>{
let children = [];
if (moduleItem.group.length) {
@ -117,34 +114,12 @@ export default {
this.ruleData = res.data.rule ? res.data.rule.units : [];
}).catch(() => { this.ruleData = []; });
},
showScoreRule(moduleScoreRuleId) {
this.$refs.scoreRule.doShow(moduleScoreRuleId);
},
beginExercise(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) {
const result = {label:data.name, children:[], id:id++, type:'taskCatalog' };
if (data.group.length) {
@ -189,11 +164,36 @@ export default {
}
&::-webkit-scrollbar-track{
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/{
.el-tree-node__content:hover, .el-upload-list__item:hover {
background-color: #00172E !important;
}
.el-tabs__nav-scroll{
background: #00172E;
}

View File

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