发布职位网格员模糊查询企业开发
This commit is contained in:
@@ -88,16 +88,10 @@ const generateTabbarList = () => {
|
||||
// 优先从store获取,如果为空则直接从缓存获取
|
||||
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
|
||||
|
||||
console.log('完整userInfo对象:', userInfo.value);
|
||||
console.log('缓存中的userInfo:', cachedUserInfo);
|
||||
|
||||
// 获取isCompanyUser字段
|
||||
const storeIsCompanyUser = userInfo.value?.isCompanyUser;
|
||||
const cachedIsCompanyUser = cachedUserInfo.isCompanyUser;
|
||||
|
||||
console.log('store中的isCompanyUser:', storeIsCompanyUser);
|
||||
console.log('缓存中的isCompanyUser:', cachedIsCompanyUser);
|
||||
|
||||
// 获取用户类型的逻辑:
|
||||
// 1. 优先使用store中的isCompanyUser
|
||||
// 2. 如果store中没有,使用缓存中的isCompanyUser
|
||||
@@ -140,18 +134,11 @@ const forceRefresh = () => {
|
||||
// 触发响应式更新
|
||||
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
|
||||
const currentUserType = userInfo.value?.isCompanyUser !== undefined ? userInfo.value.isCompanyUser : (cachedUserInfo.isCompanyUser !== undefined ? cachedUserInfo.isCompanyUser : 1);
|
||||
console.log('强制刷新tabbar,当前用户类型:', currentUserType);
|
||||
};
|
||||
|
||||
// 监听用户类型变化(只监听isCompanyUser字段)
|
||||
watch(() => userInfo.value?.isCompanyUser, (newIsCompanyUser, oldIsCompanyUser) => {
|
||||
console.log('用户类型变化监听:', {
|
||||
newIsCompanyUser,
|
||||
oldIsCompanyUser,
|
||||
userInfo: userInfo.value
|
||||
});
|
||||
if (newIsCompanyUser !== oldIsCompanyUser) {
|
||||
console.log('用户类型发生变化,重新生成tabbar:', newIsCompanyUser);
|
||||
// 强制触发computed重新计算
|
||||
forceRefresh();
|
||||
}
|
||||
@@ -159,9 +146,7 @@ watch(() => userInfo.value?.isCompanyUser, (newIsCompanyUser, oldIsCompanyUser)
|
||||
|
||||
// 监听用户信息变化(包括登录状态)
|
||||
watch(() => userInfo.value, (newUserInfo, oldUserInfo) => {
|
||||
console.log('用户信息变化监听:', { newUserInfo, oldUserInfo });
|
||||
if (newUserInfo !== oldUserInfo) {
|
||||
console.log('用户信息发生变化,重新生成tabbar');
|
||||
// 强制触发computed重新计算
|
||||
forceRefresh();
|
||||
}
|
||||
@@ -196,8 +181,6 @@ const switchTab = (item, index) => {
|
||||
onMounted(() => {
|
||||
currentItem.value = props.currentPage;
|
||||
// 调试信息:显示当前用户状态和tabbar配置
|
||||
console.log('CustomTabBar mounted, 用户信息:', userInfo.value);
|
||||
console.log('当前tabbar配置:', tabbarList.value);
|
||||
forceRefresh();
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user