Commit 563dfdf0 authored by 张牧越's avatar 张牧越

大屏跳转登录

parent b9f395ff
<template>
<div id="app">
<router-view></router-view>
<router-view v-if="signIn"></router-view>
</div>
</template>
<script>
import { getXAccessToken } from "@/api/index";
export default {
name: "App",
components: {},
methods: {},
mounted() {
data() {
return {
signIn: false,
};
},
methods: {
getXAccessToken() {
getXAccessToken(localStorage.getItem("token")).then((res) => {
if (res.status == 200) {
localStorage.setItem("Authorization", res.data.access_token);
this.$nextTick(() => {
this.signIn = true;
});
}
});
},
},
beforeCreate() {
console.log(this.$route);
if (this.$route.query.token_code) {
localStorage.setItem("token", this.$route.query.token_code);
}
},
mounted() {
this.getXAccessToken();
},
};
</script>
......
......@@ -5,7 +5,7 @@
<span style="font-size: 14px; cursor: pointer" @click="jumpBack"
>工程项目后台管理系统</span
>
<router-link :to="{ path: '/', query: { token: token } }" exact
<router-link :to="{ path: '/', query: { token_code: token } }" exact
>数字工地</router-link
>
<router-link to="/realname">实名制</router-link>
......@@ -29,13 +29,12 @@
</div>
</div>
</div>
<div v-if="signIn">
<div>
<router-view></router-view>
</div>
</div>
</template>
<script>
import { getXAccessToken } from "@/api/index";
export default {
name: "Index",
data() {
......@@ -44,7 +43,6 @@ export default {
weekDay: "",
date: "",
zoom: 1,
signIn: false,
};
},
methods: {
......@@ -103,16 +101,6 @@ export default {
jumpBack() {
window.location.href = window.location.origin + "/pweb/m/";
},
getXAccessToken() {
getXAccessToken(localStorage.getItem("token")).then((res) => {
if (res.status == 200) {
localStorage.setItem("Authorization", res.data.access_token);
this.$nextTick(() => {
this.signIn = true;
});
}
});
},
},
computed: {
token() {
......@@ -122,7 +110,6 @@ export default {
mounted() {
this.$nextTick(() => {
this.bodyScale();
this.getXAccessToken();
});
this.getTime();
......
......@@ -64,7 +64,7 @@ request.interceptors.response.use(
})
}
if (response.data.status == 401) {
window.location.href = process.env.VUE_APP_RESOURCE_URL + 'pweb/m/login'
window.location.href = process.env.VUE_APP_RESOURCE_URL + 'pweb/m/login?is_screen=1'
}
return response.data
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment