修复bug

This commit is contained in:
zhouyanli
2026-08-04 15:43:20 +08:00
parent 57756f016e
commit 466f710b33
6 changed files with 11 additions and 4 deletions

View File

@@ -260,6 +260,11 @@ const doLogin = () => {
const onLoginSuccess = (res) => { const onLoginSuccess = (res) => {
if (res.code === 200 && res.data) { if (res.code === 200 && res.data) {
// 换号登录时清除旧用户首页缓存,防止新用户看到旧用户的小区数据
const oldUserId = uni.getStorageSync('userId')
if (res.data.userId && String(oldUserId) !== String(res.data.userId)) {
uni.removeStorageSync('home_cache')
}
uni.setStorageSync('token', res.data.token) uni.setStorageSync('token', res.data.token)
if (res.data.userId) { uni.setStorageSync('userId', res.data.userId) } if (res.data.userId) { uni.setStorageSync('userId', res.data.userId) }
const currentVillageId = res.data.currentVillageId || 0 const currentVillageId = res.data.currentVillageId || 0

View File

@@ -129,7 +129,7 @@
} }
const goBack = () => { const goBack = () => {
uni.switchTab({ url: '/pages/myIndex/myIndex' }) uni.navigateBack({ delta: 1 })
} }
</script> </script>

View File

@@ -198,7 +198,7 @@
} }
const goBack = () => { const goBack = () => {
uni.switchTab({ url: '/pages/myIndex/myIndex' }) uni.navigateBack({ delta: 1 })
} }
</script> </script>

View File

@@ -164,7 +164,7 @@
} }
const goBack = () => { const goBack = () => {
uni.switchTab({ url: '/pages/myIndex/myIndex' }) uni.navigateBack({ delta: 1 })
} }
</script> </script>

View File

@@ -293,6 +293,7 @@
uni.removeStorageSync('token') uni.removeStorageSync('token')
uni.removeStorageSync('userId') uni.removeStorageSync('userId')
uni.removeStorageSync('currentVillageId') uni.removeStorageSync('currentVillageId')
uni.removeStorageSync('home_cache')
uni.hideLoading() uni.hideLoading()
uni.hideToast() uni.hideToast()
uni.reLaunch({ url: '/pageSubPack/loginSub/login?mode=pwd' }) uni.reLaunch({ url: '/pageSubPack/loginSub/login?mode=pwd' })

View File

@@ -346,13 +346,14 @@
} }
const resetPageData = () => { const resetPageData = () => {
currentCommunity.value = '请绑定房屋' currentCommunity.value = '请绑定房屋'
currentVillageId.value = '' currentVillageId.value = ''
activityList.value = [] activityList.value = []
bannerList.value = [] bannerList.value = []
bannerRawData.value = [] bannerRawData.value = []
noticeText.value = '暂无公告' noticeText.value = '暂无公告'
noticeId.value = '' noticeId.value = ''
uni.removeStorageSync(HOME_CACHE_KEY)
} }
onShow(() => { onShow(() => {