index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div>
  3. <div class="wrapper">
  4. <header class="main-header">
  5. <!-- Logo -->
  6. <a href="javascript:void(0)" class="logo">
  7. <span class="logo-mini"><b>基础</b></span>
  8. <span class="logo-lg"><b>基础信息</b></span>
  9. </a>
  10. <!-- Header Navbar: style can be found in header.less -->
  11. <nav class="navbar navbar-static-top">
  12. <!-- Sidebar toggle button -->
  13. <a
  14. href="javascript:void(0)"
  15. class="sidebar-toggle"
  16. data-toggle="offcanvas"
  17. role="button"
  18. >
  19. <span class="sr-only">Toggle navigation</span>
  20. </a>
  21. <!-- Navbar Right Menu -->
  22. <div class="navbar-custom-menu">
  23. <ul class="nav navbar-nav">
  24. <!-- User Account: style can be found in dropdown.less -->
  25. <li class="dropdown user user-menu">
  26. <a
  27. href="javascript:void(0)"
  28. class="dropdown-toggle"
  29. data-toggle="dropdown"
  30. >
  31. <span class="hidden-xs">
  32. <i class="fa fa-user"></i> {{ user.displayName }}
  33. </span>
  34. </a>
  35. </li>
  36. <li class="user user-menu">
  37. <a href="javascript:void(0)" @click="backIndex">
  38. <i class="fa fa-home"></i> <span>主页面</span>
  39. </a>
  40. </li>
  41. <li class="user user-menu">
  42. <a href="javascript:void(0)" @click="logout">
  43. <i class="fa fa-sign-out"></i> <span>退出</span>
  44. </a>
  45. </li>
  46. </ul>
  47. </div>
  48. </nav>
  49. </header>
  50. <!-- Left side column. contains the logo and sidebar -->
  51. <aside class="main-sidebar">
  52. <!-- sidebar: style can be found in sidebar.less -->
  53. <section class="sidebar">
  54. <!-- sidebar menu: : style can be found in sidebar.less -->
  55. <ul class="sidebar-menu">
  56. <li class="header"></li>
  57. <li class="treeview active">
  58. <a href="javascript:void(0)">
  59. <i class="fa fa-database"></i> <span>基础信息管理</span>
  60. <span class="pull-right-container">
  61. <i class="fa fa-angle-left pull-right"></i>
  62. </span>
  63. </a>
  64. </li>
  65. </ul>
  66. </section>
  67. <!-- /.sidebar -->
  68. </aside>
  69. <!-- Content Wrapper. Contains page content -->
  70. <div class="content-wrapper">
  71. <!-- Content Header (Page header) -->
  72. <section class="content">
  73. <div class="row"><router-view></router-view></div>
  74. </section>
  75. <!-- Main content -->
  76. </div>
  77. <!-- /.row -->
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. import { mapState } from "vuex";
  83. import { CORE_API } from "@/constants/constants.js";
  84. export default {
  85. components: {},
  86. data() {
  87. return {
  88. menuList: [],
  89. };
  90. },
  91. computed: {
  92. ...mapState({ user: (state) => state.user }),
  93. },
  94. created() {
  95. var url = CORE_API + "/rolePrivilege/getUserPrivileges";
  96. this.$httpWithMsg
  97. .post(
  98. url,
  99. {
  100. groupCode: "BASIC_MENUS",
  101. full: false,
  102. },
  103. { emulateJSON: true }
  104. )
  105. .then((response) => {
  106. this.menuList = response.data;
  107. });
  108. },
  109. methods: {
  110. logout() {
  111. this.$http
  112. .post(CORE_API + "/auth/logout")
  113. .then(() => {
  114. window.location.href = sessionStorage.getItem("loginUrl");
  115. })
  116. .catch((response) => {
  117. if (response.status == 500) {
  118. this.$notify({
  119. showClose: true,
  120. message: response.data.desc,
  121. type: "error",
  122. });
  123. }
  124. window.location.href = sessionStorage.getItem("loginUrl");
  125. });
  126. },
  127. backIndex() {
  128. window.location.href = sessionStorage.getItem("indexUrl");
  129. },
  130. },
  131. };
  132. </script>
  133. <style scoped>
  134. span.logo-lg {
  135. font-family: "Micrsoft YaHei";
  136. font-size: 30px;
  137. }
  138. </style>