From 6404c39ec5420bee7e831cb73065b8cc57604700 Mon Sep 17 00:00:00 2001 From: minimaxagent1 Date: Thu, 31 Jul 2025 15:06:10 +0800 Subject: [PATCH] =?UTF-8?q?institutional-item=E7=BB=84=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E6=8A=BD=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/README.md | 82 ++++++++++++++++ .../components/institutional-item.vue | 98 +++++++++++++++++++ .../institutionalStructure.vue | 79 +++++---------- 3 files changed, 203 insertions(+), 56 deletions(-) create mode 100644 pages/institutionalStructure/components/README.md create mode 100644 pages/institutionalStructure/components/institutional-item.vue diff --git a/pages/institutionalStructure/components/README.md b/pages/institutionalStructure/components/README.md new file mode 100644 index 0000000..512e29a --- /dev/null +++ b/pages/institutionalStructure/components/README.md @@ -0,0 +1,82 @@ +# InstitutionalItem 建制数据项组件 + +一个用于展示建制数据的可复用组件。 + +## 功能特性 + +- 展示建制项目的详细信息 +- 支持查看详细功能 +- 响应式布局 +- 统一的样式风格 + +## 使用方法 + +### 基础用法 + +```vue + + + +``` + +## Props + +| 参数 | 类型 | 默认值 | 说明 | +|------|------|--------|------| +| item | Object | {} | 数据项对象 | +| index | Number | 0 | 数据索引 | + +### item 对象结构 + +```javascript +{ + topLeft: '2023年 项目名称', // 左上角显示内容 + topRight: '进行中', // 右上角显示内容 + bottomLeft: '建造金额:100万', // 左下角显示内容 + bottomRight: '捐赠人数:50人' // 右下角显示内容 +} +``` + +## Events + +| 事件名 | 参数 | 说明 | +|--------|------|------| +| view-detail | { item, index } | 点击查看详细时触发 | + +## 样式说明 + +- 组件使用统一的建制风格 +- 背景色:`#FFFBF5` +- 边框:`1px solid #C7A26D` +- 圆角:`11px` +- 高度:`180rpx` + +## 注意事项 + +1. 组件会自动处理空值,显示"暂无数据" +2. 点击"查看详细"会触发 `view-detail` 事件 +3. 样式与建制页面保持一致 \ No newline at end of file diff --git a/pages/institutionalStructure/components/institutional-item.vue b/pages/institutionalStructure/components/institutional-item.vue new file mode 100644 index 0000000..56e150e --- /dev/null +++ b/pages/institutionalStructure/components/institutional-item.vue @@ -0,0 +1,98 @@ + + + + + \ No newline at end of file diff --git a/pages/institutionalStructure/institutionalStructure.vue b/pages/institutionalStructure/institutionalStructure.vue index 4a19881..4c740b2 100644 --- a/pages/institutionalStructure/institutionalStructure.vue +++ b/pages/institutionalStructure/institutionalStructure.vue @@ -12,22 +12,14 @@ 暂无数据 - - - {{ item.topLeft || '暂无数据' }} - {{ item.topRight || '暂无数据' }} - - - - {{ item.bottomLeft || '暂无数据' }} - {{ item.bottomRight || '暂无数据' }} - - - 查看详细 - - - - + @@ -38,12 +30,14 @@ import { tilesImageEnum } from '@/enum/institutionalStructure.js'; import { getInstitutionalList } from '@/api/institutionalStructure.js'; import CustomNavbar from "../../components/custom-navbar/custom-navbar.vue"; import TileGrid from "../../components/tile-grid/tile-grid.vue"; +import InstitutionalItem from "./components/institutional-item.vue"; import CommonEnum from "../../enum/common"; export default { components: { CustomNavbar, - TileGrid + TileGrid, + InstitutionalItem }, data() { return { @@ -153,6 +147,16 @@ export default { // 刷新数据 refreshData() { this.getInstitutionalData() + }, + + // 处理查看详细 + handleViewDetail(data) { + console.log('查看详细:', data.item) + // 这里可以添加跳转到详情页面的逻辑 + uni.showToast({ + title: '查看详细功能开发中', + icon: 'none' + }) } } } @@ -169,48 +173,11 @@ page { align-items: flex-start; flex-direction: column; background-color: #FFFBF5; - padding: 0 11rpx; + padding: 0 15rpx; padding-bottom: 40rpx; } -.data{ - background-color: #FFFBF5; - display: flex; - flex-direction: column; - justify-content: space-between; - align-items: center; - width: 100%; - box-sizing: border-box; - height: 180rpx; - border-radius: 11px; - border: 1px solid #C7A26D; - margin: 8rpx 0; -} -.row{ - flex: 1; - width: 100%; - display: flex; - justify-content: space-between; - align-items: center; - padding: 0 20rpx; -} -.subRow{ - display: flex; -} -.subRow view{ - padding-right: 20px; - font-size: 16px; -} -.topLeft{ - font-size: 21px; - font-weight: 1000; - color: #522510; -} -.bottomRight{ - font-size: 16px; - font-weight: 1000; - color: #522510; -} + .loading, .empty { display: flex; justify-content: center;