HomeView.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <div class="body">
  3. <div class="top">
  4. <div class="title">CocoClass后台管理</div>
  5. <div class="person">
  6. <div class="person_name">{{ userinfo ? userinfo.username : "" }}</div>
  7. <el-button type="text" @click="handleLogout" style="margin-left: 20px">退出</el-button>
  8. </div>
  9. </div>
  10. <div class="container">
  11. <div class="left">
  12. <ul>
  13. <router-link class="menu_left" to="/user-list">
  14. <i class="el-icon-s-custom"></i>账号列表
  15. </router-link>
  16. <router-link class="menu_left" to="/user-examine">
  17. <i class="el-icon-edit"></i>账号审核
  18. </router-link>
  19. <router-link class="menu_left" to="/organ-list">
  20. <i class="el-icon-office-building"></i>组织列表
  21. </router-link>
  22. <router-link class="menu_left" to="/school-list">
  23. <i class="el-icon-school"></i>学校列表
  24. </router-link>
  25. <!-- <router-link class="menu_left" to="/version-add">
  26. <i class="el-icon-office-building"></i>版本更新
  27. </router-link> -->
  28. </ul>
  29. </div>
  30. <div class="table-container">
  31. <router-view></router-view>
  32. </div>
  33. </div>
  34. </div>
  35. </template>
  36. <script>
  37. import { mapGetters, mapActions } from 'vuex';
  38. import { loginOut } from '@/api/user';
  39. export default {
  40. name: "HomeView",
  41. computed: {
  42. ...mapGetters(['userinfo']),
  43. },
  44. methods: {
  45. ...mapActions({
  46. logout: 'user/logout'
  47. }),
  48. async handleLogout() {
  49. this.$confirm('确定退出吗', '提示', {
  50. confirmButtonText: '确定',
  51. cancelButtonText: '取消',
  52. type: 'warning'
  53. }).then(async () => {
  54. loginOut()
  55. .then(async () => {
  56. this.$message({
  57. message: '退出成功',
  58. type: 'success'
  59. });
  60. await this.logout();
  61. this.$router.push('/login');
  62. })
  63. .catch(err => {
  64. console.error(err);
  65. });
  66. }).catch(() => {
  67. // 取消操作
  68. });
  69. }
  70. },
  71. mounted() {},
  72. };
  73. </script>
  74. <style scoped>
  75. .body {
  76. width: 100%;
  77. height: 100%;
  78. overflow: hidden;
  79. }
  80. .top {
  81. width: 100%;
  82. height: 50px;
  83. background-color: #ffffff;
  84. display: flex;
  85. align-items: center;
  86. padding: 0 20px;
  87. box-sizing: border-box;
  88. }
  89. .top > .title {
  90. font-weight: bold;
  91. font-size: 20px;
  92. line-height: 40px;
  93. }
  94. .person {
  95. margin-left: auto;
  96. display: flex;
  97. align-items: center;
  98. }
  99. .person > .person_name {
  100. font-size: 15px;
  101. color: black;
  102. font-weight: 400;
  103. }
  104. .container {
  105. display: flex;
  106. width: 100%;
  107. height: calc(100% - 50px);
  108. overflow: hidden;
  109. }
  110. .table-container {
  111. width: calc(100% - 180px);
  112. overflow: hidden;
  113. height: 100%;
  114. }
  115. .left {
  116. width: 180px;
  117. height: 100%;
  118. background-color: #ffffff;
  119. display: flex;
  120. flex-direction: column;
  121. border: 5px;
  122. align-items: center;
  123. }
  124. .left ul {
  125. width: 100%;
  126. background-color: #ffffff;
  127. }
  128. .menu_left {
  129. width: 100%;
  130. height: 50px;
  131. text-decoration: none;
  132. color: rgb(154, 154, 154);
  133. background-color: #ffffff;
  134. line-height: 40px;
  135. display: flex;
  136. align-items: center;
  137. justify-content: center;
  138. }
  139. .menu_left > i {
  140. margin-right: 10px;
  141. }
  142. .router-link-active {
  143. background-color: #3d67bc;
  144. color: rgb(255, 255, 255);
  145. }
  146. .router-link-exact-active {
  147. background-color: #3d67bc;
  148. color: rgb(255, 255, 255);
  149. }
  150. </style>