This commit is contained in:
Zy
2026-06-09 10:10:54 +08:00
4 changed files with 9 additions and 2 deletions

View File

@@ -224,6 +224,8 @@ const handleLogin = () => {
if (res.data.userId) {
uni.setStorageSync('userId', res.data.userId)
}
// 清掉上次账号的小区缓存,防止新账号显示旧小区
uni.removeStorageSync('currentVillage')
// 存当前绑定的小区ID,0 表示未绑定
const currentVillageId = res.data.currentVillageId || 0
uni.setStorageSync('currentVillageId', currentVillageId)

View File

@@ -161,6 +161,8 @@
// console.log('33333',res)
if(res.code === 200){
uni.setStorageSync('token', res.data.token);
// 清掉上次账号的小区缓存,防止新账号显示旧小区
uni.removeStorageSync('currentVillage');
// 存用户ID
// if(res.data) {
// // 存当前绑定的小区ID,0 表示未绑定

View File

@@ -29,7 +29,7 @@
<!-- 退出登录按钮 -->
<view class="logout-btn-wrap">
<button class="logout-btn" :disabled="!phoneNumber" @tap="handleLogout">
<button class="logout-btn" @tap="handleLogout">
退出登录
</button>
</view>

View File

@@ -44,7 +44,7 @@
@clickItem="clickItem"
:info="bannerList"
:current="current"
mode="round"
mode="default"
>
<swiper class="swiper-box" :current="current" @change="onSwiperChange" autoplay>
<swiper-item v-for="(item, index) in bannerList" :key="index">
@@ -238,6 +238,8 @@ const goToReport = () => {
}
// 获取当前小区
const currentVillageData = () => {
// 先重置,避免新账号无小区时仍显示旧账号的小区
currentCommunity.value = '请选择小区'
getCurrentVillage()
.then(res => {
const data = res.data
@@ -306,6 +308,7 @@ const slelctHomeData = data => {
onShow(() => {
getbannarData()
getInspectionData()
currentVillageData()
})
onLoad(() => {