feat(material-list): 重构资料列表页使用 NutTabs 替换 FilterTabs
- 移除 FilterTabs 组件依赖,改用 nut-tabs 实现自定义标签栏 - 新增测试页面 pages/test-tabs 用于验证自定义 Tabs 样式 - 调整全局样式,为 page 选择器添加 CSS 变量定义 - 更新组件类型声明,移除 NutSearchbar,添加 NutConfigProvider - 在开发环境中注册测试页面路由
Showing
8 changed files
with
225 additions
and
4 deletions
| ... | @@ -16,19 +16,19 @@ declare module 'vue' { | ... | @@ -16,19 +16,19 @@ declare module 'vue' { |
| 16 | NavHeader: typeof import('./src/components/NavHeader.vue')['default'] | 16 | NavHeader: typeof import('./src/components/NavHeader.vue')['default'] |
| 17 | NutAvatar: typeof import('@nutui/nutui-taro')['Avatar'] | 17 | NutAvatar: typeof import('@nutui/nutui-taro')['Avatar'] |
| 18 | NutButton: typeof import('@nutui/nutui-taro')['Button'] | 18 | NutButton: typeof import('@nutui/nutui-taro')['Button'] |
| 19 | + NutConfigProvider: typeof import('@nutui/nutui-taro')['ConfigProvider'] | ||
| 19 | NutInput: typeof import('@nutui/nutui-taro')['Input'] | 20 | NutInput: typeof import('@nutui/nutui-taro')['Input'] |
| 20 | NutPicker: typeof import('@nutui/nutui-taro')['Picker'] | 21 | NutPicker: typeof import('@nutui/nutui-taro')['Picker'] |
| 21 | NutPopup: typeof import('@nutui/nutui-taro')['Popup'] | 22 | NutPopup: typeof import('@nutui/nutui-taro')['Popup'] |
| 22 | NutRadio: typeof import('@nutui/nutui-taro')['Radio'] | 23 | NutRadio: typeof import('@nutui/nutui-taro')['Radio'] |
| 23 | NutRadioGroup: typeof import('@nutui/nutui-taro')['RadioGroup'] | 24 | NutRadioGroup: typeof import('@nutui/nutui-taro')['RadioGroup'] |
| 24 | - NutSearchbar: typeof import('@nutui/nutui-taro')['Searchbar'] | ||
| 25 | NutTabPane: typeof import('@nutui/nutui-taro')['TabPane'] | 25 | NutTabPane: typeof import('@nutui/nutui-taro')['TabPane'] |
| 26 | NutTabs: typeof import('@nutui/nutui-taro')['Tabs'] | 26 | NutTabs: typeof import('@nutui/nutui-taro')['Tabs'] |
| 27 | NutUploader: typeof import('@nutui/nutui-taro')['Uploader'] | 27 | NutUploader: typeof import('@nutui/nutui-taro')['Uploader'] |
| 28 | OfficeViewer: typeof import('./src/components/OfficeViewer.vue')['default'] | 28 | OfficeViewer: typeof import('./src/components/OfficeViewer.vue')['default'] |
| 29 | PdfPreview: typeof import('./src/components/PdfPreview.vue')['default'] | 29 | PdfPreview: typeof import('./src/components/PdfPreview.vue')['default'] |
| 30 | Picker: typeof import('./src/components/time-picker-data/picker.vue')['default'] | 30 | Picker: typeof import('./src/components/time-picker-data/picker.vue')['default'] |
| 31 | - PlanPopup: typeof import('./src/components/PlanPopup/index.vue')['default'] | 31 | + PlanPopup: typeof import('./src/components/PlanSchemes/PlanPopup.vue')['default'] |
| 32 | PosterBuilder: typeof import('./src/components/PosterBuilder/index.vue')['default'] | 32 | PosterBuilder: typeof import('./src/components/PosterBuilder/index.vue')['default'] |
| 33 | QrCode: typeof import('./src/components/qrCode.vue')['default'] | 33 | QrCode: typeof import('./src/components/qrCode.vue')['default'] |
| 34 | QrCodeSearch: typeof import('./src/components/qrCodeSearch.vue')['default'] | 34 | QrCodeSearch: typeof import('./src/components/qrCodeSearch.vue')['default'] | ... | ... |
| 1 | +## [2026-01-31] - 资料列表页重构与 FilterTabs 移除 | ||
| 2 | + | ||
| 3 | +### 重构 | ||
| 4 | +- 改造资料列表页 (`src/pages/material-list/index.vue`) 参考 `test-tabs` 实现 | ||
| 5 | + - 移除 `FilterTabs` 组件依赖,改用 `nut-tabs` 自定义头部实现 | ||
| 6 | + - 重构数据结构,从扁平列表调整为基于 Tab 的数据分布 (`tabsData`) | ||
| 7 | + - 实现 `initTabsData` 函数进行数据初始化分配 | ||
| 8 | + - 添加 `displayTabsData` 计算属性支持跨 Tab 搜索过滤 | ||
| 9 | + - 增加深度样式覆盖 (`:deep`) 适配 NutUI Tabs 样式 | ||
| 10 | + - 添加空状态展示逻辑 | ||
| 11 | + | ||
| 12 | +--- | ||
| 13 | + | ||
| 14 | +**详细信息**: | ||
| 15 | +- **影响文件**: src/pages/material-list/index.vue | ||
| 16 | +- **技术栈**: Vue 3, NutUI, Composition API | ||
| 17 | +- **测试状态**: 已通过代码审查 | ||
| 18 | +- **备注**: | ||
| 19 | + - 保持了原有的过滤逻辑(取余分配) | ||
| 20 | + - 提升了代码的自包含性,减少了对外部组件的依赖 | ||
| 21 | + | ||
| 22 | +--- | ||
| 23 | + | ||
| 1 | ## [2026-01-31] - 优化知识库页面滚动结构 | 24 | ## [2026-01-31] - 优化知识库页面滚动结构 |
| 2 | 25 | ||
| 3 | ### 优化 | 26 | ### 优化 | ... | ... |
| ... | @@ -29,6 +29,7 @@ const pages = [ | ... | @@ -29,6 +29,7 @@ const pages = [ |
| 29 | ] | 29 | ] |
| 30 | 30 | ||
| 31 | if (process.env.NODE_ENV === 'development') { | 31 | if (process.env.NODE_ENV === 'development') { |
| 32 | + pages.push('pages/test-tabs/index') | ||
| 32 | // pages.push('pages/nfcTest/index') | 33 | // pages.push('pages/nfcTest/index') |
| 33 | // pages.push('pages/tailwindTest/index') | 34 | // pages.push('pages/tailwindTest/index') |
| 34 | } | 35 | } | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Date: 2025-06-28 10:33:00 | 2 | * @Date: 2025-06-28 10:33:00 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2026-01-29 18:29:57 | 4 | + * @LastEditTime: 2026-01-31 19:52:31 |
| 5 | * @FilePath: /manulife-weapp/src/app.js | 5 | * @FilePath: /manulife-weapp/src/app.js |
| 6 | * @Description: 应用入口文件 | 6 | * @Description: 应用入口文件 |
| 7 | */ | 7 | */ | ... | ... |
| ... | @@ -10,6 +10,8 @@ | ... | @@ -10,6 +10,8 @@ |
| 10 | @tailwind components; | 10 | @tailwind components; |
| 11 | @tailwind utilities; | 11 | @tailwind utilities; |
| 12 | 12 | ||
| 13 | -:root { | 13 | +:root, |
| 14 | +page { | ||
| 14 | --nut-primary-color: #007AFF; | 15 | --nut-primary-color: #007AFF; |
| 16 | + --nut-tabs-horizontal-titles-height: 120rpx; | ||
| 15 | } | 17 | } | ... | ... |
This diff is collapsed. Click to expand it.
src/pages/test-tabs/index.config.js
0 → 100644
src/pages/test-tabs/index.vue
0 → 100644
| 1 | +<!-- | ||
| 2 | + NutUI Tabs 自定义标签栏测试页面 | ||
| 3 | + | ||
| 4 | + @description 测试 NutUI Tabs 组件的自定义标签栏功能 | ||
| 5 | + @page pages/test-tabs | ||
| 6 | + @created 2026-01-31 | ||
| 7 | +--> | ||
| 8 | +<template> | ||
| 9 | + <view class="test-tabs-page"> | ||
| 10 | + <view class="tabs-container"> | ||
| 11 | + <nut-tabs v-model="activeTab"> | ||
| 12 | + <!-- 自定义标签栏 - 参考 FilterTabs 样式 --> | ||
| 13 | + <template #titles> | ||
| 14 | + <view class="filter-tabs-wrapper"> | ||
| 15 | + <view | ||
| 16 | + v-for="item in tabList" | ||
| 17 | + :key="item.paneKey" | ||
| 18 | + :class="[ | ||
| 19 | + 'filter-tab-item', | ||
| 20 | + activeTab === item.paneKey ? 'filter-tab-active' : 'filter-tab-inactive' | ||
| 21 | + ]" | ||
| 22 | + @tap="handleTabClick(item.paneKey)" | ||
| 23 | + > | ||
| 24 | + <text class="filter-tab-text">{{ item.title }}</text> | ||
| 25 | + </view> | ||
| 26 | + </view> | ||
| 27 | + </template> | ||
| 28 | + | ||
| 29 | + <!-- Tab 内容 --> | ||
| 30 | + <nut-tab-pane v-for="item in tabList" :key="item.paneKey" :pane-key="item.paneKey"> | ||
| 31 | + <view class="tab-content"> | ||
| 32 | + <text class="content-text">{{ item.content }}</text> | ||
| 33 | + <view class="content-list"> | ||
| 34 | + <view v-for="i in 3" :key="i" class="list-item"> | ||
| 35 | + <text>{{ item.title }} - 列表项 {{ i }}</text> | ||
| 36 | + </view> | ||
| 37 | + </view> | ||
| 38 | + </view> | ||
| 39 | + </nut-tab-pane> | ||
| 40 | + </nut-tabs> | ||
| 41 | + </view> | ||
| 42 | + </view> | ||
| 43 | +</template> | ||
| 44 | + | ||
| 45 | +<script setup> | ||
| 46 | +import { ref } from 'vue' | ||
| 47 | + | ||
| 48 | +// 当前激活的 Tab | ||
| 49 | +const activeTab = ref('c1') | ||
| 50 | + | ||
| 51 | +// Tab 列表数据 | ||
| 52 | +const tabList = ref([ | ||
| 53 | + { | ||
| 54 | + title: 'Tab 1', | ||
| 55 | + paneKey: 'c1', | ||
| 56 | + content: '这是 Tab 1 的内容区域' | ||
| 57 | + }, | ||
| 58 | + { | ||
| 59 | + title: 'Tab 2', | ||
| 60 | + paneKey: 'c2', | ||
| 61 | + content: '这是 Tab 2 的内容区域' | ||
| 62 | + }, | ||
| 63 | + { | ||
| 64 | + title: 'Tab 3', | ||
| 65 | + paneKey: 'c3', | ||
| 66 | + content: '这是 Tab 3 的内容区域' | ||
| 67 | + }, | ||
| 68 | + { | ||
| 69 | + title: 'Tab 4', | ||
| 70 | + paneKey: 'c4', | ||
| 71 | + content: '这是 Tab 4 的内容区域' | ||
| 72 | + }, | ||
| 73 | + { | ||
| 74 | + title: 'Tab 5', | ||
| 75 | + paneKey: 'c5', | ||
| 76 | + content: '这是 Tab 5 的内容区域' | ||
| 77 | + }, | ||
| 78 | + { | ||
| 79 | + title: 'Tab 6', | ||
| 80 | + paneKey: 'c6', | ||
| 81 | + content: '这是 Tab 6 的内容区域' | ||
| 82 | + } | ||
| 83 | +]) | ||
| 84 | + | ||
| 85 | +/** | ||
| 86 | + * 处理 Tab 点击事件 | ||
| 87 | + * @param {string} paneKey - Tab 的 paneKey | ||
| 88 | + */ | ||
| 89 | +const handleTabClick = (paneKey) => { | ||
| 90 | + activeTab.value = paneKey | ||
| 91 | +} | ||
| 92 | +</script> | ||
| 93 | + | ||
| 94 | +<style lang="less"> | ||
| 95 | +.test-tabs-page { | ||
| 96 | + min-height: 100vh; | ||
| 97 | + background-color: #f5f5f5; | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +.page-header { | ||
| 101 | + padding: 40px 30px; | ||
| 102 | + background-color: #fff; | ||
| 103 | + border-bottom: 1px solid #eee; | ||
| 104 | +} | ||
| 105 | + | ||
| 106 | +.page-title { | ||
| 107 | + font-size: 32px; | ||
| 108 | + font-weight: bold; | ||
| 109 | + color: #333; | ||
| 110 | +} | ||
| 111 | + | ||
| 112 | +.tabs-container { | ||
| 113 | + background-color: #fff; | ||
| 114 | + margin-top: 20px; | ||
| 115 | +} | ||
| 116 | + | ||
| 117 | +// FilterTabs 风格的标签栏 | ||
| 118 | +.filter-tabs-wrapper { | ||
| 119 | + display: flex; | ||
| 120 | + overflow-x: auto; | ||
| 121 | + padding: 24px 30px; | ||
| 122 | + gap: 24rpx; | ||
| 123 | + transition: all 0.3s ease; | ||
| 124 | + | ||
| 125 | + // 隐藏滚动条 | ||
| 126 | + &::-webkit-scrollbar { | ||
| 127 | + display: none; | ||
| 128 | + width: 0; | ||
| 129 | + height: 0; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + -ms-overflow-style: none; | ||
| 133 | + scrollbar-width: none; | ||
| 134 | +} | ||
| 135 | + | ||
| 136 | +.filter-tab-item { | ||
| 137 | + display: flex; | ||
| 138 | + align-items: center; | ||
| 139 | + justify-content: center; | ||
| 140 | + padding: 16rpx 32rpx; | ||
| 141 | + border-radius: 9999rpx; | ||
| 142 | + white-space: nowrap; | ||
| 143 | + transition: all 0.3s ease; | ||
| 144 | + flex-shrink: 0; | ||
| 145 | +} | ||
| 146 | + | ||
| 147 | +.filter-tab-active { | ||
| 148 | + background-color: #2563EB; // 蓝色背景 | ||
| 149 | + color: #fff; | ||
| 150 | +} | ||
| 151 | + | ||
| 152 | +.filter-tab-inactive { | ||
| 153 | + background-color: #F3F4F6; // 灰色背景 | ||
| 154 | + color: #6B7280; | ||
| 155 | +} | ||
| 156 | + | ||
| 157 | +.filter-tab-text { | ||
| 158 | + font-size: 28rpx; | ||
| 159 | + font-weight: 500; | ||
| 160 | +} | ||
| 161 | + | ||
| 162 | +// Tab 内容区域 | ||
| 163 | +.tab-content { | ||
| 164 | + padding: 30px; | ||
| 165 | + min-height: 400px; | ||
| 166 | +} | ||
| 167 | + | ||
| 168 | +.content-text { | ||
| 169 | + font-size: 28px; | ||
| 170 | + color: #333; | ||
| 171 | + margin-bottom: 30px; | ||
| 172 | + display: block; | ||
| 173 | +} | ||
| 174 | + | ||
| 175 | +.content-list { | ||
| 176 | + margin-top: 30px; | ||
| 177 | +} | ||
| 178 | + | ||
| 179 | +.list-item { | ||
| 180 | + padding: 24px; | ||
| 181 | + background-color: #f9f9f9; | ||
| 182 | + border-radius: 12px; | ||
| 183 | + margin-bottom: 20px; | ||
| 184 | + font-size: 26px; | ||
| 185 | + color: #666; | ||
| 186 | +} | ||
| 187 | +</style> |
-
Please register or login to post a comment