homeNavbar.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <div class="navbar">
  3. <div class="left-logo-box">
  4. <!--<img src="@/assets/ZDimages/icon_logo.png">-->
  5. <img :src="circularLogo">
  6. <p>{{VUE_APP_TITLE}}</p>
  7. <!--<p>危化品智能存储管理系统</p>-->
  8. </div>
  9. <div class="nav-icon-max-box">
  10. <div @click="goPage('message')">
  11. <img src="@/assets/ZDimages/top_nav_icon_02.png">
  12. </div>
  13. </div>
  14. <div class="right-menu">
  15. <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
  16. <div class="avatar-wrapper" style="display: flex">
  17. <img :src="avatar" class="user-avatar" v-if="avatar">
  18. <img src="@/assets/ZDimages/tx_cion.png" class="user-avatar" v-else>
  19. <p style="color:#fff;font-size:14px;margin:0 20px 0 0;line-height:80px;text-align: center">{{name}}</p>
  20. <p class="el-icon-arrow-down" style="font-size:20px;color:#fff;margin:32px 0;"></p>
  21. <!--<i class="el-icon-arrow-down" />-->
  22. </div>
  23. <el-dropdown-menu slot="dropdown" style="margin:0;">
  24. <el-dropdown-item @click.native="goPage('user')">
  25. <span>个人中心</span>
  26. </el-dropdown-item>
  27. <el-dropdown-item divided @click.native="logout">
  28. <span>退出登录</span>
  29. </el-dropdown-item>
  30. </el-dropdown-menu>
  31. </el-dropdown>
  32. </div>
  33. </div>
  34. </template>
  35. <script>
  36. import { mapGetters } from 'vuex'
  37. import Screenfull from '@/components/Screenfull'
  38. import SizeSelect from '@/components/SizeSelect'
  39. import Search from '@/components/HeaderSearch'
  40. import RuoYiGit from '@/components/RuoYi/Git'
  41. import RuoYiDoc from '@/components/RuoYi/Doc'
  42. import store from '@/store'
  43. export default {
  44. components: {
  45. Screenfull,
  46. SizeSelect,
  47. Search,
  48. RuoYiGit,
  49. RuoYiDoc
  50. },
  51. data(){
  52. return{
  53. VUE_APP_TITLE:process.env.VUE_APP_TITLE,
  54. circularLogo:localStorage.getItem('circularLogo'),
  55. userType:localStorage.getItem('userType'),
  56. routeData:{}
  57. }
  58. },
  59. computed: {
  60. ...mapGetters([
  61. 'sidebar',
  62. 'avatar',
  63. 'device',
  64. "name"
  65. ]),
  66. setting: {
  67. get() {
  68. return this.$store.state.settings.showSettings
  69. },
  70. set(val) {
  71. this.$store.dispatch('settings/changeSetting', {
  72. key: 'showSettings',
  73. value: val
  74. })
  75. }
  76. },
  77. topNav: {
  78. get() {
  79. return this.$store.state.settings.topNav
  80. }
  81. }
  82. },
  83. mounted(){
  84. this.routeData = JSON.parse(localStorage.getItem("routeData"))
  85. },
  86. methods: {
  87. goPage(type){
  88. let self =this
  89. if(type == 'message'){
  90. for(let i=0;i<self.routeData.length;i++){
  91. if(!self.routeData[i].hidden&&self.routeData[i].name != 'Https://www.sxitdlc.com'){
  92. store.dispatch('settings/setPageName', self.routeData[i].meta.title)
  93. this.$store.commit("SET_SIDEBAR_ROUTERS", self.routeData[i].children);
  94. this.$router.push({ path: '/message' });
  95. break
  96. }
  97. }
  98. }else if(type == 'home'){
  99. this.$router.push({ path: '/home' });
  100. }else if(type == 'user'){
  101. for(let i=0;i<self.routeData.length;i++){
  102. if(!self.routeData[i].hidden&&self.routeData[i].name != 'Https://www.sxitdlc.com'){
  103. store.dispatch('settings/setPageName', self.routeData[i].meta.title)
  104. this.$store.commit("SET_SIDEBAR_ROUTERS", self.routeData[i].children);
  105. // this.$router.push({ path: '/mine' });
  106. this.$router.push({ path: '/comprehensive/system/mine' });
  107. // this.$router.push({ path: '/user/profile' });
  108. break
  109. }
  110. }
  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. z-index:4;
  139. .left-logo-box{
  140. display: flex;
  141. flex:1;
  142. img{
  143. height:50px;
  144. width:50px;
  145. margin:15px 12px 15px 18px;
  146. }
  147. p{
  148. font-size:24px;
  149. color:#fff;
  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. 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>