bestpaper.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template >
  2. <div class="bestpaper_container">
  3. <el-card class="mb10">
  4. <div class="smart_tabs">
  5. <div
  6. class="tab pointer"
  7. v-for="item in tabList"
  8. :class="tabActive == item.code ? 'tab_active' : ''"
  9. @click="switchTab(item.code)"
  10. >
  11. {{ item.label }}
  12. </div>
  13. </div>
  14. </el-card>
  15. <div>
  16. <keep-alive>
  17. <famous-paper v-if="tabActive == 0"></famous-paper>
  18. </keep-alive>
  19. <keep-alive>
  20. <history-paper :queryYear="queryYear" v-if="tabActive == 1"></history-paper>
  21. </keep-alive>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import MxCondition from '@/components/MxCondition/mx-condition'
  27. import HistoryPaper from './components/history-paper'
  28. import FamousPaper from './components/famous-paper'
  29. export default {
  30. components:{
  31. FamousPaper,
  32. MxCondition,
  33. HistoryPaper
  34. },
  35. data() {
  36. return {
  37. tabActive: 0,
  38. tabList:[
  39. {
  40. label:'名校试卷',
  41. code:0
  42. },
  43. {
  44. label:'历年真题',
  45. code:1
  46. }
  47. ],
  48. queryParams:{
  49. paperSubject:'',
  50. paperGrade:'',
  51. paperType:'',
  52. paperArea:'',
  53. paperYear:'',
  54. },
  55. queryYear:'',
  56. requireFields:['paperSubject','paperGrade','paperType','paperArea','paperYear'],
  57. };
  58. },
  59. created() {
  60. let query = this.$route.query;
  61. // 设置默认高亮
  62. this.tabActive = query.tabActive ? query.tabActive : 0;
  63. this.queryYear = query.year ? query.year : '';
  64. },
  65. methods: {
  66. handleQuery(){
  67. },
  68. handleInvalidQuery(){
  69. },
  70. switchTab(index) {
  71. this.tabActive = index;
  72. },
  73. },
  74. };
  75. </script>
  76. <style scoped>
  77. .bestpaper_container {
  78. padding: 20px;
  79. }
  80. .smart_tabs {
  81. display: flex;
  82. align-items: center;
  83. margin-bottom: 12px;
  84. }
  85. .smart_tabs .tab {
  86. text-align: center;
  87. flex: 1;
  88. padding: 8px 0 24px 0;
  89. border-bottom: 4px solid transparent;
  90. }
  91. .smart_tabs .tab_active {
  92. color: #47c6a2;
  93. border-bottom: 4px solid #47c6a2;
  94. }
  95. </style>