Navbar.vue 6.3 KB

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