WHeader.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <div class="w-header">
  3. <div class="w-header-row">
  4. <div class="w-header-row-left">
  5. <ul>
  6. <li :class="value==='todo'?'active':''">
  7. <a href="javascript:void(0)" @click="tabPage('todo')"><i class="ft icon">&#xe89e;</i>待办</a>
  8. </li><li :class="value==='project'?'active':''">
  9. <a href="javascript:void(0)" @click="tabPage('project')"><i class="ft icon">&#xe6b8;</i>项目</a>
  10. </li><li :class="value==='doc'?'active':''">
  11. <a href="javascript:void(0)" @click="tabPage('doc')"><i class="ft icon">&#xe915;</i>知识库</a>
  12. </li><li :class="value==='team'?'active':''">
  13. <a href="javascript:void(0)" @click="tabPage('team')"><i class="ft icon">&#xe90d;</i>同事</a>
  14. </li>
  15. </ul>
  16. </div>
  17. <div class="w-header-row-flex"></div>
  18. <div class="w-header-row-right">
  19. <div class="user-info">
  20. <span class="username">欢迎您,{{userInfo.username || "尊敬的会员"}}!</span>
  21. <ul>
  22. <li><span class="ft hover">个人中心</span></li>
  23. <li @click="logout"><span class="ft hover">退出登录</span></li>
  24. </ul>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. </template>
  30. <style lang="scss" scoped>
  31. .w-header {
  32. z-index: 15;
  33. height: 40px;
  34. position: fixed;
  35. left: 0;
  36. top: 0;
  37. right: 0;
  38. font-size: 14px;
  39. background: #0396f2 linear-gradient(45deg, #0396f2 0%, #0285d7 100%);
  40. box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.25);
  41. .icon {
  42. font-size: 16px;
  43. margin-right: 3px;
  44. }
  45. .w-header-row {
  46. display: flex;
  47. color: #fff;
  48. height: 40px;
  49. position: relative;
  50. z-index: 10;
  51. margin: 0 32px;
  52. .w-header-row-left {
  53. max-width: 50%;
  54. white-space: nowrap;
  55. overflow: hidden;
  56. overflow-x: auto;
  57. -webkit-backface-visibility: hidden;
  58. -webkit-overflow-scrolling: touch;
  59. -webkit-perspective: 1000;
  60. li {
  61. line-height: 40px;
  62. color: #fff;
  63. display: inline-block;
  64. a {
  65. color: #fff;
  66. display: block;
  67. width: 116px;
  68. text-align: center;
  69. &:visited {
  70. color: #fff;
  71. }
  72. &:hover {
  73. color: #f2f2f2;
  74. }
  75. }
  76. }
  77. li:hover, li.active {
  78. background: #0277c0;
  79. }
  80. }
  81. .w-header-row-flex {
  82. flex: 1;
  83. }
  84. .w-header-row-right {
  85. white-space: nowrap;
  86. text-align: right;
  87. line-height: 40px;
  88. .user-info {
  89. display: inline-block;
  90. position: relative;
  91. margin-right: 6px;
  92. cursor: pointer;
  93. &:hover {
  94. color: #f0f0f0 !important;
  95. ul {
  96. display: block;
  97. }
  98. }
  99. ul {
  100. display: none;
  101. position: absolute;
  102. background: #fff;
  103. border: 1px solid #eee;
  104. right: 0;
  105. top: 38px;
  106. width: 84px;
  107. text-align: center;
  108. border-radius: 2px;
  109. li {
  110. height: 36px;
  111. line-height: 36px;
  112. color: #666;
  113. border-bottom: 1px solid #eee;
  114. &:last-child {
  115. border-bottom: 0;
  116. }
  117. &:hover {
  118. color: #0396f2;
  119. }
  120. }
  121. }
  122. }
  123. }
  124. }
  125. }
  126. </style>
  127. <script>
  128. export default {
  129. name: 'WHeader',
  130. props: {
  131. value: {
  132. },
  133. },
  134. data() {
  135. return {
  136. userInfo: $A.jsonParse($A.storage("userInfo")),
  137. }
  138. },
  139. mounted() {
  140. },
  141. methods: {
  142. tabPage(path) {
  143. this.goForward({path: '/' + path});
  144. },
  145. logout() {
  146. this.$Modal.confirm({
  147. title: '退出登录',
  148. content: '<p>您确定要退出登录吗?</p>',
  149. onOk: () => {
  150. this.goForward({path: '/'}, true);
  151. },
  152. });
  153. }
  154. },
  155. }
  156. </script>