HeaderLayout.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <div class="header">
  3. <div class="tool">
  4. <a-icon type="menu-unfold" @click="$emit('clickUnFold')"/>
  5. </div>
  6. <div class="user-wrapper">
  7. <set-language class="set_lang" />
  8. <a href="/">
  9. <a-icon type="home"/>
  10. </a>
  11. <a @click="logout" style="margin-left: 20px">
  12. <a-icon type="logout"/>
  13. </a>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import SetLanguage from '@/components/SetLanguage/SetLanguage'
  19. export default {
  20. name: 'HeaderComponent',
  21. components: {SetLanguage},
  22. methods: {
  23. logout() {
  24. this.$api.auth.logout().then(() => {
  25. this.$message.success('注销成功')
  26. this.$router.push('/login')
  27. })
  28. }
  29. }
  30. }
  31. </script>
  32. <style lang="less" scoped>
  33. .header {
  34. height: 64px;
  35. padding: 0 20px 0 0;
  36. background: #fff;
  37. box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.05);
  38. @media (prefers-color-scheme: dark) {
  39. background: #28292c;
  40. box-shadow: 1px 1px 0 0 #404040;
  41. }
  42. position: fixed;
  43. width: 100%;
  44. }
  45. .tool {
  46. position: fixed;
  47. left: 20px;
  48. @media (min-width: 512px) {
  49. display: none;
  50. }
  51. }
  52. .user-wrapper {
  53. position: fixed;
  54. right: 20px;
  55. }
  56. .set_lang {
  57. display: inline;
  58. margin-right: 25px;
  59. }
  60. </style>