index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div id="main" v-bind:class="{ fold: isFold }">
  3. <page-menu @menuFold="menuFold" ref="menu"></page-menu>
  4. <bread-crumb></bread-crumb>
  5. <router-view class="mainBox" ref="curRouter"></router-view>
  6. </div>
  7. </template>
  8. <script>
  9. // @ is an alias to /src
  10. import pageMenu from "./page/pageMenu";
  11. import breadCrumb from "@/views/page/breadCrumb";
  12. export default {
  13. name: "index",
  14. components: {
  15. pageMenu,
  16. breadCrumb,
  17. },
  18. data() {
  19. return {
  20. isFold: false, // menu是否折叠
  21. };
  22. },
  23. methods: {
  24. menuFold(flag) {
  25. this.isFold = flag;
  26. },
  27. },
  28. mounted() {
  29. // localStorage.setItem(
  30. // "Authorization",
  31. // "Bearer 9882c634-9af6-4647-89dc-8ad53c04a56b"
  32. // );
  33. let { code, ticket } = this.$route.query;
  34. if (code && ticket) {
  35. this.$axios({
  36. method: "post",
  37. url: this.$api.common.single,
  38. data: { code, ticket },
  39. }).then((res) => {
  40. if (res.code == 200 && !!res.info.access_token) {
  41. localStorage.setItem(
  42. "Authorization",
  43. "Bearer " + res.info.access_token
  44. );
  45. this.$nextTick(() => {
  46. this.$refs.curRouter.init &&
  47. this.$refs.curRouter.init();
  48. });
  49. } else {
  50. alert(res);
  51. }
  52. });
  53. }
  54. },
  55. };
  56. </script>
  57. <style scoped lang="less">
  58. #main {
  59. position: relative;
  60. width: 100%;
  61. min-height: 100vh;
  62. padding-top: 50px;
  63. padding-left: 150px;
  64. }
  65. #main.fold {
  66. padding-left: 60px;
  67. }
  68. .fold {
  69. /deep/ .breadCrumbPanel {
  70. left: 60px;
  71. }
  72. }
  73. .mainBox {
  74. padding-bottom: 60px;
  75. overflow: auto;
  76. }
  77. /deep/ .el-tabs--card > .el-tabs__header .el-tabs__item {
  78. border: 1px solid @gray;
  79. border-bottom-color: @themeColor;
  80. border-radius: 3px 3px 0 0;
  81. font-size: 14px;
  82. font-weight: bold;
  83. &:first-child {
  84. border-right-color: transparent;
  85. }
  86. &:nth-child(2) {
  87. border-left-color: transparent;
  88. }
  89. &.is-active {
  90. border: 1px solid @themeColor;
  91. border-bottom-color: #ffffff;
  92. }
  93. }
  94. </style>