Rap 原分销系统代码Web
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

b5f2fd34683b788613b713c71c677e483e324270.svn-base 4.5KB

5 месяцев назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <div class="navbar">
  3. <hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
  4. <breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
  5. <div class="right-menu">
  6. <template v-if="device!=='mobile'">
  7. <search id="header-search" class="right-menu-item" />
  8. <el-tooltip content="项目文档" effect="dark" placement="bottom">
  9. <Doc class="right-menu-item hover-effect" />
  10. </el-tooltip>
  11. <el-tooltip content="全屏缩放" effect="dark" placement="bottom">
  12. <screenfull id="screenfull" class="right-menu-item hover-effect" />
  13. </el-tooltip>
  14. <el-tooltip content="布局设置" effect="dark" placement="bottom">
  15. <size-select id="size-select" class="right-menu-item hover-effect" />
  16. </el-tooltip>
  17. </template>
  18. <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
  19. <div class="avatar-wrapper">
  20. <img :src="user.avatarName ? baseApi + '/avatar/' + user.avatarName : Avatar" class="user-avatar">
  21. <i class="el-icon-caret-bottom" />
  22. </div>
  23. <el-dropdown-menu slot="dropdown">
  24. <span style="display:block;" @click="show = true">
  25. <el-dropdown-item>
  26. 布局设置
  27. </el-dropdown-item>
  28. </span>
  29. <router-link to="/user/center">
  30. <el-dropdown-item>
  31. 个人中心
  32. </el-dropdown-item>
  33. </router-link>
  34. <span style="display:block;" @click="open">
  35. <el-dropdown-item divided>
  36. 退出登录
  37. </el-dropdown-item>
  38. </span>
  39. </el-dropdown-menu>
  40. </el-dropdown>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. import { mapGetters } from 'vuex'
  46. import Breadcrumb from '@/components/Breadcrumb'
  47. import Hamburger from '@/components/Hamburger'
  48. import Doc from '@/components/Doc'
  49. import Screenfull from '@/components/Screenfull'
  50. import SizeSelect from '@/components/SizeSelect'
  51. import Search from '@/components/HeaderSearch'
  52. import Avatar from '@/assets/images/avatar.png'
  53. export default {
  54. components: {
  55. Breadcrumb,
  56. Hamburger,
  57. Screenfull,
  58. SizeSelect,
  59. Search,
  60. Doc
  61. },
  62. data() {
  63. return {
  64. Avatar: Avatar,
  65. dialogVisible: false
  66. }
  67. },
  68. computed: {
  69. ...mapGetters([
  70. 'sidebar',
  71. 'device',
  72. 'user',
  73. 'baseApi'
  74. ]),
  75. show: {
  76. get() {
  77. return this.$store.state.settings.showSettings
  78. },
  79. set(val) {
  80. this.$store.dispatch('settings/changeSetting', {
  81. key: 'showSettings',
  82. value: val
  83. })
  84. }
  85. }
  86. },
  87. methods: {
  88. toggleSideBar() {
  89. this.$store.dispatch('app/toggleSideBar')
  90. },
  91. open() {
  92. this.$confirm('确定注销并退出系统吗?', '提示', {
  93. confirmButtonText: '确定',
  94. cancelButtonText: '取消',
  95. type: 'warning'
  96. }).then(() => {
  97. this.logout()
  98. })
  99. },
  100. logout() {
  101. this.$store.dispatch('LogOut').then(() => {
  102. location.reload()
  103. })
  104. }
  105. }
  106. }
  107. </script>
  108. <style lang="scss" scoped>
  109. .navbar {
  110. height: 50px;
  111. overflow: hidden;
  112. position: relative;
  113. background: #fff;
  114. box-shadow: 0 1px 4px rgba(0,21,41,.08);
  115. .hamburger-container {
  116. line-height: 46px;
  117. height: 100%;
  118. float: left;
  119. cursor: pointer;
  120. transition: background .3s;
  121. -webkit-tap-highlight-color:transparent;
  122. &:hover {
  123. background: rgba(0, 0, 0, .025)
  124. }
  125. }
  126. .breadcrumb-container {
  127. float: left;
  128. }
  129. .errLog-container {
  130. display: inline-block;
  131. vertical-align: top;
  132. }
  133. .right-menu {
  134. float: right;
  135. height: 100%;
  136. line-height: 50px;
  137. &:focus {
  138. outline: none;
  139. }
  140. .right-menu-item {
  141. display: inline-block;
  142. padding: 0 8px;
  143. height: 100%;
  144. font-size: 18px;
  145. color: #5a5e66;
  146. vertical-align: text-bottom;
  147. &.hover-effect {
  148. cursor: pointer;
  149. transition: background .3s;
  150. &:hover {
  151. background: rgba(0, 0, 0, .025)
  152. }
  153. }
  154. }
  155. .avatar-container {
  156. margin-right: 30px;
  157. .avatar-wrapper {
  158. margin-top: 5px;
  159. position: relative;
  160. .user-avatar {
  161. cursor: pointer;
  162. width: 40px;
  163. height: 40px;
  164. border-radius: 10px;
  165. }
  166. .el-icon-caret-bottom {
  167. cursor: pointer;
  168. position: absolute;
  169. right: -20px;
  170. top: 25px;
  171. font-size: 12px;
  172. }
  173. }
  174. }
  175. }
  176. }
  177. </style>