From aaf828c6e3fe1e9cc1eb30c1d92f6d89a509ebd2 Mon Sep 17 00:00:00 2001 From: zhouyanli <593579392@qq.com> Date: Tue, 9 Jun 2026 17:11:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=87=E6=8D=A2=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E7=BB=91=E5=AE=9A=E5=B0=8F=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity-list/activityList.vue | 2 +- .../pageSubPack/activity-list/live-add.vue | 2 +- .../pageSubPack/api/api.js | 4 ++ .../pageSubPack/api/request.js | 2 +- .../pageSubPack/api/useImageUpload.js | 2 +- .../pageSubPack/loginSub/login.vue | 3 ++ .../pageSubPack/loginSub/pwd-login.vue | 1 + .../loginSub/register-new-user.vue | 1 + .../pageSubPack/my/addHouse.vue | 6 ++- .../pageSubPack/my/selectBuilding.vue | 4 +- .../online-repair/personalRepair.vue | 1 + .../online-repair/publicRepair.vue | 1 + .../complaintsSuggestionsIndex.vue | 2 +- property-uniapp-project/pages/index/index.vue | 42 ++++++++++++------- .../pages/myIndex/myIndex.vue | 10 ++--- 15 files changed, 54 insertions(+), 29 deletions(-) diff --git a/property-uniapp-project/pageSubPack/activity-list/activityList.vue b/property-uniapp-project/pageSubPack/activity-list/activityList.vue index c151d81..31da865 100644 --- a/property-uniapp-project/pageSubPack/activity-list/activityList.vue +++ b/property-uniapp-project/pageSubPack/activity-list/activityList.vue @@ -138,7 +138,7 @@ const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0) // 筛选条件:status ''全部, '0'未开始, '1'进行中, '2'已结束 const filters = ref([ - { label: '审核中', value: '' }, + { label: '全部', value: '' }, { label: '未开始', value: '0' }, { label: '进行中', value: '1' }, { label: '已结束', value: '2' } diff --git a/property-uniapp-project/pageSubPack/activity-list/live-add.vue b/property-uniapp-project/pageSubPack/activity-list/live-add.vue index c8e6505..5ea47d0 100644 --- a/property-uniapp-project/pageSubPack/activity-list/live-add.vue +++ b/property-uniapp-project/pageSubPack/activity-list/live-add.vue @@ -269,7 +269,7 @@ const submitStatus = async () => { }, 1500); } catch (err) { uni.hideLoading(); - uni.showToast({ title: err || '提交失败', icon: 'none' }); + uni.showToast({ title: err.msg || '提交失败', icon: 'none' }); } }; diff --git a/property-uniapp-project/pageSubPack/api/api.js b/property-uniapp-project/pageSubPack/api/api.js index acdf2f2..3d3435a 100644 --- a/property-uniapp-project/pageSubPack/api/api.js +++ b/property-uniapp-project/pageSubPack/api/api.js @@ -47,6 +47,10 @@ export const getVillageSwitch = (data)=>{ export const getActivitylatest = () =>{ return get('/api/resident/activity/latest') } +// 重新加载用户信息 +export const getReloadUserInfo = () =>{ + return get('/api/resident/auth/reloadUserInfo') +} // ========公告列表====== // 获取公告列表 diff --git a/property-uniapp-project/pageSubPack/api/request.js b/property-uniapp-project/pageSubPack/api/request.js index d42d578..a1c2b24 100644 --- a/property-uniapp-project/pageSubPack/api/request.js +++ b/property-uniapp-project/pageSubPack/api/request.js @@ -1,6 +1,6 @@ let baseUrl = ''; if (process.env.NODE_ENV === 'development') { - baseUrl = 'http://192.168.0.239:8080'; // 开发环境 + baseUrl = 'http://192.168.1.222:8080'; // 开发环境 } else { baseUrl = 'http://192.168.0.224:8080'; // 生产环境 } diff --git a/property-uniapp-project/pageSubPack/api/useImageUpload.js b/property-uniapp-project/pageSubPack/api/useImageUpload.js index 497d1ff..cafa5d1 100644 --- a/property-uniapp-project/pageSubPack/api/useImageUpload.js +++ b/property-uniapp-project/pageSubPack/api/useImageUpload.js @@ -1,5 +1,5 @@ // 服务器地址(与 request.js 保持一致) -const baseUrl = 'http://192.168.0.239:8080'; +const baseUrl = 'http://192.168.1.222:8080'; /** * 图片上传 Hook diff --git a/property-uniapp-project/pageSubPack/loginSub/login.vue b/property-uniapp-project/pageSubPack/loginSub/login.vue index 9f363d4..0934d56 100644 --- a/property-uniapp-project/pageSubPack/loginSub/login.vue +++ b/property-uniapp-project/pageSubPack/loginSub/login.vue @@ -155,6 +155,7 @@ const getVerifyCode = () => { }); } }).catch(err => { + uni.hideLoading(); uni.showToast({ title: '网络异常', icon: 'error' @@ -195,6 +196,7 @@ const handleLogin = () => { } getLoginBySms(params).then(res =>{ if(res.code === 200){ + uni.hideLoading(); if(res.data){ uni.setStorageSync('token', res.data.token); // 存用户ID @@ -219,6 +221,7 @@ const handleLogin = () => { } }).catch(err => { + uni.hideLoading(); uni.showToast({ title: err.msg || '网络异常,请重试', icon: 'error' diff --git a/property-uniapp-project/pageSubPack/loginSub/pwd-login.vue b/property-uniapp-project/pageSubPack/loginSub/pwd-login.vue index b27b881..8852823 100644 --- a/property-uniapp-project/pageSubPack/loginSub/pwd-login.vue +++ b/property-uniapp-project/pageSubPack/loginSub/pwd-login.vue @@ -163,6 +163,7 @@ const handleLogin = () => { }).catch(err => { // console.log('密码登录异常',err) + uni.hideLoading(); uni.showToast({ title: err.msg || '网络异常', icon: 'error' diff --git a/property-uniapp-project/pageSubPack/loginSub/register-new-user.vue b/property-uniapp-project/pageSubPack/loginSub/register-new-user.vue index 0692a54..5b52f97 100644 --- a/property-uniapp-project/pageSubPack/loginSub/register-new-user.vue +++ b/property-uniapp-project/pageSubPack/loginSub/register-new-user.vue @@ -261,6 +261,7 @@ }); } }).catch((err) => { + uni.hideLoading(); uni.showToast({ title: err.msg || '网络异常', icon: 'error' diff --git a/property-uniapp-project/pageSubPack/my/addHouse.vue b/property-uniapp-project/pageSubPack/my/addHouse.vue index 506f20d..fbd52c7 100644 --- a/property-uniapp-project/pageSubPack/my/addHouse.vue +++ b/property-uniapp-project/pageSubPack/my/addHouse.vue @@ -449,7 +449,7 @@ } } catch (err) { uni.showToast({ - title: `${err}`, + title: err.msg || '网络异常', icon: 'none' }) } finally { @@ -694,7 +694,7 @@ const params = { villageId: uni.getStorageSync('communityId'), buildingId: uni.getStorageSync('buildingId'), - unitNo: uni.getStorageSync('unitId'), + unitNoId: uni.getStorageSync('unitId'), floorNo: uni.getStorageSync('floorId'), houseNo: uni.getStorageSync('houseNumberName'), houseId: uni.getStorageSync('houseNumberId'), @@ -727,6 +727,8 @@ title: '提交成功', icon: 'success' }) + // 标记需要从绑定房屋返回首页后重新加载用户信息 + uni.setStorageSync('needReloadUserInfo', true) setTimeout(() => { goBack() }, 1500) diff --git a/property-uniapp-project/pageSubPack/my/selectBuilding.vue b/property-uniapp-project/pageSubPack/my/selectBuilding.vue index f0ba5b7..5554b7b 100644 --- a/property-uniapp-project/pageSubPack/my/selectBuilding.vue +++ b/property-uniapp-project/pageSubPack/my/selectBuilding.vue @@ -187,8 +187,8 @@ buildingId: selectedBuilding.value }) const newList = res.data.map(item => ({ - id: item, - name: item + id: item.id, + name: item.name })) dataList.value = newList diff --git a/property-uniapp-project/pageSubPack/online-repair/personalRepair.vue b/property-uniapp-project/pageSubPack/online-repair/personalRepair.vue index 452545f..8cedc1b 100644 --- a/property-uniapp-project/pageSubPack/online-repair/personalRepair.vue +++ b/property-uniapp-project/pageSubPack/online-repair/personalRepair.vue @@ -382,6 +382,7 @@ const submitForm = async () => { const res = await addQueryRepair(params) if (res.code === 200) { + uni.hideLoading(); uni.showToast({ title: '提交成功', icon: 'success' }) form.value = { title: '', desc: '', phone: '', datetime: '', images: [] } houseName.value = '' diff --git a/property-uniapp-project/pageSubPack/online-repair/publicRepair.vue b/property-uniapp-project/pageSubPack/online-repair/publicRepair.vue index 391980b..0b24bf8 100644 --- a/property-uniapp-project/pageSubPack/online-repair/publicRepair.vue +++ b/property-uniapp-project/pageSubPack/online-repair/publicRepair.vue @@ -200,6 +200,7 @@ const submitForm = async () => { const res = await addQueryRepair(params) if (res.code === 200) { + uni.hideLoading(); uni.showToast({ title: '提交成功', icon: 'success' }) // const tempProjectId = projectId.value form.value = { title: '', desc: '', phone: '', images: [] } diff --git a/property-uniapp-project/pageSubPack/service-list/complaintsSuggestionsIndex.vue b/property-uniapp-project/pageSubPack/service-list/complaintsSuggestionsIndex.vue index 7f314a5..c148871 100644 --- a/property-uniapp-project/pageSubPack/service-list/complaintsSuggestionsIndex.vue +++ b/property-uniapp-project/pageSubPack/service-list/complaintsSuggestionsIndex.vue @@ -33,7 +33,7 @@ - + diff --git a/property-uniapp-project/pages/index/index.vue b/property-uniapp-project/pages/index/index.vue index 5818c9c..d2b99b6 100644 --- a/property-uniapp-project/pages/index/index.vue +++ b/property-uniapp-project/pages/index/index.vue @@ -87,7 +87,6 @@ - @@ -98,14 +97,12 @@ 便民服务 - 邻里便民服务 全新上线 + 邻里便民服务 即将上线 - - @@ -171,14 +168,14 @@ import { ref } from 'vue' import {onLoad,onUnload,onShow} from '@dcloudio/uni-app' import moment from 'moment' -import {getNoticeLatest,getCurrentVillage,getActivitylatest,getBannarList} from "/pageSubPack/api/api.js" +import {getNoticeLatest,getCurrentVillage,getActivitylatest,getBannarList,getReloadUserInfo} from "/pageSubPack/api/api.js" // 列表数据状态 const isDropdownOpen = ref(false) const scrollTop = ref(0) const activityList = ref([]) // 活动列表数据 -const currentCommunity = ref('请认证小区') +const currentCommunity = ref('请绑定房屋') const currentVillageId = ref('') const statusBarHeight = ref(0) const bannerList = ref([]) @@ -234,7 +231,7 @@ const getCurrentCommunityData = () => { currentVillageId.value = res.data.villageId uni.setStorageSync('currentVillageId',res.data.villageId) }else{ - currentCommunity.value = '请认证小区' + currentCommunity.value = '请绑定房屋' currentVillageId.value = '' } }).catch(err =>{ @@ -269,7 +266,7 @@ const getNoticeData = async() =>{ } catch (err) { uni.showToast({ title: err.msg || '网络异常', - icon: 'error', + icon: 'none', duration: 1000 }) noticeText.value = '暂无公告' @@ -278,12 +275,27 @@ const getNoticeData = async() =>{ } // 刷新所有数据(提取公共方法) -const refreshAllData = () => { +const refreshAllData = async () => { const token = uni.getStorageSync('token') || ''; - const currentVillageId = uni.getStorageSync('currentVillageId'); - if (token && currentVillageId && currentVillageId !== '0' && currentVillageId !== 0) { - getCurrentCommunityData(); + const needReload = uni.getStorageSync('needReloadUserInfo'); + // 只有从绑定房屋返回首页时,才重新加载用户信息获取最新小区ID + if (token && needReload) { + try { + const res = await getReloadUserInfo(); + if (res.code === 200 && res.data) { + if (res.data.userId) { + uni.setStorageSync('userId', res.data.userId); + } + const reloadedVillageId = res.data.currentVillageId || 0; + uni.setStorageSync('currentVillageId', reloadedVillageId); + } + } catch (err) { + console.error('重新加载用户信息失败', err); + } finally { + uni.removeStorageSync('needReloadUserInfo'); + } } + getCurrentCommunityData(); getNoticeData() getNewActivityList() getbannarData() @@ -294,7 +306,7 @@ onShow(() => { // 检测到切换账号:重置数据并重新加载 if (lastUserId.value && lastUserId.value !== currentUserId) { // 切换账号时重置页面数据 - currentCommunity.value = '请认证小区' + currentCommunity.value = '请先绑定房屋' currentVillageId.value = '' activityList.value = [] bannerList.value = [] @@ -348,8 +360,8 @@ const navigateToPage = () => { const cachedVillageId = uni.getStorageSync('currentVillageId'); // 未登录 或 未绑定小区 → 去我的页面认证 if ( !cachedVillageId || cachedVillageId === '0' || cachedVillageId === 0) { - currentCommunity.value = '请去认证小区'; - uni.setStorageSync('currentCommunity', '请去认证小区'); + currentCommunity.value = '请先绑定房屋'; + uni.setStorageSync('currentCommunity', '请先绑定房屋'); uni.showToast({ title: '请先绑定小区', icon: 'none', diff --git a/property-uniapp-project/pages/myIndex/myIndex.vue b/property-uniapp-project/pages/myIndex/myIndex.vue index 3b30a19..4262be0 100644 --- a/property-uniapp-project/pages/myIndex/myIndex.vue +++ b/property-uniapp-project/pages/myIndex/myIndex.vue @@ -54,11 +54,11 @@ icon:'https://wuyeadmin.bugtc.com/images/propertyImgs/house.png', title: "我的房屋" }, - { - icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/user.png", - title: "住户管理", - // desc: "您可以在这里添加家人、朋友、租客~" - }, + // { + // icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/user.png", + // title: "住户管理", + // // desc: "您可以在这里添加家人、朋友、租客~" + // }, { icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/parking.png", title: "我的车位"