Navbar.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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>{{VUE_APP_TITLE}}</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'&&tenantId != 2">
  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. VUE_APP_TITLE:process.env.VUE_APP_TITLE,
  75. circularLogo:localStorage.getItem('circularLogo'),
  76. userType:localStorage.getItem('userType'),
  77. initPage:localStorage.getItem('initPage'),
  78. tenantId:localStorage.getItem('tenantId'),
  79. }
  80. },
  81. computed: {
  82. ...mapGetters([
  83. 'sidebar',
  84. 'avatar',
  85. 'device',
  86. "name"
  87. ]),
  88. setting: {
  89. get() {
  90. return this.$store.state.settings.showSettings
  91. },
  92. set(val) {
  93. this.$store.dispatch('settings/changeSetting', {
  94. key: 'showSettings',
  95. value: val
  96. })
  97. }
  98. },
  99. topNav: {
  100. get() {
  101. return this.$store.state.settings.topNav
  102. }
  103. }
  104. },
  105. methods: {
  106. goPage(type){
  107. if(type == 'message'){
  108. this.$router.push({ path: '/message' });
  109. }else if(type == 'home'){
  110. this.$router.push({ path: '/home' });
  111. }
  112. },
  113. toggleSideBar() {
  114. this.$store.dispatch('app/toggleSideBar')
  115. },
  116. async logout() {
  117. this.$confirm('确定注销并退出系统吗?', '提示', {
  118. confirmButtonText: '确定',
  119. cancelButtonText: '取消',
  120. type: 'warning'
  121. }).then(() => {
  122. this.$store.dispatch('LogOut').then(() => {
  123. this.$router.push({ path: '/login' });
  124. })
  125. }).catch(() => {});
  126. }
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. .navbar {
  132. height: 80px;
  133. overflow: hidden;
  134. position: relative;
  135. background: #0045AF;
  136. box-shadow: 0 1px 4px rgba(0,21,41,.08);
  137. display: flex;
  138. .left-logo-box{
  139. flex:1;
  140. display: flex;
  141. img{
  142. height:50px;
  143. width:50px;
  144. margin:15px 12px 15px 18px;
  145. }
  146. p{
  147. font-size:24px;
  148. color:#fff;
  149. line-height:80px;
  150. }
  151. }
  152. .hamburger-container {
  153. line-height: 46px;
  154. height: 100%;
  155. float: left;
  156. cursor: pointer;
  157. transition: background .3s;
  158. -webkit-tap-highlight-color:transparent;
  159. &:hover {
  160. background: rgba(0, 0, 0, .025)
  161. }
  162. }
  163. .breadcrumb-container {
  164. float: left;
  165. }
  166. /*.topmenu-container {*/
  167. /*margin-left:200px;*/
  168. /*flex:1;*/
  169. /*}*/
  170. .errLog-container {
  171. display: inline-block;
  172. vertical-align: top;
  173. }
  174. .nav-icon-max-box{
  175. display: flex;
  176. margin-left:20px;
  177. div{
  178. width:54px;
  179. height:54px;
  180. margin:13px 0;
  181. position: relative;
  182. cursor: pointer;
  183. img{
  184. width:24px;
  185. height:24px;
  186. margin:15px;
  187. }
  188. p{
  189. position: absolute;
  190. top:0;
  191. left:0;
  192. }
  193. }
  194. }
  195. .right-menu {
  196. /*float: right;*/
  197. height: 100%;
  198. line-height: 50px;
  199. &:focus {
  200. outline: none;
  201. }
  202. .right-menu-item {
  203. display: inline-block;
  204. padding: 0 8px;
  205. height: 100%;
  206. font-size: 18px;
  207. color: #5a5e66;
  208. vertical-align: text-bottom;
  209. &.hover-effect {
  210. cursor: pointer;
  211. transition: background .3s;
  212. &:hover {
  213. background: rgba(0, 0, 0, .025)
  214. }
  215. }
  216. }
  217. .avatar-container {
  218. margin-right: 30px;
  219. .avatar-wrapper {
  220. height:80px;
  221. position: relative;
  222. .user-avatar {
  223. cursor: pointer;
  224. width: 40px;
  225. height: 40px;
  226. border-radius: 50%;
  227. margin:20px;
  228. }
  229. .el-icon-caret-bottom {
  230. cursor: pointer;
  231. position: absolute;
  232. right: -20px;
  233. top: 25px;
  234. font-size: 12px;
  235. }
  236. }
  237. }
  238. }
  239. }
  240. </style>