Navbar.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <template>
  2. <div class="navbar">
  3. <!-- <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> -->
  4. <!-- <breadcrumb class="breadcrumb-container" /> -->
  5. <div class="navbar_top">
  6. <div class="nav_left">
  7. <div class="log_icon">
  8. <img src="../../assets/logo/pic_logo_top.png" />
  9. </div>
  10. <div class="dividing"></div>
  11. <div class="log_name">国航行李数据整合及应用</div>
  12. </div>
  13. <div class="right-menu">
  14. <el-dropdown>
  15. <div class="user">
  16. <img
  17. class="head-icon-img"
  18. src="../../assets/status/ic_user.png"
  19. alt=""
  20. />
  21. <span class="name">{{ name }}</span>
  22. <i class="el-icon-arrow-down el-icon--right"></i>
  23. </div>
  24. <el-dropdown-menu
  25. class="handleMsgMneu"
  26. slot="dropdown"
  27. >
  28. <el-dropdown-item v-if="name != '匿名用户'">
  29. <span
  30. class="editPwd"
  31. @click="dialogPwd"
  32. >修改密码</span>
  33. </el-dropdown-item>
  34. <el-dropdown-item>
  35. <span
  36. @click="exitDialog"
  37. class="layoutSys"
  38. >退出登录</span>
  39. </el-dropdown-item>
  40. </el-dropdown-menu>
  41. </el-dropdown>
  42. <el-button
  43. @click="downFile"
  44. class="btn-help"
  45. plain
  46. >帮助</el-button>
  47. <!-- <div class="seting">
  48. <span @click="toSystem" class="img-icon"></span>
  49. </div> -->
  50. <!-- <div class="lock">
  51. <span @click="dialogPwd" class="img-icon"></span>
  52. </div>
  53. <div class="exit">
  54. <span @click="exitDialog" class="img-icon"></span>
  55. </div> -->
  56. </div>
  57. </div>
  58. <div
  59. class="navbar_lower"
  60. id="navbar_lowers"
  61. >
  62. <el-breadcrumb separator-class="el-icon-arrow-right">
  63. <el-breadcrumb-item
  64. v-for="(item, index) in breadList"
  65. :key="index"
  66. :to="index < breadList.length -1 ? item.path : undefined"
  67. >
  68. <span
  69. v-if="withButtonBack(item, index)"
  70. is="router-link"
  71. class="btn-back"
  72. :to="goBackHandler(item)"
  73. ><i class="el-icon-arrow-left" />返回</span>
  74. <span>{{ item.meta.title }}</span>
  75. </el-breadcrumb-item>
  76. </el-breadcrumb>
  77. <!-- <tags-view /> -->
  78. <div class="newdata">{{ newData }}</div>
  79. </div>
  80. </div>
  81. </template>
  82. <script>
  83. import { mapGetters } from 'vuex'
  84. import Breadcrumb from '@/components/Breadcrumb'
  85. import Hamburger from '@/components/Hamburger'
  86. // import { Format } from "../../config/util";
  87. import { timeInZone } from '@/utils/table'
  88. // import TagsView from "./TagsView";
  89. export default {
  90. props: ['logstart'],
  91. data() {
  92. return {
  93. newData: '',
  94. breadList: this.getBreadcrumb(),
  95. getTimeInterval: null
  96. }
  97. },
  98. components: {
  99. Breadcrumb,
  100. Hamburger
  101. // TagsView,
  102. },
  103. watch: {
  104. $route(val) {
  105. this.breadList = this.getBreadcrumb()
  106. }
  107. },
  108. computed: {
  109. ...mapGetters(['sidebar', 'avatar', 'name', 'timeZone'])
  110. },
  111. mounted() {
  112. this.getTimeInterval = setInterval(() => {
  113. // this.newData = Format("yyyy/MM/dd hh:mm:ss", new Date());
  114. this.newData = timeInZone(new Date(), this.timeZone).replaceAll('-', '/')
  115. })
  116. },
  117. beforeDestroy() {
  118. this.getTimeInterval && clearInterval(this.getTimeInterval)
  119. this.getTimeInterval = null
  120. },
  121. methods: {
  122. toggleSideBar() {
  123. this.$store.dispatch('app/toggleSideBar')
  124. },
  125. async logout() {
  126. await this.$store.dispatch('user/logout')
  127. this.$router.push(`/login?redirect=${this.$route.fullPath}`)
  128. },
  129. getBreadcrumb() {
  130. return this.$route.matched.filter(item => item.name && item.meta.title)
  131. },
  132. //修改密码
  133. dialogPwd() {
  134. this.$store.dispatch('app/togglePwdflag', true)
  135. },
  136. //退出系统-弹框
  137. exitDialog() {
  138. this.$store.dispatch('app/toggleOutflag', true)
  139. },
  140. //下载
  141. downFile() {
  142. const a = document.createElement('a')
  143. // 给a标签的href属性值加上地址,注意:这里是绝对路径,不用加 点.
  144. a.href = './国航行李整合及应用项目-用户使用手册V2.1.pdf'
  145. // 设置下载文件文件名,这里加上.xlsx指定文件类型,pdf文件就指定.fpd即可
  146. a.download = '国航行李整合及应用项目-用户使用手册V2.1.pdf'
  147. // 障眼法藏起来a标签
  148. a.style.display = 'none'
  149. // 将a标签追加到文档对象中
  150. document.body.appendChild(a)
  151. // 模拟点击了<a>标签,会触发<a>标签的href的读取,浏览器就会自动下载了
  152. a.click()
  153. // 一次性的,用完就删除a标签
  154. a.remove()
  155. // window.location.href = './国航行李整合及应用项目-用户使用手册V2.1.pdf'
  156. },
  157. withButtonBack(item, index) {
  158. if (['/systemSettings', '/BasicsData'].includes(this.$route.matched[0].path)) {
  159. return false
  160. }
  161. return (
  162. item.parent.path !== item.path &&
  163. !item.parent.redirect &&
  164. index > 0 &&
  165. index === this.breadList.length - 1
  166. )
  167. },
  168. goBackHandler(item) {
  169. return item.parent?.path
  170. }
  171. }
  172. }
  173. </script>
  174. <style lang="scss" scoped>
  175. .navbar {
  176. width: 100%;
  177. height: 80px;
  178. overflow: hidden;
  179. position: relative;
  180. background: #fff;
  181. position: fixed;
  182. top: 0;
  183. box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  184. z-index: 999;
  185. ::v-deep .el-breadcrumb__separator {
  186. display: none;
  187. }
  188. ::v-deep .el-breadcrumb__inner {
  189. padding: 8px 31px 9px 31px;
  190. color: #afb4bf;
  191. }
  192. ::v-deep .el-breadcrumb__item:last-child {
  193. .el-breadcrumb__inner {
  194. padding: 8px 31px 9px 31px;
  195. background: #dfe3ea;
  196. font-size: 14px;
  197. font-family: Microsoft YaHei;
  198. font-weight: 400;
  199. color: #101116;
  200. }
  201. }
  202. > .navbar_top {
  203. width: 100%;
  204. height: 48px;
  205. background: #2d67e3;
  206. display: flex;
  207. align-items: center;
  208. justify-content: space-between;
  209. // border-bottom: 1px solid #f2f6fc;
  210. padding-left: 14px;
  211. > .nav_left {
  212. height: 100%;
  213. display: flex;
  214. align-items: center;
  215. > .log_icon {
  216. width: 24px;
  217. height: 32px;
  218. border-radius: 50%;
  219. display: flex;
  220. align-items: center;
  221. > img {
  222. width: 24px;
  223. height: 24px;
  224. border-radius: 50%;
  225. }
  226. }
  227. > .dividing {
  228. width: 1px;
  229. height: 16px;
  230. margin-left: 8px;
  231. margin-right: 12px;
  232. background: #ffffff;
  233. }
  234. > .log_name {
  235. font-size: 14px;
  236. font-family: Microsoft YaHei;
  237. font-weight: bold;
  238. color: #ffffff;
  239. }
  240. }
  241. .hamburger-container {
  242. line-height: 46px;
  243. height: 100%;
  244. float: left;
  245. cursor: pointer;
  246. transition: background 0.3s;
  247. -webkit-tap-highlight-color: transparent;
  248. &:hover {
  249. background: rgba(0, 0, 0, 0.025);
  250. }
  251. }
  252. .breadcrumb-container {
  253. float: left;
  254. }
  255. .right-menu {
  256. float: right;
  257. height: 100%;
  258. line-height: 48px;
  259. margin-right: 44px;
  260. display: flex;
  261. &:focus {
  262. outline: none;
  263. }
  264. > div {
  265. margin-right: 20px;
  266. }
  267. .img-icon {
  268. display: inline-block;
  269. width: 24px;
  270. height: 24px;
  271. vertical-align: middle;
  272. background-repeat: no-repeat;
  273. background-size: cover;
  274. cursor: pointer;
  275. transition: all 0.3s;
  276. }
  277. .lock {
  278. .img-icon {
  279. background-image: url('../../assets/status/ic_password.png');
  280. &:hover {
  281. background-image: url('../../assets/status/ic_password_hovar.png');
  282. }
  283. }
  284. }
  285. .exit {
  286. .img-icon {
  287. background-image: url('../../assets/status/ic_exit.png');
  288. &:hover {
  289. background-image: url('../../assets/status/ic_exit_hovar.png');
  290. }
  291. }
  292. }
  293. .btn-help {
  294. height: 20px;
  295. line-height: 20px;
  296. padding: 0;
  297. width: 38px;
  298. margin-top: 14px;
  299. border: 1px solid #fff;
  300. background: none;
  301. color: #fff;
  302. transition: all 0.3s;
  303. &:hover {
  304. background: #fff;
  305. color: #2d67e3;
  306. }
  307. }
  308. .user {
  309. img {
  310. position: relative;
  311. top: 6px;
  312. margin-right: 10px;
  313. }
  314. color: #fff;
  315. font-weight: 600;
  316. font-size: 16px;
  317. cursor: pointer;
  318. }
  319. > .right {
  320. width: 100%;
  321. height: 100%;
  322. display: flex;
  323. align-items: center;
  324. justify-content: flex-start;
  325. padding-right: 80px;
  326. > .log {
  327. width: 40px;
  328. height: 40px;
  329. background: #e1e5eb;
  330. border-radius: 50%;
  331. margin-right: 16px;
  332. }
  333. > p {
  334. font-size: 16px;
  335. font-family: Microsoft YaHei;
  336. font-weight: 300;
  337. color: #303133;
  338. }
  339. }
  340. .right-menu-item {
  341. display: inline-block;
  342. padding: 0 8px;
  343. height: 100%;
  344. font-size: 18px;
  345. color: #5a5e66;
  346. vertical-align: text-bottom;
  347. &.hover-effect {
  348. cursor: pointer;
  349. transition: background 0.3s;
  350. &:hover {
  351. background: rgba(0, 0, 0, 0.025);
  352. }
  353. }
  354. }
  355. .avatar-container {
  356. margin-right: 30px;
  357. height: 100%;
  358. .avatar-wrapper {
  359. height: 100%;
  360. // margin-top: 5px;
  361. display: flex;
  362. align-items: center;
  363. position: relative;
  364. .search {
  365. width: 21px;
  366. height: 21px;
  367. background: url('../../assets/header/ic_search_top.png') no-repeat;
  368. background-size: 100% 100%;
  369. margin-top: 10px;
  370. margin-right: 41px;
  371. }
  372. .fullscreen {
  373. width: 21px;
  374. height: 21px;
  375. background: url('../../assets/header/ic_fullscreen_top.png') no-repeat;
  376. background-size: 100% 100%;
  377. margin-top: 10px;
  378. margin-right: 20px;
  379. }
  380. .journaler {
  381. width: 21px;
  382. height: 21px;
  383. background: url('../../assets/header/ic_data_top.png') no-repeat;
  384. background-size: 100% 100%;
  385. margin-top: 10px;
  386. margin-right: 41px;
  387. }
  388. .information {
  389. width: 21px;
  390. height: 21px;
  391. background: url('../../assets/header/ic_message_top.png') no-repeat;
  392. background-size: 100% 100%;
  393. margin-top: 10px;
  394. margin-right: 41px;
  395. position: relative;
  396. > .information_number {
  397. position: absolute;
  398. width: 15px;
  399. height: 15px;
  400. background: #ed5050;
  401. color: #ffffff;
  402. border-radius: 50%;
  403. top: -35%;
  404. right: -30%;
  405. display: flex;
  406. align-items: center;
  407. justify-content: center;
  408. font-size: 12px;
  409. font-family: Microsoft YaHei;
  410. font-weight: 400;
  411. }
  412. }
  413. .user-avatar {
  414. cursor: pointer;
  415. width: 24px;
  416. height: 24px;
  417. border-radius: 50%;
  418. margin-right: 16px;
  419. }
  420. .username {
  421. // width: 200px;
  422. height: 40px;
  423. // margin-left: 5%;
  424. color: #ffffff;
  425. font-size: 16px;
  426. font-family: Microsoft YaHei;
  427. font-weight: bold;
  428. line-height: 40px;
  429. display: inline;
  430. }
  431. .el-icon-caret-bottom {
  432. cursor: pointer;
  433. position: absolute;
  434. right: -20px;
  435. top: 20px;
  436. font-size: 12px;
  437. }
  438. }
  439. }
  440. }
  441. }
  442. > .navbar_lower {
  443. width: 100%;
  444. height: 32px;
  445. display: flex;
  446. background: #ffffff;
  447. justify-content: space-between;
  448. align-items: center;
  449. padding-left: 48px;
  450. padding-right: 54px;
  451. ::v-deep .el-breadcrumb {
  452. font-size: 18px;
  453. font-family: Microsoft YaHei;
  454. font-weight: 400;
  455. // color: #ffffff;
  456. .is-link {
  457. font-size: 14px !important;
  458. // color: #ffffff !important;
  459. }
  460. // .el-breadcrumb__item {
  461. // .el-breadcrumb__inner {
  462. // font-size: 14px;
  463. // color: #ffffff !important;
  464. // }
  465. // }
  466. // .is-link {
  467. // font-size: 14px;
  468. // color: #ffffff !important;
  469. // }
  470. .btn-back {
  471. margin-left: -18px;
  472. margin-right: 10px;
  473. font-size: 14px;
  474. color: #2d67e3;
  475. cursor: pointer;
  476. }
  477. }
  478. > .newdata {
  479. font-size: 14px;
  480. font-family: DIN;
  481. font-weight: bold;
  482. min-width: 200px;
  483. text-align: right;
  484. // color: #ffffff;
  485. }
  486. }
  487. }
  488. </style>