index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. data() {
  86. return {
  87. menuList: []
  88. };
  89. },
  90. components: {},
  91. computed: {
  92. ...mapState({ user: state => state.user })
  93. },
  94. methods: {
  95. logout() {
  96. this.$http
  97. .post(core_api + "/auth/logout")
  98. .then(() => {
  99. window.location.href = sessionStorage.getItem("loginUrl");
  100. })
  101. .catch(response => {
  102. if (response.status == 500) {
  103. this.$notify({
  104. showClose: true,
  105. message: response.data.desc,
  106. type: "error"
  107. });
  108. }
  109. window.location.href = sessionStorage.getItem("loginUrl");
  110. });
  111. },
  112. backIndex() {
  113. window.location.href = sessionStorage.getItem("indexUrl");
  114. }
  115. },
  116. created() {
  117. var url = core_api + "/rolePrivilege/getUserPrivileges";
  118. this.$http
  119. .post(
  120. url,
  121. {
  122. groupCode: "BASIC_MENUS",
  123. full: false
  124. },
  125. { emulateJSON: true }
  126. )
  127. .then(response => {
  128. this.menuList = response.data;
  129. })
  130. .catch(response => {
  131. if (response.status == 500) {
  132. this.$notify({
  133. showClose: true,
  134. message: response.data.desc,
  135. type: "error"
  136. });
  137. }
  138. });
  139. }
  140. };
  141. </script>
  142. <style scoped>
  143. span.logo-lg {
  144. font-family: "Micrsoft YaHei";
  145. font-size: 30px;
  146. }
  147. </style>