12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <template>
- <div id="app">
- <transition name="fade">
- <keep-alive>
- <router-view v-if="$route.meta.keepAlive" />
- </keep-alive>
- </transition>
- <transition name="fade">
- <router-view v-if="!$route.meta.keepAlive" />
- </transition>
- </div>
- </template>
- <script>
- import { queryUserInfo } from "@/api/app";
- export default {
- name: "app",
- async created() {
- try {
- let Authorization = this.getQueryVariable('Authorization')
- Authorization = Authorization ? Authorization.split('+')[1] : null
- if (Authorization) {
- localStorage.setItem("Authorization", ('bearer ' + Authorization));
- localStorage.setItem("userInfo", ('bearer ' + Authorization));
- }
- const auth = localStorage.getItem("Authorization");
- const userInfo = localStorage.getItem("userInfo");
- if (userInfo || auth) {
- await queryUserInfo().then((res) => {
- const result = res.data || null;
- const tenantId = result.tenantId || 0;
- sessionStorage.setItem("tenantId", tenantId);
- });
- }
- } catch(e) {}
- },
- async mounted() {
- if(document.querySelector('#m_loading')) {
- document.querySelector('#m_loading').remove()
- }
- },
- methods: {
- getQueryVariable(variable) {
- if (window.location.hash.indexOf("?") < 0) {
- return null;
- }
- let query = window.location.hash.split("?")[1]
- let vars = query.split("&");
- for (let i = 0; i < vars.length; i++) {
- let pair = vars[i].split("=");
- if (pair[0] == variable) {
- return pair[1];
- }
- }
- return (false);
- },
- },
- };
- </script>
- <style lang="less">
- @import url("./assets/commonLess/common");
- #app {
- font-family: "Avenir", Helvetica, Arial, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- background: #f3f4f8;
- // overflow-x: hidden;
- // overflow-y: auto;
- user-select: none;
- -webkit-text-size-adjust: none !important;
- }
- // /deep/.van-icon.van-icon-success{
- // }
- // .fade-enter-active,
- // .fade-leave-active {
- // transition: opacity 0.5s;
- // }
- // .fade-enter,
- // .fade-leave-active {
- // opacity: 0;
- // }
- body {
- -webkit-text-size-adjust: none !important;
- }
- </style>
|