TopBar.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <div class="top-bar-box">
  3. <div class="top-bar">
  4. <div class="top-box">
  5. <span>移动安全保卫管理平台</span>
  6. <van-icon name="setting-o" size="26" @click="clickOutLogin" />
  7. </div>
  8. <div class="bottom-box">
  9. <div>
  10. <p class="user-name">{{ userName }}</p>
  11. <p class="org-info">
  12. <span>{{ orgName }}</span>
  13. <van-icon name="arrow" size="20" />
  14. </p>
  15. <p class="van-multi-ellipsis--l2 introduce-info ">
  16. <span v-for="item in roleList" :key="item.roleId">{{ item.roleName }}</span>
  17. </p>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import { mapGetters } from 'vuex'
  25. import { logout } from '@/api/public'
  26. export default {
  27. data() {
  28. return {}
  29. },
  30. computed: {
  31. ...mapGetters(['userName', 'orgName','roleList', 'orgId']),
  32. },
  33. methods: {
  34. clickOutLogin() {
  35. logout().then(res => {
  36. sessionStorage.clear();
  37. this.$router.replace('/login');
  38. this.$toast('退出登录');
  39. })
  40. },
  41. }
  42. }
  43. </script>
  44. <style scoped lang="scss">
  45. .top-bar-box{
  46. position: relative;
  47. }
  48. .top-bar {
  49. height: 300px;
  50. width: 100%;
  51. background: url('../assets/img/banner.png') no-repeat center rgba(255,255,255,.1);
  52. background-size: 100% 100%;
  53. padding: 40px 40px 20px 40px;
  54. text-shadow: 0 1px 3px #666;
  55. box-shadow: 0 1px 10px #5ebaee;
  56. color: #fff;
  57. > div {
  58. width: 100%;
  59. }
  60. }
  61. .top-box {
  62. display: flex;
  63. justify-content: space-between;
  64. align-items: center;
  65. > span {
  66. font-size: 40px;
  67. }
  68. }
  69. .bottom-box {
  70. padding-top: 30px;
  71. > div {
  72. .user-name {
  73. font-size: 30px;
  74. margin-bottom: 10px;
  75. }
  76. .org-info{
  77. font-size: 28px;
  78. display: flex;
  79. justify-content: space-between;
  80. }
  81. .introduce-info {
  82. font-size: 24px;
  83. line-height: 34px;
  84. >span{
  85. display: inline-block;
  86. margin-right: 20px;
  87. }
  88. }
  89. }
  90. }
  91. </style>