大赛第一个页面

This commit is contained in:
joylink_zhaoerwei 2024-03-07 15:12:01 +08:00
parent 68584fd5fd
commit d17dc79e24
3 changed files with 75 additions and 60 deletions

View File

@ -51,6 +51,19 @@ export function deletePaper(id) {
});
}
/**
* 获取竞赛试卷菜单
* @param {Object} params
* @param {String} params.group 分组ZZ=中职;GZ=高职
*/
export function getPaperMenu(params) {
return request({
url: '/api/exercise/race/paper/menu',
method: 'GET',
params
});
}
/**
* @param {Object} data
* @param {Array} data.modules 所有模块

View File

@ -8,7 +8,8 @@
<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">
<el-tab-pane label="详情" name="detail">
<div class="tabs-module">
<div v-if="showSeasonInfo" class="tabs-season" v-html="detailHtmlContent" />
<div v-else class="tabs-module">
<template v-for="(mod, modIndex) in moduleList">
<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>
@ -58,7 +59,7 @@ export default {
data() {
return {
widthLeft: 380,
paperName:'试卷',
paperName:'赛季',
paperId:'',
activeModuleName:'detail',
moduleList:[],
@ -67,7 +68,9 @@ export default {
defaultProps: {
disabled: true
},
allTaskDatas:{}
allTaskDatas:{},
showSeasonInfo:false,
detailHtmlContent:'赛季信息'
};
},
computed: {
@ -90,30 +93,38 @@ export default {
drapWidth(width) {
this.widthLeft = Number(width);
},
changeModuleData(paper) {
this.paperName = paper.name;
this.paperId = paper.id;
getPaperDetail(paper.id).then((res) => {
this.moduleList = res.data.moduleVo.modules;
this.moduleTreeDatas = this.moduleList.map(moduleItem=>{
let children = [];
if (moduleItem.group.length) {
children = moduleItem.group.map(taskCatalog=> this.transformTree(taskCatalog));
}
return {
id:id++,
label:moduleItem.moduleName,
duration:moduleItem.duration,
moduleScoreRuleId:moduleItem.moduleScoreRuleId,
customModuleId:moduleItem.customModuleId,
type:'module',
children
};
changeModuleData(paper, season) {
if (paper) {
this.paperName = paper.name;
this.paperId = paper.id;
this.showSeasonInfo = false;
getPaperDetail(paper.id).then((res) => {
this.moduleList = res.data.moduleVo.modules;
this.moduleTreeDatas = this.moduleList.map(moduleItem=>{
let children = [];
if (moduleItem.group.length) {
children = moduleItem.group.map(taskCatalog=> this.transformTree(taskCatalog));
}
return {
id:id++,
label:moduleItem.moduleName,
duration:moduleItem.duration,
moduleScoreRuleId:moduleItem.moduleScoreRuleId,
customModuleId:moduleItem.customModuleId,
type:'module',
children
};
});
this.taskTreeDatas = this.moduleTreeDatas[0].children;
}).catch(error => {
this.$message.error(error.message);
});
this.taskTreeDatas = this.moduleTreeDatas[0].children;
}).catch(error => {
this.$message.error(error.message);
});
} else {
this.showSeasonInfo = true;
this.paperName = season.seasonCode + '—' + season.seasonName;
this.detailHtmlContent = season.detailHtmlContent;
}
},
showScoreRule(moduleScoreRuleId) {
this.$refs.scoreRule.doShow(moduleScoreRuleId);
@ -179,7 +190,11 @@ export default {
}
&::-webkit-scrollbar-track{
background: #06284a;
}
}
.tabs-season{
padding:10px;
color: #fff;
}
.tabs-module{
display: flex;
justify-content: space-between;

View File

@ -9,19 +9,20 @@
</div>
</div>
<el-menu
:default-active="defaultIndex"
class="el-menu-vertical"
background-color="#ffffff00"
text-color="#fff"
active-text-color="#ffd04b"
:default-openeds="[defaultIndex]"
@open="handleOpen"
>
<el-submenu v-for="(paper,paperIndex) in paperList" :key="paperIndex" :index="paper.id+''" @click="showPaperDetail(paper)">
<el-submenu v-for="season in seasonMenu" :key="season.seasonId" :index="season.seasonId+''" @click="showPaperDetail(season)">
<template slot="title">
<span> {{ paper.name }}</span>
<span> {{ season.seasonCode + '—'+season.seasonName }}</span>
</template>
<template v-for="(paper2,paperIndex2) in paperList">
<el-menu-item v-show="!formModel.seasonId||paper.seasonId==formModel.seasonId" :key="paperIndex2" :index="paper2.id+''" @click="showPaperDetail(paper)">
{{ paper2.name }}
<template v-for="paper in season.papers">
<el-menu-item :key="paper.id" :index="paper.id+''" @click="showPaperDetail(paper)">
{{ paper.name }}
</el-menu-item>
</template>
</el-submenu>
@ -30,7 +31,7 @@
</div>
</template>
<script>
import { queryContestSeasonPaged, getPaperList} from '@/api/contest';
import { getPaperMenu } from '@/api/contest';
export default {
name: 'PaperList',
components: {
@ -42,41 +43,27 @@ export default {
group:'GZ' //
},
seasonOptions:[],
paperList:[],
seasonMenu:[],
defaultIndex: ''
};
},
mounted() {
this.loading = false;
getPaperList({ group:'GZ', pageSize:999}).then((res) => {
this.paperList = res.data.list;
this.defaultIndex = this.paperList[0].id + '';
this.$emit('changeModuleData', this.paperList[0]);
});
this.querySeason();
this.queryPaper();
},
methods: {
queryPaper() {
getPaperList({ group:this.formModel.group, pageSize:999}).then((res) => {
this.paperList = res.data.list;
});
this.querySeason();
},
querySeason() {
queryContestSeasonPaged({pageSize:999, group:this.formModel.group }).then((res) => {
this.seasonOptions = res.data.list;
getPaperMenu({ group:this.formModel.group}).then((res) => {
this.seasonMenu = res.data.menu;
this.$emit('changeModuleData', null, this.seasonMenu[0]);
this.defaultIndex = this.seasonMenu[0].seasonId + '';
this.loading = false;
}).catch(error => {
this.$message.error(error.message);
});
},
filterPaper() {
if (this.formModel.seasonId) {
const paper = this.paperList.find(paper=>paper.seasonId == this.formModel.seasonId);
this.defaultIndex = paper.id + '';
this.$emit('changeModuleData', paper);
} else {
this.defaultIndex = this.paperList[0].id + '';
this.$emit('changeModuleData', this.paperList[0]);
}
handleOpen(key) {
const seasonData = this.seasonMenu.find(season=>season.seasonId == key);
this.$emit('changeModuleData', null, seasonData);
},
showPaperDetail(paper) {
this.$emit('changeModuleData', paper);