修复bug
This commit is contained in:
@@ -247,6 +247,7 @@
|
|||||||
import {
|
import {
|
||||||
onReachBottom,
|
onReachBottom,
|
||||||
onLoad,
|
onLoad,
|
||||||
|
onShow,
|
||||||
onUnload,
|
onUnload,
|
||||||
onPullDownRefresh
|
onPullDownRefresh
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
@@ -496,6 +497,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 页面显示时从 storage 同步选择数据(从选择小区/楼栋等页面返回时)
|
||||||
|
// 注意:不用 || 兜底,否则 storage 被清空后旧值会残留导致页面显示与实际数据不一致
|
||||||
|
const syncFormDataFromStorage = () => {
|
||||||
|
formData.community = uni.getStorageSync('communityName')
|
||||||
|
formData.communityId = uni.getStorageSync('communityId')
|
||||||
|
formData.building = uni.getStorageSync('buildingName')
|
||||||
|
formData.buildingId = uni.getStorageSync('buildingId')
|
||||||
|
formData.unit = uni.getStorageSync('unitName')
|
||||||
|
formData.unitId = uni.getStorageSync('unitId')
|
||||||
|
formData.floor = uni.getStorageSync('floorName')
|
||||||
|
formData.floorId = uni.getStorageSync('floorId')
|
||||||
|
formData.houseNumber = uni.getStorageSync('houseNumberName')
|
||||||
|
formData.houseNumberId = uni.getStorageSync('houseNumberId')
|
||||||
|
formData.status = uni.getStorageSync('houseStatus')
|
||||||
|
}
|
||||||
|
onShow(() => {
|
||||||
|
syncFormDataFromStorage()
|
||||||
|
})
|
||||||
const chooseIdCard = async (type) => {
|
const chooseIdCard = async (type) => {
|
||||||
try {
|
try {
|
||||||
const tempPath = await (type === 'front' ? idCardFrontUpload.chooseImage() : idCardBackUpload
|
const tempPath = await (type === 'front' ? idCardFrontUpload.chooseImage() : idCardBackUpload
|
||||||
@@ -764,7 +784,21 @@
|
|||||||
uni.removeStorageSync("houseStatus");
|
uni.removeStorageSync("houseStatus");
|
||||||
uni.removeStorageSync("houseIsDefault");
|
uni.removeStorageSync("houseIsDefault");
|
||||||
uni.removeStorageSync("updateHouseId");
|
uni.removeStorageSync("updateHouseId");
|
||||||
uni.redirectTo({ url: "/pageSubPack/my/myHouseIndex" })
|
// 在页面栈中找到 myHouseIndex 并精准返回
|
||||||
|
const pages = getCurrentPages()
|
||||||
|
let targetIndex = -1
|
||||||
|
for (let i = pages.length - 1; i >= 0; i--) {
|
||||||
|
if (pages[i].route && pages[i].route.includes('myHouseIndex')) {
|
||||||
|
targetIndex = i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (targetIndex >= 0) {
|
||||||
|
const delta = pages.length - 1 - targetIndex
|
||||||
|
uni.navigateBack({ delta })
|
||||||
|
} else {
|
||||||
|
uni.redirectTo({ url: "/pageSubPack/my/myHouseIndex" })
|
||||||
|
}
|
||||||
}, 1500)
|
}, 1500)
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -449,8 +449,9 @@
|
|||||||
.photo-list {
|
.photo-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 20rpx;
|
/* gap: 20rpx; */
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.photo-item {
|
.photo-item {
|
||||||
@@ -458,6 +459,10 @@
|
|||||||
height: 170px;
|
height: 170px;
|
||||||
background-color: #f6f6f6;
|
background-color: #f6f6f6;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
.photo-item:last-child{
|
||||||
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom-btn-wrap {
|
.bottom-btn-wrap {
|
||||||
|
|||||||
@@ -68,8 +68,10 @@
|
|||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
onMounted,
|
onMounted,
|
||||||
|
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
onShow
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
import {
|
import {
|
||||||
getMyHouseList,
|
getMyHouseList,
|
||||||
setMyHouseDefault
|
setMyHouseDefault
|
||||||
@@ -141,6 +143,13 @@
|
|||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 页面显示时刷新列表(从添加/编辑房屋页返回时)
|
||||||
|
onShow(() => {
|
||||||
|
pageNum.value = 1
|
||||||
|
noMoreData.value = false
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const onSwitchChange = async (e, i) => {
|
const onSwitchChange = async (e, i) => {
|
||||||
|
|||||||
@@ -275,6 +275,7 @@
|
|||||||
color: #FF8F40;
|
color: #FF8F40;
|
||||||
margin-top: 8rpx;
|
margin-top: 8rpx;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===== 更多积分兑换 ===== */
|
/* ===== 更多积分兑换 ===== */
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
{{ '暂无数据'}}
|
{{ '暂无数据'}}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="building-grid">
|
<view class="building-grid" :class="{ disabled: isNavigating }">
|
||||||
<view class="building-item"
|
<view class="building-item"
|
||||||
:class="{ active:(checkType=='楼栋'&& selectedBuilding === item.id)||(checkType=='单元'&& selectedUnit === item.id)||(checkType=='楼层'&&selectedFloor === item.id) ||(checkType=='户号'&&selectedHouseNumber === item.id) }"
|
:class="{ active:(checkType=='楼栋'&& selectedBuilding === item.id)||(checkType=='单元'&& selectedUnit === item.id)||(checkType=='楼层'&&selectedFloor === item.id) ||(checkType=='户号'&&selectedHouseNumber === item.id) }"
|
||||||
v-for="(item, index) in dataList" :key="index" @click="selectBuilding(item)">
|
v-for="(item, index) in dataList" :key="index" @click="selectBuilding(item)">
|
||||||
@@ -52,6 +52,9 @@
|
|||||||
// 从缓存获取类型
|
// 从缓存获取类型
|
||||||
const checkType = ref(uni.getStorageSync('checkType') || '')
|
const checkType = ref(uni.getStorageSync('checkType') || '')
|
||||||
const dataList = ref([])
|
const dataList = ref([])
|
||||||
|
// 添加防重复点击锁
|
||||||
|
const isNavigating = ref(false)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -78,75 +81,63 @@
|
|||||||
|
|
||||||
// 选择项方法
|
// 选择项方法
|
||||||
const selectBuilding = (item) => {
|
const selectBuilding = (item) => {
|
||||||
const modalContent = `确认选择此${checkType.value}吗?`
|
// 防重复点击
|
||||||
uni.showModal({
|
if (isNavigating.value) return
|
||||||
title: '确认选择',
|
isNavigating.value = true
|
||||||
content: modalContent,
|
|
||||||
success: (res) => {
|
|
||||||
if (!res.confirm) return
|
|
||||||
uni.showLoading({
|
|
||||||
title: '选择中...',
|
|
||||||
mask: true
|
|
||||||
})
|
|
||||||
if (checkType.value === '楼栋') {
|
|
||||||
selectedBuilding.value = item.id
|
|
||||||
uni.setStorageSync('buildingId', item.id)
|
|
||||||
uni.setStorageSync('buildingName', item.name)
|
|
||||||
uni.removeStorageSync('unitId')
|
|
||||||
uni.removeStorageSync('unitName')
|
|
||||||
uni.removeStorageSync('floorId')
|
|
||||||
uni.removeStorageSync('floorName')
|
|
||||||
uni.removeStorageSync('houseNumberId')
|
|
||||||
uni.removeStorageSync('houseNumberName')
|
|
||||||
uni.setStorageSync('checkType', '单元')
|
|
||||||
} else if (checkType.value === '单元') {
|
|
||||||
selectedUnit.value = item.id
|
|
||||||
uni.setStorageSync('unitId', item.id)
|
|
||||||
uni.setStorageSync('unitName', item.name)
|
|
||||||
uni.removeStorageSync('floorId')
|
|
||||||
uni.removeStorageSync('floorName')
|
|
||||||
uni.removeStorageSync('houseNumberId')
|
|
||||||
uni.removeStorageSync('houseNumberName')
|
|
||||||
uni.setStorageSync('checkType', '楼层')
|
|
||||||
} else if (checkType.value === '楼层') {
|
|
||||||
selectedFloor.value = item.id
|
|
||||||
uni.setStorageSync('floorId', item.id)
|
|
||||||
uni.setStorageSync('floorName', item.name)
|
|
||||||
uni.removeStorageSync('houseNumberId')
|
|
||||||
uni.removeStorageSync('houseNumberName')
|
|
||||||
uni.setStorageSync('checkType', '户号')
|
|
||||||
} else if (checkType.value === '户号') {
|
|
||||||
selectedHouseNumber.value = item.id
|
|
||||||
uni.setStorageSync('houseNumberId', item.id)
|
|
||||||
uni.setStorageSync('houseNumberName', item.name)
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(() => {
|
if (checkType.value === '楼栋') {
|
||||||
uni.showToast({
|
selectedBuilding.value = item.id
|
||||||
title: '选择成功',
|
uni.setStorageSync('buildingId', item.id)
|
||||||
icon: 'success'
|
uni.setStorageSync('buildingName', item.name)
|
||||||
})
|
uni.removeStorageSync('unitId')
|
||||||
}, 500)
|
uni.removeStorageSync('unitName')
|
||||||
|
uni.removeStorageSync('floorId')
|
||||||
|
uni.removeStorageSync('floorName')
|
||||||
|
uni.removeStorageSync('houseNumberId')
|
||||||
|
uni.removeStorageSync('houseNumberName')
|
||||||
|
uni.setStorageSync('checkType', '单元')
|
||||||
|
} else if (checkType.value === '单元') {
|
||||||
|
selectedUnit.value = item.id
|
||||||
|
uni.setStorageSync('unitId', item.id)
|
||||||
|
uni.setStorageSync('unitName', item.name)
|
||||||
|
uni.removeStorageSync('floorId')
|
||||||
|
uni.removeStorageSync('floorName')
|
||||||
|
uni.removeStorageSync('houseNumberId')
|
||||||
|
uni.removeStorageSync('houseNumberName')
|
||||||
|
uni.setStorageSync('checkType', '楼层')
|
||||||
|
} else if (checkType.value === '楼层') {
|
||||||
|
selectedFloor.value = item.id
|
||||||
|
uni.setStorageSync('floorId', item.id)
|
||||||
|
uni.setStorageSync('floorName', item.name)
|
||||||
|
uni.removeStorageSync('houseNumberId')
|
||||||
|
uni.removeStorageSync('houseNumberName')
|
||||||
|
uni.setStorageSync('checkType', '户号')
|
||||||
|
} else if (checkType.value === '户号') {
|
||||||
|
selectedHouseNumber.value = item.id
|
||||||
|
uni.setStorageSync('houseNumberId', item.id)
|
||||||
|
uni.setStorageSync('houseNumberName', item.name)
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
uni.showToast({
|
||||||
uni.hideLoading()
|
title: '选择成功',
|
||||||
goFreash()
|
icon: 'success'
|
||||||
}, 2000)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
goFreash()
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
// 刷新跳转
|
// 刷新跳转
|
||||||
const goFreash = () => {
|
const goFreash = () => {
|
||||||
console.log(checkType.value, '刷新页面')
|
console.log(checkType.value, '刷新页面')
|
||||||
if (checkType.value !== '户号') {
|
if (checkType.value !== '户号') {
|
||||||
uni.navigateTo({
|
// 楼栋/单元/楼层:替换当前页,链式选择不堆叠
|
||||||
|
uni.redirectTo({
|
||||||
url: '/pageSubPack/my/selectBuilding'
|
url: '/pageSubPack/my/selectBuilding'
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.navigateTo({
|
// 户号选择完成:返回已有的 addHouse 页面(addHouse 通过 onShow 重新读取 storage)
|
||||||
url: '/pageSubPack/my/addHouse'
|
uni.navigateBack()
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,6 +259,11 @@
|
|||||||
gap: 30rpx;
|
gap: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 正在跳转时禁用点击 */
|
||||||
|
.building-grid.disabled {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* 空状态 */
|
/* 空状态 */
|
||||||
.empty-state {
|
.empty-state {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -125,11 +125,9 @@
|
|||||||
uni.removeStorageSync('parkingSpaceName');
|
uni.removeStorageSync('parkingSpaceName');
|
||||||
console.log(sourcePage.value);
|
console.log(sourcePage.value);
|
||||||
if (sourcePage.value == 'addHouse') {
|
if (sourcePage.value == 'addHouse') {
|
||||||
uni.navigateTo({
|
// 替换当前页进入楼栋选择,避免页面堆叠
|
||||||
url: '/pageSubPack/my/selectBuilding',
|
uni.redirectTo({
|
||||||
success: res => {},
|
url: '/pageSubPack/my/selectBuilding'
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
});
|
||||||
} else if (sourcePage.value == 'addParkingSpace') {
|
} else if (sourcePage.value == 'addParkingSpace') {
|
||||||
uni.setStorageSync('checkType', '停车场')
|
uni.setStorageSync('checkType', '停车场')
|
||||||
|
|||||||
@@ -58,12 +58,12 @@
|
|||||||
title: '注销账号',
|
title: '注销账号',
|
||||||
type: 'arrow'
|
type: 'arrow'
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// title: '升级版本',
|
title: '升级版本',
|
||||||
// type: 'text',
|
type: 'text',
|
||||||
// value: '当前版本 1.0.0',
|
value: '当前版本 1.0.0',
|
||||||
// valueClass: 'item-version'
|
valueClass: 'item-version'
|
||||||
// }
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
// 格式化字节大小
|
// 格式化字节大小
|
||||||
|
|||||||
@@ -52,11 +52,11 @@
|
|||||||
|
|
||||||
|
|
||||||
const list = ref([
|
const list = ref([
|
||||||
{
|
// {
|
||||||
icon:'https://wuye.ckdzkj.com/images/propertyImgs/points.png',
|
// icon:'https://wuye.ckdzkj.com/images/propertyImgs/points.png',
|
||||||
title: "我的积分",
|
// title: "我的积分",
|
||||||
desc:'999'
|
// desc:'999'
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
icon:'https://wuye.ckdzkj.com/images/propertyImgs/house.png',
|
icon:'https://wuye.ckdzkj.com/images/propertyImgs/house.png',
|
||||||
title: "我的房屋"
|
title: "我的房屋"
|
||||||
|
|||||||
Reference in New Issue
Block a user