修改生活缴费功能
This commit is contained in:
@@ -186,10 +186,10 @@
|
||||
const dataLoaded = ref(false)
|
||||
const pageReady = ref(false)
|
||||
// ======= 首页数据缓存(冷启动秒开) =======
|
||||
const HOME_CACHE_KEY = 'home_cache'
|
||||
const getHomeCacheKey = () => 'home_cache_' + (uni.getStorageSync('userId') || '')
|
||||
function loadHomeCache() {
|
||||
try {
|
||||
const raw = uni.getStorageSync(HOME_CACHE_KEY)
|
||||
const raw = uni.getStorageSync(getHomeCacheKey())
|
||||
if (!raw) return false
|
||||
const c = JSON.parse(raw)
|
||||
if (c.community && c.community !== '请绑定房屋') currentCommunity.value = c.community
|
||||
@@ -208,7 +208,7 @@
|
||||
}
|
||||
function saveHomeCache() {
|
||||
try {
|
||||
uni.setStorageSync(HOME_CACHE_KEY, JSON.stringify({
|
||||
uni.setStorageSync(getHomeCacheKey(), JSON.stringify({
|
||||
community: currentCommunity.value,
|
||||
villageId: currentVillageId.value,
|
||||
bannerList: bannerList.value,
|
||||
@@ -273,7 +273,7 @@
|
||||
}
|
||||
|
||||
const getCurrentCommunityData = () => {
|
||||
getCurrentVillage().then(res => {
|
||||
return getCurrentVillage().then(res => {
|
||||
if (res.code === 200 && res.data && res.data.villageId) {
|
||||
currentCommunity.value = res.data.villageName || '未命名小区'
|
||||
saveHomeCache()
|
||||
@@ -329,7 +329,8 @@
|
||||
console.error('重新加载用户信息失败', err)
|
||||
})
|
||||
}
|
||||
getCurrentCommunityData()
|
||||
// 先获取小区信息,确保 villageId 已更新,再请求依赖 villageId 的接口
|
||||
await getCurrentCommunityData()
|
||||
getNoticeData()
|
||||
getNewActivityList()
|
||||
getbannarData()
|
||||
@@ -348,12 +349,13 @@
|
||||
const resetPageData = () => {
|
||||
currentCommunity.value = '请绑定房屋'
|
||||
currentVillageId.value = ''
|
||||
uni.removeStorageSync('currentVillageId')
|
||||
activityList.value = []
|
||||
bannerList.value = []
|
||||
bannerRawData.value = []
|
||||
noticeText.value = '暂无公告'
|
||||
noticeId.value = ''
|
||||
uni.removeStorageSync(HOME_CACHE_KEY)
|
||||
uni.removeStorageSync(getHomeCacheKey())
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
@@ -395,15 +397,14 @@
|
||||
})
|
||||
|
||||
|
||||
|
||||
const navigateToPage = () => {
|
||||
const cachedVillageId = uni.getStorageSync('currentVillageId')
|
||||
if (!cachedVillageId || cachedVillageId === '0' || cachedVillageId === 0) {
|
||||
uni.navigateTo({ url: '/pageSubPack/my/myHouseIndex' })
|
||||
} else {
|
||||
const navigateToPage = () => {
|
||||
const cachedVillageId = uni.getStorageSync('currentVillageId')
|
||||
if (!cachedVillageId || cachedVillageId === '0' || cachedVillageId === 0) {
|
||||
uni.navigateTo({ url: '/pageSubPack/my/myHouseIndex' })
|
||||
} else {
|
||||
uni.navigateTo({ url: `/pageSubPack/notice-list/selectHome?villageId=${cachedVillageId}` })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const serviceClick = (item) => {
|
||||
if (!requireLogin()) return
|
||||
|
||||
Reference in New Issue
Block a user