index copy.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24">
  5. <el-col :span="24">
  6. <top></top>
  7. </el-col>
  8. <el-col :span="24">
  9. <menus></menus>
  10. </el-col>
  11. <el-col :span="24" class="main">
  12. <div class="w_1200">
  13. <el-col :span="24" class="one">
  14. <el-col :span="10" class="left">
  15. <el-col :span="24" class="top animate__animated animate__backInDown">
  16. <tpxw :tpxwList="tpxwList"></tpxw>
  17. </el-col>
  18. <el-col :span="24" class="down animate__animated animate__backInUp">
  19. <mtjj :mtjjList="mtjjList"></mtjj>
  20. </el-col>
  21. </el-col>
  22. <el-col :span="14" class="right animate__animated animate__fadeInRightBig">
  23. <kjdt :kjdtList="kjdtList"></kjdt>
  24. </el-col>
  25. </el-col>
  26. </div>
  27. </el-col>
  28. <el-col :span="24">
  29. <foot></foot>
  30. </el-col>
  31. </el-col>
  32. </el-row>
  33. </div>
  34. </template>
  35. <script>
  36. import top from '@/components/common/top.vue';
  37. import menus from '@/components/common/menus.vue';
  38. import foot from '@/components/common/foot.vue';
  39. // 科技资讯
  40. import tpxw from '@/layout/kjzx/tpxw.vue';
  41. import mtjj from '@/layout/kjzx/mtjj.vue';
  42. import kjdt from '@/layout/kjzx/kjdt.vue';
  43. import { mapState, createNamespacedHelpers } from 'vuex';
  44. const { mapActions: concolumn } = createNamespacedHelpers('concolumn');
  45. const { mapActions: connews } = createNamespacedHelpers('connews');
  46. export default {
  47. metaInfo() {
  48. return { title: this.$route.meta.title };
  49. },
  50. name: 'index',
  51. props: {},
  52. components: {
  53. top,
  54. menus,
  55. foot,
  56. // 科技资讯
  57. tpxw,
  58. mtjj,
  59. kjdt,
  60. },
  61. data: function() {
  62. return {
  63. // 图片新闻
  64. tpxwList: [],
  65. // 媒体聚焦
  66. mtjjList: [],
  67. // 科技动态
  68. kjdtList: [],
  69. };
  70. },
  71. async created() {
  72. await this.search();
  73. },
  74. methods: {
  75. ...concolumn({ columnquery: 'query', columnfetch: 'fetch' }),
  76. ...connews({ connewsquery: 'query', connewsfetch: 'fetch' }),
  77. async search() {
  78. let res = await this.columnquery();
  79. if (this.$checkRes(res)) {
  80. let tpxw = res.data.find(i => i.site == 'tpxw');
  81. if (tpxw) {
  82. let res = await this.connewsquery({ limit: 6, column_id: tpxw.id });
  83. if (this.$checkRes(res)) this.$set(this, `${tpxw.site}List`, res.data);
  84. }
  85. let kjdt = res.data.find(i => i.site == 'kjdt');
  86. if (kjdt) {
  87. let res = await this.connewsquery({ limit: 18, column_id: kjdt.id });
  88. if (this.$checkRes(res)) this.$set(this, `${kjdt.site}List`, res.data);
  89. }
  90. let mtjj = res.data.find(i => i.site == 'mtjj');
  91. if (mtjj) {
  92. let res = await this.connewsquery({ limit: 5, column_id: mtjj.id });
  93. if (this.$checkRes(res)) this.$set(this, `${mtjj.site}List`, res.data);
  94. }
  95. }
  96. },
  97. },
  98. computed: {
  99. ...mapState(['user']),
  100. },
  101. watch: {},
  102. };
  103. </script>
  104. <style lang="less" scoped>
  105. .w_1200 {
  106. width: 1200px;
  107. margin: 0 auto;
  108. }
  109. .main {
  110. min-height: 500px;
  111. margin: 10px 0;
  112. .one {
  113. height: 680px;
  114. overflow: hidden;
  115. .left {
  116. height: 680px;
  117. overflow: hidden;
  118. margin: 0 10px 0 0;
  119. .top {
  120. height: 340px;
  121. background: #fff;
  122. margin: 0 0 10px 0;
  123. }
  124. .down {
  125. height: 330px;
  126. overflow: hidden;
  127. background: #fff;
  128. }
  129. }
  130. .right {
  131. width: 690px;
  132. height: 680px;
  133. background: #fff;
  134. }
  135. }
  136. }
  137. </style>