Header.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <div class="header">
  3. <div class="left">
  4. <img class="first" src="../assets/three.png" alt="" />
  5. <div class="shu"></div>
  6. <img class="logo" src="../assets/white-logo.png" alt="" />
  7. </div>
  8. <div class="right">
  9. <img class="user-icon" src="../assets/user.png" alt="" />
  10. <div class="user">{{ userName }}</div>
  11. <div class="quit" @click="quit">[退出]</div>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. import store from "../store";
  17. import router from "../router";
  18. export default {
  19. setup() {
  20. let userName = localStorage.staffName;
  21. function quit() {
  22. localStorage.clear();
  23. store.commit("changeLogin", false);
  24. router.push({ path: "/login" });
  25. }
  26. return {
  27. quit,
  28. userName,
  29. };
  30. },
  31. };
  32. </script>
  33. <style scoped>
  34. .header {
  35. width: 100%;
  36. height: 60px;
  37. background: #212029;
  38. display: flex;
  39. align-items: center;
  40. justify-content: space-between;
  41. }
  42. .left,
  43. .right {
  44. display: flex;
  45. align-items: center;
  46. }
  47. .first {
  48. width: 22px;
  49. height: 20px;
  50. margin: 0 22px;
  51. }
  52. .shu {
  53. width: 1px;
  54. height: 60px;
  55. background: #101015;
  56. margin-right: 22px;
  57. }
  58. .logo {
  59. width: 120px;
  60. height: 40px;
  61. }
  62. .title {
  63. font-size: 21px;
  64. font-family: PingFangSC-Regular, PingFang SC;
  65. font-weight: 400;
  66. color: #ffffff;
  67. margin-left: 26px;
  68. }
  69. .user-icon {
  70. width: 18px;
  71. height: 18px;
  72. margin-right: 16px;
  73. }
  74. .user,
  75. .quit {
  76. font-size: 14px;
  77. font-family: PingFangSC-Medium, PingFang SC;
  78. font-weight: 500;
  79. color: #ffffff;
  80. cursor: pointer;
  81. margin-right: 16px;
  82. }
  83. </style>