From e1c286058c7bc377856a04d52830d95f910df99c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AF=85?= <1335909236@qq.com> Date: Wed, 10 Sep 2025 16:33:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=20-=20=E6=B9=96=E7=95=94?= =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/community.js | 82 ++++++++++---------- packages/community/index/index.vue | 115 +++++++++++++++++------------ packages/community/list/index.vue | 10 ++- 3 files changed, 117 insertions(+), 90 deletions(-) diff --git a/api/community.js b/api/community.js index e79d3142..054cd2b4 100644 --- a/api/community.js +++ b/api/community.js @@ -1,53 +1,55 @@ export const apiArr = { - isShowSearch: '/api/v1/wechat/home-page/search-enable/info', // 获取搜索框是否显示 - hotWord: '/api/v1/wechat/home-page/search-hot-word/info', // 获取搜索框热词 - list: '/api/v1/wechat/community/list', // 获取社区列表 - info: '/api/v1/wechat/community/info', // 获取单个社区信息 - isJoin: '/api/v1/wechat/community/is-join', // 用户是否加入社区、楼宇、房间 - tipsList: '/api/v1/wechat/community/tips/list', // 获取全部通知列表 - oneTips: '/api/v1/wechat/community/tips/one', // 获取单个社区通知 - apply: '/api/v1/wechat/community/apply', // 申请加入小区 - getFacilityList: '/api/v1/wechat/community/facility/list', //获取楼号, - getRoomList: '/api/v1/wechat/community/room/list', //获取房间号 - ownerList: '/api/v1/wechat/community/owner/list', // 获取社区业主列表 + isShowSearch: "/api/v1/wechat/home-page/search-enable/info", // 获取搜索框是否显示 + hotWord: "/api/v1/wechat/home-page/search-hot-word/info", // 获取搜索框热词 + list: "/api/v1/wechat/community/list", // 获取社区列表 + info: "/api/v1/wechat/community/info", // 获取单个社区信息 + isJoin: "/api/v1/wechat/community/is-join", // 用户是否加入社区、楼宇、房间 + tipsList: "/api/v1/wechat/community/tips/list", // 获取全部通知列表 + oneTips: "/api/v1/wechat/community/tips/one", // 获取单个社区通知 + apply: "/api/v1/wechat/community/apply", // 申请加入小区 + getFacilityList: "/api/v1/wechat/community/facility/list", //获取楼号, + getRoomList: "/api/v1/wechat/community/room/list", //获取房间号 + ownerList: "/api/v1/wechat/community/owner/list", // 获取社区业主列表 - submit: "/api/v1/wechat/community/owner/feedback-create", //报修提交 - getListByRepair: "/api/v1/wechat/community/owner/feedback-list",//报事报修列表 - getInfoById: "/api/v1/wechat/community/owner/feedback-info", //报事报修根据id查询详情 + submit: "/api/v1/wechat/community/owner/feedback-create", //报修提交 + getListByRepair: "/api/v1/wechat/community/owner/feedback-list", //报事报修列表 + getInfoById: "/api/v1/wechat/community/owner/feedback-info", //报事报修根据id查询详情 - getUserCommunity: "/api/v1/wechat/community/owner/mylist",//获取用户社区信息 + getUserCommunity: "/api/v1/wechat/community/owner/mylist", //获取用户社区信息 - get_host_info: 'https://zhsq.hshuishang.com/Miniapi/Index/get_host_info', + get_host_info: "https://zhsq.hshuishang.com/Miniapi/Index/get_host_info", - get_community_area_list: "https://zhsq.hshuishang.com/Miniapi/Community/get_community_area_list", + get_community_area_list: + "https://zhsq.hshuishang.com/Miniapi/Community/get_community_area_list", + carList: "/api/v1/wechat/community/car/list", // 获取社区列表 + addCar: "/api/v1/wechat/community/car/add", // 添加车辆 + getCarList: "/api/v1/wechat/community/car/list", //获取车辆列表 + deleteItem: "/api/v1/wechat/community/car/del", //删除车牌 - carList: '/api/v1/wechat/community/car/list', // 获取社区列表 - addCar: '/api/v1/wechat/community/car/add', // 添加车辆 - getCarList: '/api/v1/wechat/community/car/list', //获取车辆列表 - deleteItem: "/api/v1/wechat/community/car/del",//删除车牌 + getBanner: "/api/v1/wechat/home-page/banner-list", //获取banner图 + getButton: "/api/v1/wechat/home-page/button-list", //获取button + getHotWords: "/api/v1/wechat/home-page/search-hot-word/info", //搜索热词 - getBanner: "/api/v1/wechat/home-page/banner-list",//获取banner图 - getButton: "/api/v1/wechat/home-page/button-list",//获取button - getHotWords: "/api/v1/wechat/home-page/search-hot-word/info",//搜索热词 + getAllList: "/api/v2/wechat/community/get-all-list", //获取小区信息列表 + commRoomSelect: "/api/v2/wechat/community-room/comm-room-select", //房源筛选器 + commInfo: "/api/v2/wechat/mpuser-crud/community-owner/info", //我的房产信息小区列表 + create: "/api/v2/wechat/community-owners/create", //创建新的业主信息 - getAllList: "/api/v2/wechat/community/get-all-list",//获取小区信息列表 - commRoomSelect: "/api/v2/wechat/community-room/comm-room-select",//房源筛选器 + communityInfo: "/api/v2/community/get-one", //获取小区信息 - commInfo: "/api/v2/wechat/mpuser-crud/community-owner/info",//我的房产信息小区列表 - create: "/api/v2/wechat/community-owners/create",//创建新的业主信息 + workCommunityList: "/api/v2/wechat/community-worker/work-comm-list", //员工小区列表 - communityInfo: "/api/v2/community/get-one",//获取小区信息 + getOrderList: "/api/v2/wechat/community-orders/get-all-list", //获取账单 + getCommunityRoomList: "/api/v2/wechat/community-room/list", //获取房源列表 + getUserGovenmentMoney: + "/api/v2/wechat/government-housing-fund-flow-crud/user", //获取用户公积金 + createPayOrder: "/api/v2/wechat/community-order-pay/create", //创建缴费 + getPayOrderInfo: "/api/v2/wechat/community-order-pay/get-one", //根据缴费信息获取支付信息 + getPayOrderList: "/api/v2/wechat/community-order-pay/get-page", //查询缴费记录 + OrderPay: "/api/v2/wechat/community-order-pay/preorder", //预下单 + tradeQuery: "/api/v2/wechat/community-order-pay/trade-query", //缴费查单 - workCommunityList: "/api/v2/wechat/community-worker/work-comm-list",//员工小区列表 - - getOrderList:"/api/v2/wechat/community-orders/get-all-list",//获取账单 - getCommunityRoomList:"/api/v2/wechat/community-room/list", //获取房源列表 - getUserGovenmentMoney:"/api/v2/wechat/government-housing-fund-flow-crud/user", //获取用户公积金 - createPayOrder:"/api/v2/wechat/community-order-pay/create", //创建缴费 - getPayOrderInfo:"/api/v2/wechat/community-order-pay/get-one", //根据缴费信息获取支付信息 - getPayOrderList:"/api/v2/wechat/community-order-pay/get-page", //查询缴费记录 - OrderPay:"/api/v2/wechat/community-order-pay/preorder",//预下单 - tradeQuery:"/api/v2/wechat/community-order-pay/trade-query",//缴费查单 -}; \ No newline at end of file + checkComm: "/api/v2/wechat/community/check-comm", //检查小区是否属于当前用户 +}; diff --git a/packages/community/index/index.vue b/packages/community/index/index.vue index 498e9290..48a186de 100644 --- a/packages/community/index/index.vue +++ b/packages/community/index/index.vue @@ -96,7 +96,7 @@ - + {{ item.title }} @@ -245,10 +245,23 @@ export default { }; }, async onLoad(options) { - // 页面加载时执行一次 + if (options.item) { + this.checkComm(JSON.parse(options.item)); + } + }, + + onHide() { + uni.removeStorageSync("is_me"); + }, + onUnload() { + uni.removeStorageSync("is_me"); }, async onShow() { + const meun = menuButtonInfo(); + this.top = meun.top; + // this.top = meun.height + meun.top; + this.localHeight = meun.height; this.defaultFunctionList = [ { create_time: "", @@ -294,52 +307,10 @@ export default { } ] - // 页面展示时执行 - // if (!uni.getStorageSync("changeCommData")) { - // return; - // } - await request(apiArr2.commInfo, "POST", { - user_id: uni.getStorageSync("userId"), - longitude: uni.getStorageSync("location").lng, - latitude: uni.getStorageSync("location").lat, - page_num: this.page_num, - page_size: this.page_size, - }).then((res) => { - if (res.rows.length == 0) { - 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; - }); - if (!uni.getStorageSync("changeCommData")) { - uni.setStorageSync("changeCommData", { name: res.rows[0].name, id: res.rows[0].community_id }) - } - this.communityList = res.rows; - }); - const meun = menuButtonInfo(); - this.top = meun.top; - // this.top = meun.height + meun.top; - this.localHeight = meun.height; - // this.getCommunityList() - if (this.communityList.length == 0) { - this.communityVal = "添加我的房产"; - } else { - this.communityVal = uni.getStorageSync("changeCommData").name; + const isMe = uni.getStorageSync("is_me"); + // 当is_me不存在或为true时执行,存在且为false时不执行 + if (isMe === true || isMe === undefined || isMe === null || isMe === '') { + this.getCommunityList(); } this.getfunctionNum(); this.getAdvertising(); @@ -379,6 +350,54 @@ export default { // desc() { // NavgateTo("../communityDetail/index") // }, + checkComm(item) { + if (uni.getStorageSync("is_me")) { + uni.setStorageSync("changeCommData", { name: item.name, id: item.community_id }) + } else { + this.communityList = [] + this.communityVal = item.name; + } + }, + async getCommunityList() { + await request(apiArr2.commInfo, "POST", { + user_id: uni.getStorageSync("userId"), + longitude: uni.getStorageSync("location").lng, + latitude: uni.getStorageSync("location").lat, + page_num: this.page_num, + page_size: this.page_size, + }).then((res) => { + if (res.rows.length == 0) { + 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; + }); + if (!uni.getStorageSync("changeCommData")) { + uni.setStorageSync("changeCommData", { name: res.rows[0].name, id: res.rows[0].community_id }) + } + this.communityList = res.rows; + }); + if (this.communityList.length == 0) { + this.communityVal = "添加我的房产"; + } else { + this.communityVal = uni.getStorageSync("changeCommData").name; + } + }, apply() { NavgateTo("../applyOwer/index"); }, diff --git a/packages/community/list/index.vue b/packages/community/list/index.vue index 15933b7d..1963c7d1 100644 --- a/packages/community/list/index.vue +++ b/packages/community/list/index.vue @@ -161,7 +161,7 @@ export default { // 确保经纬度是有效的数字 const latitude = parseFloat(item.lat); const longitude = parseFloat(item.lng); - + if (!isNaN(latitude) && !isNaN(longitude)) { uni.openLocation({ latitude: latitude, @@ -210,7 +210,13 @@ export default { } }, enterCommunity(item) { - NavgateTo("/packages/community/index/index?item=" + encodeURIComponent(JSON.stringify(item))); + request(apiArr.checkComm, "POST", { + community_id: item.community_id, + user_id: uni.getStorageSync("userId"), + }).then((res) => { + uni.setStorageSync("is_me", res.is_me) + NavgateTo("/packages/community/index/index?item=" + JSON.stringify(item)); + }) }, // 下拉加载更多 loadMore() {