修改我的小区展示数据的逻辑

This commit is contained in:
赵毅 2025-08-06 15:18:27 +08:00
parent 7fdf8f342f
commit 3e884f1b1a

View File

@ -209,12 +209,14 @@ export default {
loadMoreText: "", loadMoreText: "",
isShowBill: false, isShowBill: false,
houseVal: "",
}; };
}, },
async onLoad(options) { async onLoad(options) {
if(!uni.getStorageSync("changeCommData")){ // if (!uni.getStorageSync("changeCommData")) {
return // return;
} // }
await request(apiArr2.commInfo, "POST", { await request(apiArr2.commInfo, "POST", {
user_id: uni.getStorageSync("userId"), user_id: uni.getStorageSync("userId"),
longitude: uni.getStorageSync("location").lng, longitude: uni.getStorageSync("location").lng,
@ -222,14 +224,30 @@ export default {
page_num: this.page_num, page_num: this.page_num,
page_size: this.page_size, page_size: this.page_size,
}).then((res) => { }).then((res) => {
res.rows.find((item) => {
if (item.community_id == uni.getStorageSync("changeCommData").id) {
this.isShowBill = item.bill_front_end_display == 1 ? true : false;
}
});
if (res.rows.length == 0) { if (res.rows.length == 0) {
uni.removeStorageSync("changeCommData"); uni.removeStorageSync("changeCommData");
return;
} }
const targetItem = res.rows.find((item) => {
return item.community_id == uni.getStorageSync("changeCommData").id;
});
if (targetItem) {
//
this.isShowBill = targetItem.bill_front_end_display == 1;
//
if (targetItem.front_end_display == 1) {
uni.removeStorageSync("changeCommData");
}
}
res.rows = res.rows.filter((item) => {
return item.front_end_display != 1;
});
console.log("🚀 ~ onLoad ~ res.rows:", res.rows)
uni.setStorageSync("changeCommData",{ name: res.rows[0].name, id: res.rows[0].community_id })
this.communityList = res.rows; this.communityList = res.rows;
}); });
const meun = menuButtonInfo(); const meun = menuButtonInfo();
@ -332,7 +350,7 @@ export default {
async getfunctionList() { async getfunctionList() {
if (!uni.getStorageSync("changeCommData")) { if (!uni.getStorageSync("changeCommData")) {
return return;
} }
const res = await request(apiArr.navPage, "POST", { const res = await request(apiArr.navPage, "POST", {
community_id: Number(uni.getStorageSync("changeCommData").id), community_id: Number(uni.getStorageSync("changeCommData").id),
@ -356,7 +374,7 @@ export default {
async getAdvertising() { async getAdvertising() {
if (!uni.getStorageSync("changeCommData")) { if (!uni.getStorageSync("changeCommData")) {
return return;
} }
const res = await request(apiArr.advPage, "POST", { const res = await request(apiArr.advPage, "POST", {
community_id: Number(uni.getStorageSync("changeCommData").id), community_id: Number(uni.getStorageSync("changeCommData").id),
@ -516,7 +534,7 @@ export default {
async getCategoryList() { async getCategoryList() {
if (!uni.getStorageSync("changeCommData")) { if (!uni.getStorageSync("changeCommData")) {
return return;
} }
const res = await request(apiArr.categoryPage, "POST", { const res = await request(apiArr.categoryPage, "POST", {
community_id: Number(uni.getStorageSync("changeCommData").id), community_id: Number(uni.getStorageSync("changeCommData").id),