解决微信小程序首页空白问题。

This commit is contained in:
cst61
2026-02-01 09:21:11 +08:00
parent 80d6d46182
commit cc01c4dc47
454 changed files with 404 additions and 62235 deletions

View File

@@ -116,10 +116,12 @@
import { put, get } from '@/common/request.js'
import DeviceBindPopup from './components/DeviceBindPopup.vue'
import DeviceListPopup from './components/DeviceListPopup.vue'
import CloudImage from '@/uni_modules/uni-id-pages/components/cloud-image/cloud-image.vue'
export default {
components: {
DeviceBindPopup,
DeviceListPopup
DeviceListPopup,
CloudImage
},
// #ifdef APP
onBackPress({from}) {
@@ -227,6 +229,19 @@
//#endif
},
onShow() {
try {
const storageUserInfo = uni.getStorageSync('uni-id-pages-userInfo') || {};
// 关键修复如果存储中有用户信息但store中没有则同步到store
if (Object.keys(storageUserInfo).length > 0 && Object.keys(store.userInfo || {}).length === 0) {
const synced = mutations.syncUserInfoFromStorage();
if (!synced) {
// 如果同步方法失败直接使用setUserInfo
mutations.setUserInfo(storageUserInfo, { cover: true });
}
}
} catch (e) {
// 静默失败
}
// 每次显示页面时更新租户信息和登录人信息
this.loadUserInfo()
// 加载设备统计信息
@@ -245,11 +260,21 @@
},
// #ifdef APP-PLUS
appVersion() {
return getApp().appVersion
try {
const app = getApp({ allowDefault: true });
return app ? app.appVersion : {};
} catch (e) {
return {};
}
},
// #endif
appConfig() {
return getApp().globalData.config
try {
const app = getApp({ allowDefault: true });
return app && app.globalData ? app.globalData.config : {};
} catch (e) {
return {};
}
}
},
methods: {