list.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <div id="list">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <div class="w_1200">
  6. <el-col :span="5" class="menu">
  7. <el-image :src="squareImage"></el-image>
  8. <span class="menuTitle">Menu</span>
  9. <el-col :span="24" class="menuList" v-for="(item, index) in menuList" :key="index">
  10. <p @click="changeMenu(item.component, index)" :style="`color:${menuIndex == index ? menuColor : ''};margin-left:${20 * (item.indent || 0)}px`">
  11. {{ item.name }}
  12. </p>
  13. </el-col>
  14. </el-col>
  15. <el-col :span="19" class="listInfo">
  16. <component :is="component" v-bind="params"></component>
  17. <!-- <keep-alive>
  18. <component :is="component" v-bind="params"></component>
  19. </keep-alive> -->
  20. </el-col>
  21. </div>
  22. </el-col>
  23. </el-row>
  24. </div>
  25. </template>
  26. <script>
  27. const _ = require('lodash');
  28. import { mapState, createNamespacedHelpers } from 'vuex';
  29. export default {
  30. name: 'list',
  31. props: {},
  32. components: {
  33. question: () => import('./list/question.vue'),
  34. work: () => import('./list/work.vue'),
  35. serve: () => import('./list/serve.vue'),
  36. result: () => import('./list/result.vue'),
  37. },
  38. data: function() {
  39. return {
  40. component: '',
  41. menuList: [
  42. { name: '调研调查', component: 'question', options: { useTab: false, useSearch: false, listModel: 5 } },
  43. { name: '行业研究', component: 'work', options: { useTab: false, useSearch: false, listModel: 6 } },
  44. // { name: '科技服务', options: { useTab: false, useSearch: false, listModel: 2 } },
  45. // { name: '会展服务', component: 'serve', options: { useTab: false, useSearch: false, listModel: 2 }, indent: 1 },
  46. // { name: '成果评价', component: 'result', options: { useTab: false, useSearch: false, listModel: 2 }, indent: 1 },
  47. ],
  48. squareImage: require('@p/live/square_big.png'),
  49. column_name: '',
  50. params: {},
  51. menuColor: 'rgb(254, 149, 14)',
  52. };
  53. },
  54. created() {},
  55. methods: {
  56. changeMenu(component, index) {
  57. if (!component) return;
  58. if (index !== this.menuIndex) this.$router.push({ path: './list', query: { index } });
  59. this.component = component;
  60. },
  61. },
  62. computed: {
  63. ...mapState(['user', 'menuParams']),
  64. pageTitle() {
  65. return `${this.$route.meta.title}`;
  66. },
  67. menuIndex() {
  68. const index = this.$route.query.index || 0;
  69. const obj = this.menuList[index];
  70. const params = {
  71. title: _.get(obj, 'name'),
  72. ..._.get(obj, 'options'),
  73. };
  74. this.$set(this, 'component', _.get(obj, 'component', 'achieve'));
  75. this.$set(this, 'params', params);
  76. return index;
  77. },
  78. },
  79. metaInfo() {
  80. return { title: this.$route.meta.title };
  81. },
  82. };
  83. </script>
  84. <style lang="less" scoped>
  85. .main {
  86. min-height: 500px;
  87. padding: 10px 0;
  88. .menu {
  89. height: 600px;
  90. overflow: hidden;
  91. padding: 15px 10px;
  92. background: no-repeat 100% 100%;
  93. background-image: url('~@p/live/menu_back.jpg');
  94. box-sizing: border-box;
  95. box-shadow: 0 0 10px #bbbaba;
  96. .menuTitle {
  97. font-size: 24px;
  98. color: #92959a;
  99. font-weight: bold;
  100. position: relative;
  101. top: -10px;
  102. left: 10px;
  103. }
  104. .menuList {
  105. height: 60px;
  106. line-height: 60px;
  107. border-bottom: 1px solid #2d64b3;
  108. p {
  109. font-weight: bold;
  110. font-size: 18px;
  111. color: #044b79;
  112. }
  113. }
  114. .menuList:hover {
  115. cursor: pointer;
  116. }
  117. }
  118. .listInfo {
  119. float: right;
  120. width: 78%;
  121. min-height: 600px;
  122. overflow: hidden;
  123. box-shadow: 0 0 10px #2d64b3;
  124. padding: 10px;
  125. }
  126. }
  127. </style>