Navbar.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div class="navbar">
  3. <div class="nav-title">智慧校园公寓管理端</div>
  4. <div class="right">
  5. <p class="time">{{ time }}</p>
  6. <el-badge :value="$store.state.inform.readFlag" class="item">
  7. <!-- <svg-icon icon-class="xiaoxizhongxin" /> -->
  8. <div @click="informs">
  9. <IconSvg :W="28" :H="31" name="xiaoxizhongxin" />
  10. </div>
  11. </el-badge>
  12. <div class="photo">
  13. <el-avatar
  14. icon="el-icon-user-solid"
  15. style="width: 53px; height: 53px; margin: 0; line-height: 53px"
  16. >
  17. </el-avatar>
  18. </div>
  19. <div class="name">名字</div>
  20. <div class="out" @click="outLogin">
  21. <IconSvg :W="16" :H="16" name="quit" />
  22. <div class="title">退出</div>
  23. </div>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. import { removeToken } from "@/utils/auth";
  29. import moment from "moment";
  30. import "moment/locale/zh-cn";
  31. export default {
  32. name: "Navbar",
  33. data() {
  34. return {
  35. time: moment().format("YYYY-M-D dddd HH:mm:ss"),
  36. };
  37. },
  38. mounted() {},
  39. methods: {
  40. informs() {
  41. this.$router
  42. .replace({ name: "Inform" })
  43. .then((res) => {})
  44. .catch((err) => {
  45. console.log();
  46. });
  47. },
  48. outLogin() {
  49. this.$confirm("确认退出登录?")
  50. .then((_) => {
  51. this.$store.dispatch("user/logout").then(() => {
  52. this.$message({
  53. message: "退出成功",
  54. type: "success",
  55. });
  56. this.$router.replace({ path: "/login" });
  57. });
  58. })
  59. .catch((_) => {});
  60. },
  61. },
  62. };
  63. </script>
  64. <style lang="scss" scoped>
  65. .navbar {
  66. height: 96px;
  67. overflow: hidden;
  68. background: rgba(255, 255, 255, 1);
  69. display: flex;
  70. align-items: center;
  71. justify-content: space-between;
  72. .nav-title {
  73. display: inline-block;
  74. width: 324px;
  75. height: 53px;
  76. line-height: 53px;
  77. color: rgba(0, 0, 0, 1);
  78. font-size: 36px;
  79. font-weight: 500;
  80. margin-left: 22px;
  81. }
  82. .right {
  83. display: flex;
  84. align-items: center;
  85. .time {
  86. width: 241px;
  87. height: 27px;
  88. line-height: 27px;
  89. color: rgba(102, 102, 102, 1);
  90. font-size: 18px;
  91. font-weight: 400;
  92. margin-right: 35px;
  93. // float: right;
  94. }
  95. .photo {
  96. width: 53px;
  97. height: 53px;
  98. margin: 0 4px 0 38px;
  99. }
  100. .name {
  101. // width: 50px;
  102. height: 28px;
  103. color: rgba(51, 51, 51, 1);
  104. font-size: 14px;
  105. font-weight: 500;
  106. line-height: 28px;
  107. padding: 0 15px 0 5px;
  108. margin-right: 13px;
  109. border-right: 1px solid rgba(204, 204, 204, 1);
  110. }
  111. .out {
  112. display: flex;
  113. align-items: center;
  114. padding-right: 18px;
  115. cursor: pointer;
  116. .title {
  117. margin-left: 6px;
  118. font-size: 14px;
  119. }
  120. }
  121. }
  122. }
  123. </style>