This commit is contained in:
fan 2024-03-07 18:00:44 +08:00
commit c7a622eadf
3 changed files with 80 additions and 61 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,9 +93,11 @@ export default {
drapWidth(width) {
this.widthLeft = Number(width);
},
changeModuleData(paper) {
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=>{
@ -114,6 +119,12 @@ export default {
}).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);
@ -180,6 +191,10 @@ 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,21 @@
</div>
</div>
<el-menu
:default-active="defaultIndex"
class="el-menu-vertical"
background-color="#ffffff00"
text-color="#fff"
active-text-color="#ffd04b"
:default-openeds="defaultOpenIndex"
:default-active="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 +32,7 @@
</div>
</template>
<script>
import { queryContestSeasonPaged, getPaperList} from '@/api/contest';
import { getPaperMenu } from '@/api/contest';
export default {
name: 'PaperList',
components: {
@ -42,41 +44,30 @@ export default {
group:'GZ' //
},
seasonOptions:[],
paperList:[],
defaultIndex: ''
seasonMenu:[],
defaultIndex: '',
defaultOpenIndex:[]
};
},
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.defaultOpenIndex = [this.seasonMenu[0].seasonId + ''];
this.defaultIndex = '';
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) {
this.defaultIndex = '';
const seasonData = this.seasonMenu.find(season=>season.seasonId == key);
this.$emit('changeModuleData', null, seasonData);
},
showPaperDetail(paper) {
this.$emit('changeModuleData', paper);