update @home页 key优化

This commit is contained in:
huangzhen 2024-09-12 18:28:59 +08:00
parent a996139f1e
commit 1416849fe9
2 changed files with 7 additions and 3 deletions

View File

@ -74,6 +74,9 @@ router.beforeEach(async (to, from, next) => {
localStorage.setItem("key", strP || "");
next({
path: "/home",
query: {
key: strP || "",
}
});
} else {
next();

View File

@ -12,10 +12,10 @@ export default {
name: 'home',
data() {
return {
key: localStorage.getItem('key'),
key: this.$route.query.key || localStorage.getItem("openid") || '',
loginBack: this.$route.query.loginBack,
// jumpPath: this.$route.query.jumpPath,
openid: this.$route.query.openid || localStorage.getItem("openid"), // id
openid: this.$route.query.openid || localStorage.getItem("openid") || '', // id
isAutoEmpower: true,
loadingText: '加载中',
dialogType: '',
@ -31,6 +31,8 @@ export default {
if (!this.loginBack) {
sessionStorage.clear();
localStorage.clear();
this.key && localStorage.setItem("token", this.key);
this.openid && localStorage.setItem("openid", this.openid);
this.preLogic();
} else {
this.dialogText = 'Token已过期';
@ -42,7 +44,6 @@ export default {
if (res && res.code === 200) {
if (res.data.Token) {
localStorage.setItem("token", res.data.Token || '');
localStorage.setItem("key", this.key || '');
// sessionStorage.setItem("jumpPath", this.jumpPath || ''); // -()
//