Navbar.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <div class="navbar">
  3. <!--<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />-->
  4. <div class="left-logo-box">
  5. <!--<img src="@/assets/ZDimages/icon_logo.png">-->
  6. <img :src="circularLogo">
  7. <!--<p>实验室安全智能监测与控制系统</p>-->
  8. <p>危化品智能存储管理系统</p>
  9. </div>
  10. <!--<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/>-->
  11. <top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/>
  12. <div class="nav-icon-max-box">
  13. <div @click="goPage('message')">
  14. <img src="@/assets/ZDimages/top_nav_icon_02.png">
  15. </div>
  16. <!--按钮首页-->
  17. <!--<div @click="goPage('home')" v-if="userType!='22'&&initPage== 'true'">-->
  18. <!--<img src="@/assets/ZDimages/top_nav_icon_01.png">-->
  19. <!--</div>-->
  20. </div>
  21. <div class="right-menu">
  22. <!--<template v-if="device!=='mobile'">-->
  23. <!--<search id="header-search" class="right-menu-item" />-->
  24. <!--<screenfull id="screenfull" class="right-menu-item hover-effect" />-->
  25. <!--</template>-->
  26. <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
  27. <div class="avatar-wrapper" style="display: flex">
  28. <img :src="avatar" class="user-avatar" v-if="avatar">
  29. <img src="@/assets/ZDimages/tx_cion.png" class="user-avatar" v-else>
  30. <p style="color:#fff;font-size:14px;margin:0 20px 0 0;line-height:80px;text-align: center">{{name}}</p>
  31. <p class="el-icon-arrow-down" style="font-size:20px;color:#fff;margin:32px 0;"></p>
  32. <!--<i class="el-icon-arrow-down" />-->
  33. </div>
  34. <el-dropdown-menu slot="dropdown" style="margin:0;">
  35. <!--<router-link to="/user/profile">-->
  36. <!--<router-link to="/mine">-->
  37. <router-link to="/comprehensive/system/mine">
  38. <el-dropdown-item>个人中心</el-dropdown-item>
  39. </router-link>
  40. <!--<el-dropdown-item @click.native="setting = true">-->
  41. <!--<span>布局设置</span>-->
  42. <!--</el-dropdown-item>-->
  43. <el-dropdown-item divided @click.native="logout">
  44. <span>退出登录</span>
  45. </el-dropdown-item>
  46. </el-dropdown-menu>
  47. </el-dropdown>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. import { mapGetters } from 'vuex'
  53. import Breadcrumb from '@/components/Breadcrumb'
  54. import TopNav from '@/components/TopNav'
  55. import Hamburger from '@/components/Hamburger'
  56. import Screenfull from '@/components/Screenfull'
  57. import SizeSelect from '@/components/SizeSelect'
  58. import Search from '@/components/HeaderSearch'
  59. import RuoYiGit from '@/components/RuoYi/Git'
  60. import RuoYiDoc from '@/components/RuoYi/Doc'
  61. export default {
  62. components: {
  63. Breadcrumb,
  64. TopNav,
  65. Hamburger,
  66. Screenfull,
  67. SizeSelect,
  68. Search,
  69. RuoYiGit,
  70. RuoYiDoc
  71. },
  72. data(){
  73. return{
  74. circularLogo:localStorage.getItem('circularLogo'),
  75. userType:localStorage.getItem('userType'),
  76. initPage:localStorage.getItem('initPage'),
  77. }
  78. },
  79. computed: {
  80. ...mapGetters([
  81. 'sidebar',
  82. 'avatar',
  83. 'device',
  84. "name"
  85. ]),
  86. setting: {
  87. get() {
  88. return this.$store.state.settings.showSettings
  89. },
  90. set(val) {
  91. this.$store.dispatch('settings/changeSetting', {
  92. key: 'showSettings',
  93. value: val
  94. })
  95. }
  96. },
  97. topNav: {
  98. get() {
  99. return this.$store.state.settings.topNav
  100. }
  101. }
  102. },
  103. methods: {
  104. goPage(type){
  105. if(type == 'message'){
  106. this.$router.push({ path: '/message' });
  107. }else if(type == 'home'){
  108. this.$router.push({ path: '/home' });
  109. }
  110. },
  111. toggleSideBar() {
  112. this.$store.dispatch('app/toggleSideBar')
  113. },
  114. async logout() {
  115. this.$confirm('确定注销并退出系统吗?', '提示', {
  116. confirmButtonText: '确定',
  117. cancelButtonText: '取消',
  118. type: 'warning'
  119. }).then(() => {
  120. this.$store.dispatch('LogOut').then(() => {
  121. this.$router.push({ path: '/login' });
  122. })
  123. }).catch(() => {});
  124. }
  125. }
  126. }
  127. </script>
  128. <style lang="scss" scoped>
  129. .navbar {
  130. height: 80px;
  131. overflow: hidden;
  132. position: relative;
  133. background: #0045AF;
  134. box-shadow: 0 1px 4px rgba(0,21,41,.08);
  135. display: flex;
  136. .left-logo-box{
  137. flex:1;
  138. display: flex;
  139. img{
  140. height:50px;
  141. width:50px;
  142. margin:15px 12px 15px 18px;
  143. }
  144. p{
  145. font-size:24px;
  146. color:#fff;
  147. }
  148. }
  149. .hamburger-container {
  150. line-height: 46px;
  151. height: 100%;
  152. float: left;
  153. cursor: pointer;
  154. transition: background .3s;
  155. -webkit-tap-highlight-color:transparent;
  156. &:hover {
  157. background: rgba(0, 0, 0, .025)
  158. }
  159. }
  160. .breadcrumb-container {
  161. float: left;
  162. }
  163. /*.topmenu-container {*/
  164. /*margin-left:200px;*/
  165. /*flex:1;*/
  166. /*}*/
  167. .errLog-container {
  168. display: inline-block;
  169. vertical-align: top;
  170. }
  171. .nav-icon-max-box{
  172. display: flex;
  173. margin-left:20px;
  174. div{
  175. width:54px;
  176. height:54px;
  177. margin:13px 0;
  178. position: relative;
  179. cursor: pointer;
  180. img{
  181. width:24px;
  182. height:24px;
  183. margin:15px;
  184. }
  185. p{
  186. position: absolute;
  187. top:0;
  188. left:0;
  189. }
  190. }
  191. }
  192. .right-menu {
  193. /*float: right;*/
  194. height: 100%;
  195. line-height: 50px;
  196. &:focus {
  197. outline: none;
  198. }
  199. .right-menu-item {
  200. display: inline-block;
  201. padding: 0 8px;
  202. height: 100%;
  203. font-size: 18px;
  204. color: #5a5e66;
  205. vertical-align: text-bottom;
  206. &.hover-effect {
  207. cursor: pointer;
  208. transition: background .3s;
  209. &:hover {
  210. background: rgba(0, 0, 0, .025)
  211. }
  212. }
  213. }
  214. .avatar-container {
  215. margin-right: 30px;
  216. .avatar-wrapper {
  217. height:80px;
  218. position: relative;
  219. .user-avatar {
  220. cursor: pointer;
  221. width: 40px;
  222. height: 40px;
  223. border-radius: 50%;
  224. margin:20px;
  225. }
  226. .el-icon-caret-bottom {
  227. cursor: pointer;
  228. position: absolute;
  229. right: -20px;
  230. top: 25px;
  231. font-size: 12px;
  232. }
  233. }
  234. }
  235. }
  236. }
  237. </style>