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

View File

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