Header.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div id="Header">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="main header">
  6. <el-col :span="24" class="one">
  7. <el-col :span="12" class="left">
  8. <span>
  9. <i v-if="!collapse" class="el-icon-s-fold"></i>
  10. <i v-else class="el-icon-s-unfold"></i>
  11. </span>
  12. <span>{{ siteInfo.zhTitle }}-吉林专利市场</span>
  13. </el-col>
  14. <el-col :span="12" class="right">
  15. <!-- <el-button type="primary" size="small" @click="toWeb">网站平台</el-button> -->
  16. <span>
  17. <el-icon><UserFilled /></el-icon>
  18. {{ user && user._id ? user.name || user.title || user.expert_name : '游客' }}
  19. </span>
  20. <el-button type="danger" size="small" @click="logout">退出登录</el-button>
  21. </el-col>
  22. </el-col>
  23. </el-col>
  24. </el-col>
  25. </el-row>
  26. </div>
  27. </template>
  28. <script setup lang="ts">
  29. import { siteInfo } from '../../../layout/site'
  30. import store from '@/stores/counter'
  31. import type { Ref } from 'vue'
  32. import { ref } from 'vue'
  33. let collapse: Ref<any> = ref(false)
  34. let user: Ref<any> = ref(store.state.user)
  35. // 网站平台
  36. // const toWeb = () => {
  37. // let env = import.meta.env.VITE_APP_ENV
  38. // let path = ''
  39. // if (env == 'development') path = 'http://localhost:8001/zkzxweb'
  40. // else path = '/zkzxweb'
  41. // window.open(path)
  42. // }
  43. // 退出登录
  44. const logout = () => {
  45. localStorage.removeItem('token')
  46. window.location.href = `${import.meta.env.VITE_APP_HOST}`
  47. }
  48. </script>
  49. <style scoped lang="scss">
  50. .main {
  51. background-color: #242f42;
  52. .one {
  53. height: 60px;
  54. border-bottom: 1px solid #f1f1f1;
  55. padding: 0 10px;
  56. display: flex;
  57. .left {
  58. line-height: 60px;
  59. span {
  60. display: inline-block;
  61. margin: 0 10px;
  62. font-size: 22px;
  63. color: #ffffff;
  64. font-weight: bold;
  65. font-family: cursive;
  66. }
  67. }
  68. .right {
  69. text-align: right;
  70. padding: 16px 0;
  71. span {
  72. padding: 0 8px;
  73. color: #ffffff;
  74. position: relative;
  75. top: 1px;
  76. }
  77. .el-icon {
  78. top: 2px;
  79. }
  80. }
  81. }
  82. }
  83. </style>