From 2450169eacbe101fadeaa95bc8dc8dec6c84de10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Wed, 8 Oct 2025 12:25:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(community):=E4=BC=98=E5=8C=96=E5=B0=8F?= =?UTF-8?q?=E5=8C=BA=E5=88=97=E8=A1=A8=E5=B1=95=E7=A4=BA=E4=B8=8E=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E8=B7=B3=E8=BD=AC=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 接口请求增加费用项和人口信息参数 - 列表页面添加表头和数据展示样式- 支持点击列表项跳转至详情页 - 增加异常处理和错误提示 - 页面名称从 articleList 更改为 CommunityIndex- 添加详情页面路由配置 --- api/common.js | 2 +- pages.json | 7 ++++ pages/community/index.vue | 77 +++++++++++++++++++++++++++++++-------- 3 files changed, 70 insertions(+), 16 deletions(-) diff --git a/api/common.js b/api/common.js index d775b09..58a23a7 100644 --- a/api/common.js +++ b/api/common.js @@ -10,7 +10,7 @@ export const indexListReq = data => post('/com/publish-list/list', data) export const swiperListReq = () => get('/sys/sys-swiper') -export const communityListReq = () => get('/zhsq/zhsq-base-village') +export const communityListReq = () => get('/zhsq/zhsq-base-village?withFeeItem=true&withPopulation=true') export const roomListReq = params => get('/zhsq/zhsq-base-room', {params}) diff --git a/pages.json b/pages.json index 6927c69..b3aa5ae 100644 --- a/pages.json +++ b/pages.json @@ -99,6 +99,13 @@ { "navigationBarTitleText" : "小区概览" } + }, + { + "path" : "pages/community/detail", + "style" : + { + "navigationBarTitleText" : "详情" + } } ], "subPackages": [ diff --git a/pages/community/index.vue b/pages/community/index.vue index fcd5827..7c71bf3 100644 --- a/pages/community/index.vue +++ b/pages/community/index.vue @@ -2,18 +2,27 @@ - + @@ -23,22 +32,60 @@ import CustomTabbar from "@/components/customTabbar.vue"; import {communityListReq} from "@/api/common"; export default { - name: "articleList", + name: "CommunityIndex", components: {CustomTabbar}, data() { return { - cateId: null, list: [] } }, methods: { async getList() { - const {data} = await communityListReq() - this.list = data + try { + const {data} = await communityListReq() + this.list = data + } catch (error) { + console.error('获取小区列表失败:', error) + uni.showToast({ + title: '获取数据失败', + icon: 'none' + }) + } + }, + goToDetail(item) { + // 跳转到详情页,传递小区ID + uni.navigateTo({ + url: `/pages/community/detail?id=${item.id}` + }) } }, - onLoad({id}) { + onLoad() { this.getList() } } - \ No newline at end of file + + + \ No newline at end of file