diff --git a/src/views/contest/paperList.vue b/src/views/contest/paperList.vue index f311640d4..79e7bab3c 100644 --- a/src/views/contest/paperList.vue +++ b/src/views/contest/paperList.vue @@ -8,26 +8,24 @@ 中职 - - - - - - +
+
+ {{ data.seasonCode + '—' + data.seasonName }} + {{ node.label }} +
+
+ @@ -43,10 +41,12 @@ export default { formModel: { group:'GZ' // 高职和中职 }, - seasonOptions:[], - seasonMenu:[], - defaultIndex: '', - defaultOpenIndex:[] + defaultProps: { + disabled: true + }, + menuTreeData:[], + nowData: {}, + expanded_keys:[] }; }, mounted() { @@ -55,22 +55,51 @@ export default { methods: { queryPaper() { 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.menuTreeData = this.transformTree(res.data.menu); + this.$emit('changeModuleData', null, this.menuTreeData[0]); + this.expanded_keys = [this.menuTreeData[0].id]; + this.nowData = this.menuTreeData[0]; this.loading = false; }).catch(error => { this.$message.error(error.message); }); }, - handleOpen(key) { - this.defaultIndex = ''; - const seasonData = this.seasonMenu.find(season=>season.seasonId == key); - this.$emit('changeModuleData', null, seasonData); + handleClick(data) { + this.nowData = data; + if (data.type == 'season') { + this.$emit('changeModuleData', null, data); + } else { + this.$emit('changeModuleData', data); + } }, - showPaperDetail(paper) { - this.$emit('changeModuleData', paper); + transformTree(data) { + const result = []; + for (let i = 0; i < data.length; i++) { + const season = data[i]; + const seasonItem = { + id: season.seasonId, + label: season.seasonName, + seasonName:season.seasonName, + seasonCode:season.seasonCode, + detailHtmlContent:season.detailHtmlContent, + type:'season', + children:[] + }; + if (season.papers) { + for (let i = 0; i < season.papers.length; i++) { + const paper = season.papers[i]; + const paperItem = { + id: paper.id, + label: paper.name, + name:paper.name, + type:'paper' + }; + seasonItem.children.push(paperItem); + } + } + result.push(seasonItem); + } + return result; } } }; @@ -109,31 +138,24 @@ export default { background: #01468B; color: #fff; } + .custom-tree-node{ + width: 100%; + font-size: 16px; + } } } - .el-menu-vertical{ - background-color: transparent; - .el-menu-item{ - &:hover{ - background: #00172E !important; - } - &:focus{ - background-color: #00172E !important; - } - } - } /deep/{ - .el-menu{ - border-right-width: 0; - } - .el-submenu__title{ + .el-tree-node__content{ + height: 56px; + overflow: hidden; + color: #fff; &:hover{ background: #00172E !important; } - &:focus{ - background-color: #00172E !important; - } } + .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{ + background-color: #00172E !important; + } }