Index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <div class="hello">
  3. <el-container>
  4. <el-header>
  5. <div class="header_title">ShowDoc</div>
  6. <router-link class="goback" to="/item/index">{{$t('goback')}}</router-link>
  7. </el-header>
  8. <el-container>
  9. <el-aside width="150px">
  10. <el-menu
  11. default-active="1"
  12. class="el-menu-vertical-demo"
  13. background-color="#545c64"
  14. text-color="#fff"
  15. @select="select_menu"
  16. active-text-color="#ffd04b">
  17. <el-menu-item index="1">
  18. <i class="el-icon-info"></i>
  19. <span slot="title">{{$t('user_management')}}</span>
  20. </el-menu-item>
  21. <el-menu-item index="2">
  22. <i class="el-icon-tickets"></i>
  23. <span slot="title">{{$t('item_management')}}</span>
  24. </el-menu-item>
  25. </el-menu>
  26. </el-aside>
  27. <el-container>
  28. <el-main>
  29. <User v-if="open_menu_index == 1 "> </User>
  30. <Item v-if="open_menu_index == 2 "> </Item>
  31. </el-main>
  32. <el-footer>
  33. <!-- something -->
  34. </el-footer>
  35. </el-container>
  36. </el-container>
  37. </el-container>
  38. </div>
  39. </div>
  40. </template>
  41. <style scoped>
  42. .el-header {
  43. background-color: #fff;
  44. color: #333;
  45. text-align: center;
  46. line-height: 60px;
  47. border-bottom:1px solid #ddd;
  48. padding-left: 0px;
  49. }
  50. .el-footer {
  51. color: #333;
  52. text-align: center;
  53. line-height: 60px;
  54. }
  55. .el-aside {
  56. background-color: rgb(84, 92, 100);
  57. color: #333;
  58. text-align: center;
  59. line-height: 200px;
  60. height: calc(100% - 60px);
  61. position: absolute;
  62. }
  63. .el-main {
  64. margin-left: 200px;
  65. overflow: visible;
  66. }
  67. body > .el-container {
  68. position: absolute;
  69. height: 100%;
  70. width: 100%;
  71. }
  72. .el-container:nth-child(5) .el-aside,
  73. .el-container:nth-child(6) .el-aside {
  74. line-height: 260px;
  75. }
  76. .el-container:nth-child(7) .el-aside {
  77. line-height: 320px;
  78. }
  79. .goback{
  80. float: right;
  81. margin-right: 20px;
  82. }
  83. .header_title{
  84. float: left;
  85. padding-right: 35px;
  86. padding-left: 24px;
  87. font-size: 20px;
  88. border-right:1px solid #ddd;
  89. background-color: rgb(84, 92, 100);
  90. color: #fff;
  91. }
  92. </style>
  93. <script>
  94. import Item from '@/components/admin/item/Index'
  95. import User from '@/components/admin/user/Index'
  96. export default {
  97. data() {
  98. return {
  99. open_menu_index:1,
  100. };
  101. },
  102. components:{
  103. Item,
  104. User,
  105. },
  106. methods:{
  107. select_menu(index,indexPath){
  108. this.open_menu_index = 0 ;
  109. this.$nextTick(()=>{
  110. this.open_menu_index = index ;
  111. });
  112. },
  113. check_upadte(){
  114. var that = this ;
  115. var url = DocConfig.server+'/api/adminUser/checkUpdate';
  116. var params = new URLSearchParams();
  117. that.axios.post(url, params)
  118. .then(function (response) {
  119. if (response && response.data && response.data.data && response.data.data.url) {
  120. that.$message({
  121. showClose: true,
  122. duration:10000,
  123. dangerouslyUseHTMLString: true,
  124. message: '<a target="_blank" href="'+response.data.data.url+'">'+response.data.data.title+'</a>'
  125. });
  126. };
  127. });
  128. },
  129. },
  130. mounted () {
  131. this.check_upadte();
  132. },
  133. beforeDestroy(){
  134. this.$message.closeAll();
  135. /*去掉添加的背景色*/
  136. document.body.removeAttribute("class","grey-bg");
  137. }
  138. }
  139. </script>