修复bug
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
"name" : "花开物业",
|
"name" : "花开物业",
|
||||||
"appid" : "__UNI__29C3D60",
|
"appid" : "__UNI__29C3D60",
|
||||||
"description" : "智慧社区居民端面向小区业主使用,支持注册、验证码、账号密码多种登录方式,提供密码找回功能,账号使用安全便捷。支持多小区切换,首页设有轮播 banner、社区公告,集成远程开门、生活缴费、在线报修、访客邀请、社区活动常用服务。全服务板块统一涵盖门禁开门、线上缴费、报修申报、访客预约、投诉反馈、问卷调研、活动报名、社区公示、一键联系物业功能。个人中心可管理房屋、住户、车位、车辆信息,支持更换手机号、修改密码、消息通知设置、版本更新及账号退出,一站式满足业主居家生活、社区服务、房产车辆管理需求,实现社区生活数字化、便捷化。",
|
"description" : "智慧社区居民端面向小区业主使用,支持注册、验证码、账号密码多种登录方式,提供密码找回功能,账号使用安全便捷。支持多小区切换,首页设有轮播 banner、社区公告,集成远程开门、生活缴费、在线报修、访客邀请、社区活动常用服务。全服务板块统一涵盖门禁开门、线上缴费、报修申报、访客预约、投诉反馈、问卷调研、活动报名、社区公示、一键联系物业功能。个人中心可管理房屋、住户、车位、车辆信息,支持更换手机号、修改密码、消息通知设置、版本更新及账号退出,一站式满足业主居家生活、社区服务、房产车辆管理需求,实现社区生活数字化、便捷化。",
|
||||||
"versionName" : "1.0.3",
|
"versionName" : "1.0.4",
|
||||||
"versionCode" : 116,
|
"versionCode" : 117,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
"uniCloud" : {
|
"uniCloud" : {
|
||||||
"provider" : "aliyun",
|
"provider" : "aliyun",
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
"splashscreen" : {
|
"splashscreen" : {
|
||||||
"alwaysShowBeforeRender" : true,
|
"alwaysShowBeforeRender" : true,
|
||||||
"waiting" : true,
|
"waiting" : true,
|
||||||
"autoclose" : true,
|
"autoclose" : false,
|
||||||
"delay" : 0
|
"delay" : 0
|
||||||
},
|
},
|
||||||
/* 模块配置 */
|
/* 模块配置 */
|
||||||
|
|||||||
@@ -733,13 +733,26 @@
|
|||||||
// 标记需要从绑定房屋返回首页后重新加载用户信息
|
// 标记需要从绑定房屋返回首页后重新加载用户信息
|
||||||
uni.setStorageSync('needReloadUserInfo', true)
|
uni.setStorageSync('needReloadUserInfo', true)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
goBack()
|
uni.removeStorageSync("communityId");
|
||||||
|
uni.removeStorageSync("communityName");
|
||||||
|
uni.removeStorageSync("buildingId");
|
||||||
|
uni.removeStorageSync("buildingName");
|
||||||
|
uni.removeStorageSync("unitId");
|
||||||
|
uni.removeStorageSync("unitName");
|
||||||
|
uni.removeStorageSync("floorId");
|
||||||
|
uni.removeStorageSync("floorName");
|
||||||
|
uni.removeStorageSync("houseNumberId");
|
||||||
|
uni.removeStorageSync("houseNumberName");
|
||||||
|
uni.removeStorageSync("houseStatus");
|
||||||
|
uni.removeStorageSync("houseIsDefault");
|
||||||
|
uni.removeStorageSync("updateHouseId");
|
||||||
|
uni.redirectTo({ url: "/pageSubPack/my/myHouseIndex" })
|
||||||
}, 1500)
|
}, 1500)
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// 8. 统一错误处理
|
// 8. 统一错误处理
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
console.log('提交失败:', err)
|
console.log('提交失败11111111111111:', err)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: err.msg || '提交失败',
|
title: err.msg || '提交失败',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
|
|||||||
@@ -147,7 +147,7 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await setMyHouseDefault({
|
const res = await setMyHouseDefault({
|
||||||
houseId: i.houseId
|
houseId: e.detail.value ? i.houseId : ''
|
||||||
})
|
})
|
||||||
const data = res
|
const data = res
|
||||||
if (data.code === 200) {
|
if (data.code === 200) {
|
||||||
@@ -171,7 +171,6 @@
|
|||||||
title: err.msg,
|
title: err.msg,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
console.error('列表接口报错:', err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
{
|
{
|
||||||
"pages": [{
|
"pages": [
|
||||||
"path": "pages/navigation/navigation",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "引导页",
|
|
||||||
"navigationBarTextStyle": "white",
|
|
||||||
"enablePullDownRefresh": false,
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "pages/index/index",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
@@ -26,8 +18,16 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "我的"
|
"navigationBarTitleText": "我的"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/navigation/navigation",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "引导页",
|
||||||
|
"navigationBarTextStyle": "white",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"subPackages": [{
|
"subPackages": [{
|
||||||
"root": "pageSubPack/loginSub",
|
"root": "pageSubPack/loginSub",
|
||||||
|
|||||||
@@ -183,7 +183,42 @@
|
|||||||
const noticeKey = ref(0)
|
const noticeKey = ref(0)
|
||||||
const noticeId = ref('')
|
const noticeId = ref('')
|
||||||
const lastUserId = ref('')
|
const lastUserId = ref('')
|
||||||
|
const dataLoaded = ref(false)
|
||||||
const pageReady = ref(false)
|
const pageReady = ref(false)
|
||||||
|
// ======= 首页数据缓存(冷启动秒开) =======
|
||||||
|
const HOME_CACHE_KEY = 'home_cache'
|
||||||
|
function loadHomeCache() {
|
||||||
|
try {
|
||||||
|
const raw = uni.getStorageSync(HOME_CACHE_KEY)
|
||||||
|
if (!raw) return false
|
||||||
|
const c = JSON.parse(raw)
|
||||||
|
if (c.community && c.community !== '请绑定房屋') currentCommunity.value = c.community
|
||||||
|
if (c.villageId) {
|
||||||
|
currentVillageId.value = c.villageId
|
||||||
|
uni.setStorageSync('currentVillageId', c.villageId)
|
||||||
|
}
|
||||||
|
if (c.bannerList && c.bannerList.length) bannerList.value = c.bannerList
|
||||||
|
if (c.bannerRaw && c.bannerRaw.length) bannerRawData.value = c.bannerRaw
|
||||||
|
if (c.notice && c.notice !== '暂无公告') noticeText.value = c.notice
|
||||||
|
if (c.noticeId) noticeId.value = c.noticeId
|
||||||
|
if (c.activityList && c.activityList.length) activityList.value = c.activityList
|
||||||
|
bannerSwiperKey.value++
|
||||||
|
return true
|
||||||
|
} catch (e) { return false }
|
||||||
|
}
|
||||||
|
function saveHomeCache() {
|
||||||
|
try {
|
||||||
|
uni.setStorageSync(HOME_CACHE_KEY, JSON.stringify({
|
||||||
|
community: currentCommunity.value,
|
||||||
|
villageId: currentVillageId.value,
|
||||||
|
bannerList: bannerList.value,
|
||||||
|
bannerRaw: bannerRawData.value,
|
||||||
|
notice: noticeText.value,
|
||||||
|
noticeId: noticeId.value,
|
||||||
|
activityList: activityList.value
|
||||||
|
}))
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
// =======方法=======
|
// =======方法=======
|
||||||
const formatDate = (date) => {
|
const formatDate = (date) => {
|
||||||
@@ -207,6 +242,7 @@
|
|||||||
bannerList.value = newList
|
bannerList.value = newList
|
||||||
await nextTick()
|
await nextTick()
|
||||||
bannerSwiperKey.value++
|
bannerSwiperKey.value++
|
||||||
|
saveHomeCache()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -235,6 +271,7 @@
|
|||||||
getCurrentVillage().then(res => {
|
getCurrentVillage().then(res => {
|
||||||
if (res.code === 200 && res.data && res.data.villageId) {
|
if (res.code === 200 && res.data && res.data.villageId) {
|
||||||
currentCommunity.value = res.data.villageName || '未命名小区'
|
currentCommunity.value = res.data.villageName || '未命名小区'
|
||||||
|
saveHomeCache()
|
||||||
currentVillageId.value = res.data.villageId
|
currentVillageId.value = res.data.villageId
|
||||||
uni.setStorageSync('currentVillageId', res.data.villageId)
|
uni.setStorageSync('currentVillageId', res.data.villageId)
|
||||||
} else {
|
} else {
|
||||||
@@ -256,7 +293,7 @@
|
|||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
noticeText.value = res.data.noticeTitle || ''
|
noticeText.value = res.data.noticeTitle || ''
|
||||||
noticeId.value = res.data.noticeId || ''
|
noticeId.value = res.data.noticeId || ''; saveHomeCache()
|
||||||
} else {
|
} else {
|
||||||
noticeText.value = '暂无公告'
|
noticeText.value = '暂无公告'
|
||||||
noticeId.value = ''
|
noticeId.value = ''
|
||||||
@@ -270,20 +307,19 @@
|
|||||||
|
|
||||||
const refreshAllData = async () => {
|
const refreshAllData = async () => {
|
||||||
const token = uni.getStorageSync('token') || ''
|
const token = uni.getStorageSync('token') || ''
|
||||||
|
dataLoaded.value = true
|
||||||
const needReload = uni.getStorageSync('needReloadUserInfo')
|
const needReload = uni.getStorageSync('needReloadUserInfo')
|
||||||
if (token && needReload) {
|
if (token && needReload) {
|
||||||
try {
|
uni.removeStorageSync('needReloadUserInfo')
|
||||||
const res = await getReloadUserInfo()
|
getReloadUserInfo().then(res => {
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
if (res.data.userId) uni.setStorageSync('userId', res.data.userId)
|
if (res.data.userId) uni.setStorageSync('userId', res.data.userId)
|
||||||
const reloadedVillageId = res.data.currentVillageId || 0
|
const reloadedVillageId = res.data.currentVillageId || 0
|
||||||
uni.setStorageSync('currentVillageId', reloadedVillageId)
|
uni.setStorageSync('currentVillageId', reloadedVillageId)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
}).catch(err => {
|
||||||
console.error('重新加载用户信息失败', err)
|
console.error('重新加载用户信息失败', err)
|
||||||
} finally {
|
})
|
||||||
uni.removeStorageSync('needReloadUserInfo')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
getCurrentCommunityData()
|
getCurrentCommunityData()
|
||||||
getNoticeData()
|
getNoticeData()
|
||||||
@@ -314,16 +350,34 @@
|
|||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
const currentUserId = uni.getStorageSync('userId') || ''
|
const currentUserId = uni.getStorageSync('userId') || ''
|
||||||
if (lastUserId.value && lastUserId.value !== currentUserId) {
|
const userIdChanged = lastUserId.value && lastUserId.value !== currentUserId
|
||||||
|
refreshing.value = false
|
||||||
|
if (userIdChanged) {
|
||||||
resetPageData()
|
resetPageData()
|
||||||
refreshAllData()
|
refreshAllData()
|
||||||
} else {
|
} else if (!dataLoaded.value) {
|
||||||
|
// 首次进入且之前因无 token 跳过了 API,现在有 token 则补拉
|
||||||
refreshAllData()
|
refreshAllData()
|
||||||
}
|
}
|
||||||
lastUserId.value = currentUserId
|
lastUserId.value = currentUserId
|
||||||
})
|
})
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
|
// 新用户(未看过引导页且未登录)跳转引导页
|
||||||
|
var hasShowGuide = uni.getStorageSync('hasShowGuide')
|
||||||
|
var token = uni.getStorageSync('token')
|
||||||
|
if (!hasShowGuide && !token) {
|
||||||
|
uni.reLaunch({ url: '/pages/navigation/navigation' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 优先展示缓存数据,实现冷启动秒开
|
||||||
|
loadHomeCache()
|
||||||
|
// 关闭原生 splash,避免 WebView 初始化期间一直转圈
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
try { plus.navigator.closeSplashscreen() } catch (e) {}
|
||||||
|
// #endif
|
||||||
|
// 后台静默刷新最新数据
|
||||||
|
refreshAllData()
|
||||||
uni.$on('confirm', slelctHomeData)
|
uni.$on('confirm', slelctHomeData)
|
||||||
lastUserId.value = uni.getStorageSync('userId') || ''
|
lastUserId.value = uni.getStorageSync('userId') || ''
|
||||||
})
|
})
|
||||||
@@ -358,7 +412,7 @@
|
|||||||
try {
|
try {
|
||||||
const res = await getActivitylatest({ villageId: uni.getStorageSync('currentVillageId') })
|
const res = await getActivitylatest({ villageId: uni.getStorageSync('currentVillageId') })
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
activityList.value = res.data || []
|
activityList.value = res.data || []; saveHomeCache()
|
||||||
} else {
|
} else {
|
||||||
activityList.value = []
|
activityList.value = []
|
||||||
}
|
}
|
||||||
@@ -634,6 +688,9 @@
|
|||||||
color: #333;
|
color: #333;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
|
white-space: normal;
|
||||||
|
word-break: break-all;
|
||||||
|
overflow-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.activity-time {
|
.activity-time {
|
||||||
|
|||||||
@@ -148,8 +148,16 @@
|
|||||||
complete: () => {}
|
complete: () => {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
let lastUserIdMy = ''
|
||||||
onShow(() =>{
|
onShow(() =>{
|
||||||
getUserInfoData()
|
const token = uni.getStorageSync('token')
|
||||||
|
if (!token) return
|
||||||
|
const currentUserId = uni.getStorageSync('userId') || ''
|
||||||
|
// 仅登录状态变化时刷新,切后台回来直接用缓存
|
||||||
|
if (currentUserId !== lastUserIdMy) {
|
||||||
|
lastUserIdMy = currentUserId
|
||||||
|
getUserInfoData()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -73,30 +73,17 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
|
|
||||||
// 守卫:已登录或已看过引导页的用户不展示引导页,直接跳转
|
// ========== 响应式数据 ==========
|
||||||
const hasShowGuide = uni.getStorageSync('hasShowGuide')
|
|
||||||
const tokenSave = uni.getStorageSync('token')
|
|
||||||
// 是否需要重定向(老用户跳过引导页)
|
|
||||||
const needRedirect = hasShowGuide || tokenSave
|
|
||||||
|
|
||||||
if (needRedirect) {
|
|
||||||
// 已登录或已看过引导页:直接进首页
|
|
||||||
uni.reLaunch({ url: '/pages/index/index' })
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========== 响应式数据 ==========
|
|
||||||
// 当前引导步骤(0/1/2)
|
// 当前引导步骤(0/1/2)
|
||||||
const currentStep = ref(0);
|
const currentStep = ref(0);
|
||||||
const mode = ref("default")
|
const mode = ref("default")
|
||||||
// 防重复跳转锁
|
// 防重复跳转锁
|
||||||
const isNavigating = ref(false)
|
const isNavigating = ref(false)
|
||||||
// 控制是否展示引导内容(初始为 false,避免重定向用户看到闪烁)
|
// 控制是否展示引导内容
|
||||||
const showContent = ref(false)
|
const showContent = ref(false)
|
||||||
|
|
||||||
// 页面挂载后延迟显示,让过渡更平滑
|
// 页面挂载后延迟显示,让过渡更平滑
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 需要重定向的用户不展示引导内容
|
|
||||||
if (needRedirect) return
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
showContent.value = true
|
showContent.value = true
|
||||||
}, 100)
|
}, 100)
|
||||||
@@ -110,16 +97,12 @@ const handleSwiperChange = (e) => {
|
|||||||
|
|
||||||
// 点击按钮操作
|
// 点击按钮操作
|
||||||
const handleBtnClick = () => {
|
const handleBtnClick = () => {
|
||||||
// 前两步:点击下一步切换
|
|
||||||
if (currentStep.value < 2) {
|
if (currentStep.value < 2) {
|
||||||
currentStep.value++;
|
currentStep.value++;
|
||||||
} else {
|
} else {
|
||||||
// 防重复跳转:已触发过跳转则直接返回
|
|
||||||
if (isNavigating.value) return;
|
if (isNavigating.value) return;
|
||||||
isNavigating.value = true;
|
isNavigating.value = true;
|
||||||
// 记录引导已完成
|
|
||||||
uni.setStorageSync('hasShowGuide', true);
|
uni.setStorageSync('hasShowGuide', true);
|
||||||
// 直接进入首页(未登录用户可正常浏览首页,需登录的功能由点击拦截处理)
|
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user