银联支付集成和购买插件;修改首页小区更改后获取数据;对接我的信息接口

This commit is contained in:
zhouyanli
2026-06-04 17:42:29 +08:00
parent 4d0515e5fe
commit a8e3d1f875
11 changed files with 409 additions and 324 deletions

View File

@@ -184,6 +184,7 @@ const statusBarHeight = ref(0)
const bannerList = ref([])
const noticeText = ref('暂无公告')
const noticeId = ref('')
const lastUserId = ref('') // 用于检测是否切换账号
// =======方法=======
// 格式化时间
@@ -276,9 +277,37 @@ const getNoticeData = async() =>{
}
}
onShow(() =>{
})
// 刷新所有数据(提取公共方法)
const refreshAllData = () => {
const token = uni.getStorageSync('token') || '';
const currentVillageId = uni.getStorageSync('currentVillageId');
if (token && currentVillageId && currentVillageId !== '0' && currentVillageId !== 0) {
getCurrentCommunityData();
}
getNoticeData()
getNewActivityList()
getbannarData()
}
onShow(() => {
const currentUserId = uni.getStorageSync('userId') || ''
// 检测到切换账号:重置数据并重新加载
if (lastUserId.value && lastUserId.value !== currentUserId) {
// 切换账号时重置页面数据
currentCommunity.value = '请认证小区'
currentVillageId.value = ''
activityList.value = []
bannerList.value = []
noticeText.value = '暂无公告'
noticeId.value = ''
refreshAllData()
}
// 首次显示 或 非切换账号的普通返回,也刷新数据
else {
refreshAllData()
}
lastUserId.value = currentUserId
})
onLoad(() => {
const info = uni.getSystemInfoSync()
@@ -287,15 +316,11 @@ onLoad(() => {
// 绑定全局事件监听
uni.$on('confirm', slelctHomeData)
// 页面加载时先判断是否有token有则获取认证小区
const token = uni.getStorageSync('token') || '';
const currentVillageId = uni.getStorageSync('currentVillageId');
if (token && currentVillageId && currentVillageId !== '0' && currentVillageId !== 0) {
getCurrentCommunityData(); // 加载时获取认证小区
}
getNoticeData()
getNewActivityList()
getbannarData()
// 记录当前用户ID用于 onShow 中检测是否切换账号
lastUserId.value = uni.getStorageSync('userId') || ''
// 页面加载时刷新数据
refreshAllData()
})
// 页面销毁时移除监听(防止内存泄漏)