header.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <!-- 头部组件 -->
  3. <div class="header flex-row-center">
  4. <div class="header-bos flex-row-between">
  5. <div class="positioning flex-row-start">
  6. <img src="@/assets/images/layout/layout1.png" alt="" />
  7. <div>武汉</div>
  8. </div>
  9. <div class="header-box flex-row-start">
  10. <div v-if="!isLoggedIn" class="header-text" @click="goToLogin" style="cursor: pointer">请登录</div>
  11. <div v-if="!isLoggedIn" class="header-text hig">免费注册</div>
  12. <div class="header-text" @click="goToMyOrder">我的订单</div>
  13. <div class="header-text" @click="onPath('/enterprise/companyInfo')">会员中心</div>
  14. <div class="header-text">人才招聘</div>
  15. <div class="header-text">帮助中心</div>
  16. <div class="header-text end">在线客服</div>
  17. </div>
  18. </div>
  19. </div>
  20. </template>
  21. <script setup lang="ts">
  22. import { useRouter } from 'vue-router';
  23. import { useUserStore } from '@/store/modules/user';
  24. import { computed } from 'vue';
  25. import { onPath } from '@/utils/siteConfig';
  26. const router = useRouter();
  27. const userStore = useUserStore();
  28. // 判断是否已登录
  29. const isLoggedIn = computed(() => !!userStore.token);
  30. const goToLogin = () => {
  31. router.push('/login');
  32. };
  33. const goToMyOrder = () => {
  34. onPath('/order/orderManage');
  35. };
  36. </script>
  37. <style lang="scss" scoped>
  38. .header {
  39. width: 100%;
  40. height: 40px;
  41. background-color: #efefef;
  42. .header-bos {
  43. width: 1200px;
  44. height: 100%;
  45. .positioning {
  46. font-weight: 400;
  47. font-size: 14px;
  48. color: #322b2b;
  49. img {
  50. height: 20px;
  51. width: 20px;
  52. margin-right: 10px;
  53. }
  54. }
  55. .header-box {
  56. font-weight: 400;
  57. font-size: 14px;
  58. color: #101828;
  59. .header-text {
  60. padding-right: 14px;
  61. margin-right: 14px;
  62. position: relative;
  63. &::after {
  64. content: '';
  65. position: absolute;
  66. width: 1px;
  67. height: 12px;
  68. background-color: #b7b7b7;
  69. right: 0;
  70. top: 4px;
  71. }
  72. &.end {
  73. padding-right: 0;
  74. margin-right: 0;
  75. &::after {
  76. display: none;
  77. }
  78. }
  79. &.hig {
  80. color: #e7000b;
  81. }
  82. }
  83. }
  84. }
  85. }
  86. </style>