index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. <product :province="province" :place="place" news="1"></product>
  12. </van-tab>
  13. <van-tab title="人才对接在线">
  14. <personal :province="province" :place="place" news="2"></personal>
  15. </van-tab>
  16. <van-tab title="专家培训在线">
  17. <exports :province="province" :place="place" news="3"></exports>
  18. </van-tab>
  19. </van-tabs> -->
  20. <span v-if="columnview == '1'">
  21. <product :province="province" :place="place"></product>
  22. </span>
  23. <span v-else-if="columnview == '2'">
  24. <personal :province="province" :place="place"></personal>
  25. </span>
  26. <span v-else-if="columnview == '3'">
  27. <exports :province="province" :place="place"></exports>
  28. </span>
  29. </el-col>
  30. <!-- <el-col :span="24" class="foot">
  31. <footInfo @changetxt="changetxt"></footInfo>
  32. </el-col> -->
  33. </el-col>
  34. </el-row>
  35. </div>
  36. </template>
  37. <script>
  38. import { mapState, mapMutations, createNamespacedHelpers } from 'vuex';
  39. import NavBar from '@/layout/common/topInfo.vue';
  40. import footInfo from '@/layout/common/footInfo.vue';
  41. import product from './parts/product.vue';
  42. import personal from './parts/personal.vue';
  43. import exports from './parts/exports.vue';
  44. const { mapActions: dock } = createNamespacedHelpers('dock');
  45. const { mapActions: place } = createNamespacedHelpers('place');
  46. const jwt = require('jsonwebtoken');
  47. export default {
  48. name: 'index',
  49. props: {},
  50. components: {
  51. NavBar,
  52. // footInfo,
  53. product,
  54. personal,
  55. exports,
  56. },
  57. data: function() {
  58. return {
  59. // 头部标题
  60. title: '',
  61. // meta为true
  62. isleftarrow: '',
  63. // 返回
  64. navShow: true,
  65. active: 0,
  66. // 省
  67. province: [],
  68. // 市
  69. place: [],
  70. // 显示模块
  71. columnview: '1',
  72. };
  73. },
  74. async created() {
  75. await this.searchPlace();
  76. },
  77. methods: {
  78. ...mapMutations(['setUser']),
  79. ...place({ palcequery: 'query', transactiondtetle: 'delete' }),
  80. async searchPlace() {
  81. let res1 = await this.palcequery({ level: 1 });
  82. let arr = await this.palcequery({ level: 2 });
  83. if (res1 || arr) {
  84. this.$set(this, `province`, res1.data);
  85. this.$set(this, `place`, arr.data);
  86. }
  87. },
  88. sesstoken() {
  89. if (this.token) {
  90. sessionStorage.setItem('token', this.token);
  91. let user = jwt.decode(this.token);
  92. if (user && user.uid) {
  93. this.setUser(user);
  94. }
  95. }
  96. },
  97. changetxt(data) {
  98. this.$set(this, `columnview`, data.code);
  99. console.log(data);
  100. },
  101. // 选择栏目
  102. changecolumn() {
  103. if (this.columnview == '1') {
  104. this.$set(this, `title`, '科技成果在线');
  105. } else if (this.columnview == '2') {
  106. this.$set(this, `title`, '人才对接在线');
  107. } else if (this.columnview == '3') {
  108. this.$set(this, `title`, '专家培训在线');
  109. }
  110. },
  111. },
  112. computed: {
  113. ...mapState(['user']),
  114. token() {
  115. return this.$route.query.token;
  116. },
  117. },
  118. watch: {
  119. token: {
  120. immediate: true,
  121. deep: true,
  122. handler(val) {
  123. // console.log(val);
  124. this.sesstoken();
  125. },
  126. },
  127. columnview: {
  128. immediate: true,
  129. deep: true,
  130. handler(val) {
  131. this.changecolumn();
  132. },
  133. },
  134. },
  135. mounted() {
  136. // this.title = this.$route.meta.title;
  137. this.isleftarrow = this.$route.meta.isleftarrow;
  138. },
  139. };
  140. </script>
  141. <style lang="less" scoped>
  142. .style {
  143. width: 100%;
  144. min-height: 667px;
  145. position: relative;
  146. background-color: #f9fafc;
  147. }
  148. .top {
  149. height: 46px;
  150. overflow: hidden;
  151. position: relative;
  152. z-index: 999;
  153. }
  154. .main {
  155. min-height: 570px;
  156. }
  157. .foot {
  158. position: absolute;
  159. bottom: 0;
  160. }
  161. </style>