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 || ""); localStorage.setItem("key", strP || "");
next({ next({
path: "/home", path: "/home",
query: {
key: strP || "",
}
}); });
} else { } else {
next(); next();

View File

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