index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="style">
  5. <el-col :span="24" class="top">
  6. <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
  7. </el-col>
  8. <el-col :span="24" class="main">
  9. <van-tabs v-model="active">
  10. <van-tab title="科技资讯">
  11. <kjzxList :list="kjzxLists" @detailBtn="detailBtn"></kjzxList>
  12. </van-tab>
  13. <van-tab title="工作动态">
  14. <kjzxList :list="gzdtLists" @detailBtn="detailBtn"></kjzxList>
  15. </van-tab>
  16. <van-tab title="通知通告">
  17. <kjzxList :list="tztgLists" @detailBtn="detailBtn"></kjzxList>
  18. </van-tab>
  19. <van-tab title="技术前沿">
  20. <kjzxList :list="jsqyLists" @detailBtn="detailBtn"></kjzxList>
  21. </van-tab>
  22. </van-tabs>
  23. </el-col>
  24. <!-- <el-col :span="24" class="foot">
  25. <footInfo></footInfo>
  26. </el-col> -->
  27. </el-col>
  28. </el-row>
  29. </div>
  30. </template>
  31. <script>
  32. import { mapState, createNamespacedHelpers } from 'vuex';
  33. const { mapActions: journcolumn } = createNamespacedHelpers('journcolumn');
  34. const { mapActions: journnews } = createNamespacedHelpers('journnews');
  35. import NavBar from '@/layout/common/topInfo.vue';
  36. import footInfo from '@/layout/common/footInfo.vue';
  37. import kjzxList from './parts/kjzxList.vue';
  38. export default {
  39. metaInfo() {
  40. return { title: this.$route.meta.title };
  41. },
  42. name: 'index',
  43. props: {},
  44. components: {
  45. NavBar,
  46. // footInfo,
  47. kjzxList,
  48. },
  49. data: function() {
  50. return {
  51. // 头部标题
  52. title: '',
  53. // meta为true
  54. isleftarrow: '',
  55. // 返回
  56. navShow: true,
  57. //菜单显示
  58. active: '1',
  59. //科技资讯
  60. kjzxLists: [],
  61. //科技动态
  62. gzdtLists: [],
  63. //通知通告
  64. tztgLists: [],
  65. //技术前沿
  66. jsqyLists: [],
  67. //栏目
  68. column: [],
  69. };
  70. },
  71. async created() {
  72. await this.searchColumn();
  73. await this.searchList();
  74. },
  75. methods: {
  76. ...journcolumn({ columnquery: 'query' }),
  77. ...journnews({ newsquery: 'query' }),
  78. async searchColumn() {
  79. const res = await this.columnquery();
  80. if (this.$checkRes(res)) {
  81. this.$set(this, `column`, res.data);
  82. }
  83. },
  84. async searchList() {
  85. let col = this.column.find(i => i.site == 'kjzx');
  86. if (col) {
  87. const res = await this.newsquery({ column_id: col.id });
  88. if (this.$checkRes(res)) {
  89. this.$set(this, `kjzxLists`, _.orderBy(res.data, ['publish_time'], ['desc']));
  90. }
  91. }
  92. let col2 = this.column.find(i => i.site == 'gzdt');
  93. if (col2) {
  94. const res = await this.newsquery({ column_id: col2.id });
  95. if (this.$checkRes(res)) {
  96. this.$set(this, `gzdtLists`, _.orderBy(res.data, ['publish_time'], ['desc']));
  97. }
  98. }
  99. let col3 = this.column.find(i => i.site == 'tztg');
  100. if (col3) {
  101. const res = await this.newsquery({ column_id: col3.id });
  102. if (this.$checkRes(res)) {
  103. this.$set(this, `tztgLists`, _.orderBy(res.data, ['publish_time'], ['desc']));
  104. }
  105. }
  106. let col4 = this.column.find(i => i.site == 'jsqy');
  107. if (col4) {
  108. const res = await this.newsquery({ column_id: col4.id });
  109. if (this.$checkRes(res)) {
  110. this.$set(this, `jsqyLists`, _.orderBy(res.data, ['publish_time'], ['desc']));
  111. }
  112. }
  113. },
  114. detailBtn(data) {
  115. this.$router.push({ path: '/journ/detail', query: { id: data.id } });
  116. },
  117. },
  118. computed: {
  119. ...mapState(['user']),
  120. },
  121. mounted() {
  122. this.title = this.$route.meta.title;
  123. this.isleftarrow = this.$route.meta.isleftarrow;
  124. },
  125. metaInfo() {
  126. return { title: this.$route.meta.title };
  127. },
  128. };
  129. </script>
  130. <style lang="less" scoped>
  131. .style {
  132. width: 100%;
  133. min-height: 667px;
  134. position: relative;
  135. background-color: #f9fafc;
  136. }
  137. .top {
  138. height: 46px;
  139. overflow: hidden;
  140. }
  141. .main {
  142. min-height: 570px;
  143. margin: 0 0 50px 0;
  144. }
  145. .foot {
  146. position: absolute;
  147. bottom: 0;
  148. }
  149. /deep/.van-tabs__line {
  150. width: 60px;
  151. }
  152. </style>