mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 09:33:55 +08:00
fix: 修复刷新页面菜单、页脚闪动的问题
This commit is contained in:
@@ -238,13 +238,6 @@ export default {
|
||||
this.$store.dispatch("fetchPubConfig").then(() => {
|
||||
// 根据配置决定默认登录方式
|
||||
this.isMobileLogin = this.enableMobileRegister;
|
||||
|
||||
// pub-config接口调用完成后,重新初始化featureManager以确保使用最新的配置
|
||||
featureManager.waitForInitialization().then(() => {
|
||||
console.log('featureManager重新初始化完成,使用pub-config配置');
|
||||
}).catch(error => {
|
||||
console.warn('featureManager重新初始化失败:', error);
|
||||
});
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
@@ -256,7 +249,9 @@ export default {
|
||||
window.open(url, '_blank');
|
||||
},
|
||||
fetchCaptcha() {
|
||||
if (this.$store.getters.getToken) {
|
||||
// 处理手动清空localstorage导致无法获取验证码的问题
|
||||
const token = localStorage.getItem('token')
|
||||
if (token) {
|
||||
if (this.$route.path !== "/home") {
|
||||
this.$router.push("/home");
|
||||
}
|
||||
@@ -308,6 +303,17 @@ export default {
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
getUserInfo() {
|
||||
Api.user.getUserInfo(({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.$store.commit("setUserInfo", data.data);
|
||||
goToPage("/home");
|
||||
} else {
|
||||
showDanger("用户信息获取失败");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
async login() {
|
||||
if (this.isMobileLogin) {
|
||||
@@ -361,7 +367,7 @@ export default {
|
||||
({ data }) => {
|
||||
showSuccess(this.$t('login.loginSuccess'));
|
||||
this.$store.commit("setToken", JSON.stringify(data.data));
|
||||
goToPage("/home");
|
||||
this.getUserInfo();
|
||||
},
|
||||
(err) => {
|
||||
// 直接使用后端返回的国际化消息
|
||||
|
||||
Reference in New Issue
Block a user