数字化园区前端项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Header.vue 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <!-- 导航 -->
  2. <template>
  3. <div class="header">
  4. <div class="wrap">
  5. <section class="wrap_left">
  6. <!-- <img src="@assets/image/index/logo.png" alt="logo" />
  7. 小昆山数据可视化平台 -->
  8. <img src="@assets/image/index/logo-n.png" alt="logo" />
  9. </section>
  10. <section class="wrap_right">
  11. <div>
  12. <router-link
  13. v-for="item in nav"
  14. :key="item.name"
  15. :to="item.path"
  16. >{{ item.name }}</router-link>
  17. </div>
  18. <section class="enterprise pointer" @click="goMyCompany">
  19. <img src="@assets/image/index/icon_company.png" alt="icon_company" />
  20. 我的企业
  21. </section>
  22. </section>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  28. //例如:import 《组件名称》 from '《组件路径》';
  29. import { routerOpenInNewWindow } from "@/utils/common.js";
  30. import { mapGetters } from "vuex";
  31. export default {
  32. //import引入的组件需要注入到对象中才能使用
  33. components: {},
  34. computed: {
  35. ...mapGetters({
  36. currentAccount: "currentAccount",
  37. }),
  38. },
  39. data() {
  40. //这里存放数据
  41. return {
  42. nav: [
  43. {
  44. name: "园区首页",
  45. path: "/index",
  46. },
  47. {
  48. name: "招商服务",
  49. path: "/investment-service",
  50. },
  51. {
  52. name: "上下游企业",
  53. path: "/company-list",
  54. },
  55. {
  56. name: "园区资讯问答",
  57. path: "/park-information",
  58. },
  59. ],
  60. };
  61. },
  62. //监控data中的数据变化
  63. watch: {},
  64. //方法集合
  65. methods: {
  66. clickRouter(path) {
  67. routerOpenInNewWindow({
  68. path,
  69. });
  70. },
  71. // 前往我的企业
  72. goMyCompany() {
  73. let path = '/my-business';
  74. console.log(this.currentAccount,'this.currentAccount')
  75. if(!this.currentAccount){
  76. path = '/login'
  77. }
  78. this.$router.push(path);
  79. },
  80. },
  81. //生命周期 - 创建完成(可以访问当前this实例)
  82. created() {},
  83. //生命周期 - 挂载完成(可以访问DOM元素)
  84. mounted() {
  85. },
  86. };
  87. </script>
  88. <style lang="scss" scoped>
  89. //@import url(); 引入公共css类
  90. .header {
  91. @include size(100%, 100px);
  92. color: $color-white;
  93. border-bottom: solid 1px rgba(255, 255, 255, 0.5);
  94. background: transparent;
  95. @include flex(row, center, center, wrap);
  96. @include border-box;
  97. }
  98. .wrap {
  99. @include size($wrapWidth, 100%);
  100. @include flex(row, space-between, center, wrap);
  101. .wrap_left {
  102. @include flex(row, center, center, wrap);
  103. img {
  104. @include size(auto, 45px);
  105. margin-right: 10px;
  106. }
  107. }
  108. .wrap_right {
  109. height: 100%;
  110. @include flex(row, flex-end, center, wrap);
  111. > div {
  112. height: 100%;
  113. @include flex(row, space-between, center, wrap);
  114. a {
  115. height: 100%;
  116. margin-right: 50px;
  117. @include font(18px, $color-white);
  118. @include flex(row, center, center, wrap);
  119. @include hoverLine(2px, $color-white);
  120. }
  121. .router-link-active::after {
  122. content: "";
  123. position: absolute;
  124. height: 2px;
  125. width: 100%;
  126. background: $color-white;
  127. bottom: 0;
  128. left: 0;
  129. }
  130. }
  131. }
  132. .enterprise {
  133. @include size(160px, 40px);
  134. border: solid 1px rgba(255, 255, 255, 0.5);
  135. border-radius: 20px;
  136. @include border-box;
  137. @include flex(row, center, center, wrap);
  138. img {
  139. @include size(20px, 20px);
  140. margin-right: 10px;
  141. }
  142. }
  143. }
  144. </style>