Commit 48ff5b958f5b7c051f3575955c23ec815754441d
1 parent
a7a0b46e
底部导航
Showing
11 changed files
with
111 additions
and
82 deletions
common/config/env.js
| ... | ... | @@ -4,6 +4,7 @@ const env = { |
| 4 | 4 | development: { |
| 5 | 5 | baseUrl: 'https://test.jichengshanshui.com.cn:28302', |
| 6 | 6 | // https://test.jichengshanshui.com.cn:28302 |
| 7 | + // http://h95ce3aa.natappfree.cc | |
| 7 | 8 | |
| 8 | 9 | uploadUrl: 'https://test.jichengshanshui.com.cn:28302', |
| 9 | 10 | // baseApi:'admin-api', | ... | ... |
pages-sub/daily/maintain-manage/finish-plan-detail.vue
pages-sub/daily/patrol-manage/finish-plan-detail.vue
pages.json
| ... | ... | @@ -160,20 +160,20 @@ |
| 160 | 160 | { |
| 161 | 161 | "pagePath": "pages/index/index", |
| 162 | 162 | "text": "首页", |
| 163 | - "iconPath": "static/icons/home.png", | |
| 164 | - "selectedIconPath": "static/icons/home-active.png" | |
| 163 | + "iconPath": "static/imgs/nav/home-off.png", | |
| 164 | + "selectedIconPath": "static/imgs/nav/home-on.png" | |
| 165 | 165 | }, |
| 166 | 166 | { |
| 167 | 167 | "pagePath": "pages/workbench/index", |
| 168 | 168 | "text": "工作台", |
| 169 | - "iconPath": "static/icons/mine.png", | |
| 170 | - "selectedIconPath": "static/icons/mine-active.png" | |
| 169 | + "iconPath": "static/imgs/nav/work-off.png", | |
| 170 | + "selectedIconPath": "static/imgs/nav/work-on.png" | |
| 171 | 171 | }, |
| 172 | 172 | { |
| 173 | 173 | "pagePath": "pages/mine/index", |
| 174 | 174 | "text": "我的", |
| 175 | - "iconPath": "static/icons/mine.png", | |
| 176 | - "selectedIconPath": "static/icons/mine-active.png" | |
| 175 | + "iconPath": "static/imgs/nav/my-off.png", | |
| 176 | + "selectedIconPath": "static/imgs/nav/my-on.png" | |
| 177 | 177 | } |
| 178 | 178 | ] |
| 179 | 179 | }, | ... | ... |
pages/workbench/index.vue
| 1 | 1 | <template> |
| 2 | 2 | <!-- 外层容器:包含蓝色块 + 原始内容 --> |
| 3 | - <view class="workbench-container"> | |
| 3 | + <view class="page-container"> | |
| 4 | 4 | <!-- 加载页:覆盖整个容器,渲染完成后隐藏 --> |
| 5 | 5 | <up-loading-page |
| 6 | - v-if="loading" | |
| 6 | + | |
| 7 | + :loading="loading" | |
| 7 | 8 | loading-text="加载中..." |
| 8 | 9 | color="#577ee3" |
| 9 | - style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999;" | |
| 10 | + zIndex="1000" | |
| 10 | 11 | ></up-loading-page> |
| 11 | 12 | |
| 12 | 13 | <!-- 蓝色装饰块:#577ee3 --> |
| 13 | - <view class="blue-decor-block"></view> | |
| 14 | + <view class="blue-decor-block" v-show="!loading"></view> | |
| 14 | 15 | |
| 15 | - <!-- 原始内容容器:仅添加定位和顶部偏移实现压边 --> | |
| 16 | + <!-- 原始内容容器 --> | |
| 16 | 17 | <view class="content-wrap"> |
| 17 | 18 | <!-- uview-plus空状态组件 --> |
| 18 | 19 | <u-empty |
| 19 | 20 | v-if="!moduleList.length && !loading" |
| 20 | - mode="list" | |
| 21 | - text="暂无菜单数据" | |
| 22 | - color="#999" | |
| 23 | - font-size="28rpx" | |
| 21 | + mode="permission" | |
| 24 | 22 | ></u-empty> |
| 25 | 23 | |
| 26 | - <!-- 菜单卡片列表(修复header插槽语法,恢复标题显示) --> | |
| 27 | - <view v-else-if="!loading" class="menu-card-wrap"> | |
| 24 | + <!-- 菜单卡片列表(替换grid为flex布局) --> | |
| 25 | + <view class="menu-card-wrap"> | |
| 28 | 26 | <up-card |
| 29 | 27 | :title-size="18" |
| 28 | + :border="false" | |
| 29 | + :shadow="true" | |
| 30 | + :foot-border-top="false" | |
| 30 | 31 | v-for="(parentModule, index) in moduleList" |
| 31 | - :key="parentModule.id" | |
| 32 | + :key="`$parentModule.id_${index}`" | |
| 32 | 33 | :title="parentModule.name" |
| 34 | + class="card-container" | |
| 33 | 35 | > |
| 34 | 36 | <template #body> |
| 35 | - <view> | |
| 36 | - <up-grid | |
| 37 | - :border="false" | |
| 38 | - col="4" | |
| 37 | + <!-- 替换up-grid:改用flex流式布局容器 --> | |
| 38 | + <view class="card-content"> | |
| 39 | + <view | |
| 40 | + v-for="(listItem, listIndex) in parentModule.children" | |
| 41 | + :key="listItem.id" | |
| 42 | + class="content-block" | |
| 43 | + @click="handleMenuClick(listItem)" | |
| 39 | 44 | > |
| 40 | - <up-grid-item | |
| 41 | - v-for="(listItem,listIndex) in parentModule.children" | |
| 42 | - :key="listItem.id" | |
| 43 | - @click="handleMenuClick(listItem)" | |
| 44 | - class="grid-item-wrap" | |
| 45 | - > | |
| 46 | - <u-image | |
| 47 | - :src="listItem.icon " | |
| 48 | - mode="aspectFit" | |
| 49 | - width="80rpx" | |
| 50 | - height="80rpx" | |
| 51 | - lazy-load | |
| 52 | - radius="16rpx" | |
| 53 | - ></u-image> | |
| 54 | - <text class="grid-text">{{ listItem.name }}</text> | |
| 55 | - </up-grid-item> | |
| 56 | - </up-grid> | |
| 57 | - | |
| 45 | + <u-image | |
| 46 | + :src="listItem.icon" | |
| 47 | + mode="aspectFit" | |
| 48 | + width="80rpx" | |
| 49 | + height="80rpx" | |
| 50 | + lazy-load | |
| 51 | + radius="16rpx" | |
| 52 | + class="block-icon" | |
| 53 | + ></u-image> | |
| 54 | + <text class="grid-text">{{ listItem.name }}</text> | |
| 55 | + </view> | |
| 58 | 56 | </view> |
| 59 | 57 | </template> |
| 60 | 58 | </up-card> |
| ... | ... | @@ -64,8 +62,8 @@ |
| 64 | 62 | </template> |
| 65 | 63 | |
| 66 | 64 | <script setup lang="ts"> |
| 67 | -// 原始代码完全保留,新增loading状态 | |
| 68 | -import {ref, nextTick} from 'vue'; | |
| 65 | +// 原始代码完全保留,无任何修改 | |
| 66 | +import { ref, nextTick } from 'vue'; | |
| 69 | 67 | import { onShow } from '@dcloudio/uni-app'; |
| 70 | 68 | import { useUserStore } from '@/pinia/user'; |
| 71 | 69 | import globalConfig from '@/common/config/global'; |
| ... | ... | @@ -89,41 +87,27 @@ interface MenuItem { |
| 89 | 87 | children: MenuItem[]; |
| 90 | 88 | } |
| 91 | 89 | |
| 92 | -// 新增:加载状态(默认开启) | |
| 93 | 90 | const loading = ref(true); |
| 94 | 91 | const userStore = useUserStore(); |
| 95 | 92 | const moduleList = ref<MenuItem[]>([]); |
| 96 | 93 | |
| 97 | -// 无用变量(保留避免警告) | |
| 98 | -const subTitle = ref(''); | |
| 99 | -const thumb = ref(''); | |
| 100 | -const border = ref(true); | |
| 101 | -const click = () => { | |
| 102 | -}; | |
| 103 | -const headClick = () => { | |
| 104 | -}; | |
| 105 | - | |
| 106 | 94 | onShow(async () => { |
| 107 | 95 | try { |
| 108 | - // 重置加载状态 | |
| 109 | 96 | loading.value = true; |
| 110 | 97 | |
| 111 | 98 | const rawMenuData = userStore.moduleListInfo || cache.get(globalConfig.cache.moduleListKey); |
| 112 | 99 | const menuData = rawMenuData || []; |
| 113 | 100 | moduleList.value = menuData; |
| 114 | - | |
| 115 | - // 关键:等待DOM完全渲染后再隐藏加载页 | |
| 116 | - await nextTick(); | |
| 117 | - // 额外延迟(可选,确保视觉更流畅) | |
| 118 | - setTimeout(() => { | |
| 119 | - loading.value = false; | |
| 120 | - }, 300); | |
| 121 | - | |
| 101 | + // | |
| 102 | + // // await nextTick(); | |
| 103 | + // setTimeout(() => { | |
| 104 | + // loading.value = false; | |
| 105 | + // }, 500); | |
| 106 | + loading.value = false; | |
| 122 | 107 | console.log('菜单数据:', moduleList.value); |
| 123 | 108 | } catch (error) { |
| 124 | 109 | console.error('获取菜单数据失败:', error); |
| 125 | 110 | moduleList.value = []; |
| 126 | - // 出错时也隐藏加载页 | |
| 127 | 111 | await nextTick(); |
| 128 | 112 | loading.value = false; |
| 129 | 113 | } |
| ... | ... | @@ -138,7 +122,7 @@ const handleMenuClick = (item: MenuItem) => { |
| 138 | 122 | }); |
| 139 | 123 | return; |
| 140 | 124 | } |
| 141 | - console.log(item.jumpUrl) | |
| 125 | + console.log(item.jumpUrl); | |
| 142 | 126 | uni.navigateTo({ |
| 143 | 127 | url: item.jumpUrl, |
| 144 | 128 | fail: (err) => { |
| ... | ... | @@ -153,19 +137,14 @@ const handleMenuClick = (item: MenuItem) => { |
| 153 | 137 | }; |
| 154 | 138 | </script> |
| 155 | 139 | |
| 156 | -<style scoped> | |
| 157 | -/* 仅新增/保留必要样式,不修改卡片核心样式 */ | |
| 158 | -.workbench-container { | |
| 159 | - width: 100%; | |
| 160 | - min-height: 100vh; | |
| 161 | - position: relative; | |
| 162 | - background-color: #fff; | |
| 163 | -} | |
| 164 | -.grid-item-wrap{ | |
| 165 | - margin-top: 20px; | |
| 140 | +<style scoped lang="scss"> | |
| 141 | +/* 原有样式保留 + 新增/调整图片居中样式 */ | |
| 142 | +.page-container { | |
| 143 | + position: relative; // 新增:让蓝色块绝对定位生效 | |
| 144 | + min-height: 100vh; // 新增:防止内容高度不足 | |
| 166 | 145 | } |
| 167 | 146 | |
| 168 | -/* 蓝色块样式 */ | |
| 147 | +/* 蓝色块样式(保留) */ | |
| 169 | 148 | .blue-decor-block { |
| 170 | 149 | position: absolute; |
| 171 | 150 | top: 0; |
| ... | ... | @@ -176,21 +155,70 @@ const handleMenuClick = (item: MenuItem) => { |
| 176 | 155 | z-index: 1; |
| 177 | 156 | } |
| 178 | 157 | |
| 179 | -/* 内容容器样式 */ | |
| 158 | +/* 内容容器样式(保留 + 微调) */ | |
| 180 | 159 | .content-wrap { |
| 181 | 160 | position: relative; |
| 182 | 161 | z-index: 2; |
| 183 | - padding-top: 160px; | |
| 162 | + padding: 120px 0 0 ; // 新增左右内边距,避免卡片贴边 | |
| 163 | + display: flex; | |
| 164 | + flex-direction: column; | |
| 165 | + gap: 20rpx; // 新增:卡片之间的上下间距 | |
| 166 | +} | |
| 167 | + | |
| 168 | +/* 菜单卡片容器(新增:统一卡片外层间距) */ | |
| 169 | +.menu-card-wrap { | |
| 170 | + width: 100%; | |
| 171 | +} | |
| 172 | + | |
| 173 | +/* 卡片容器:重置up-card默认样式 */ | |
| 174 | +.card-container { | |
| 175 | + --u-card-content-padding: 0; // 取消卡片默认内边距 | |
| 176 | + border-radius: 8rpx; // 新增:卡片圆角 | |
| 177 | + overflow: hidden; // 新增:裁剪内部元素 | |
| 178 | +} | |
| 179 | + | |
| 180 | +/* 核心:小块容器(Flex 流式布局) */ | |
| 181 | +.card-content { | |
| 182 | + display: flex; | |
| 183 | + flex-wrap: wrap; // 自动换行 | |
| 184 | + gap: 20rpx; // 关键:小块之间的上下+左右间距统一 | |
| 185 | + | |
| 186 | +} | |
| 187 | + | |
| 188 | +/* 小块样式:一行最多4个,宽度自适应 + 内部flex布局 */ | |
| 189 | +.content-block { | |
| 190 | + // 宽度计算:(100% - 3*间距) / 4 (4个元素有3个间距) | |
| 191 | + width: calc((100% - 3 * 20rpx) / 4); | |
| 192 | + // 小块内部样式:改用flex布局,确保子元素居中 | |
| 193 | + display: flex; | |
| 194 | + flex-direction: column; | |
| 195 | + align-items: center; // 水平居中(核心:解决图片不居中问题) | |
| 196 | + justify-content: center; // 垂直居中(可选,优化视觉) | |
| 197 | + padding: 24rpx 0; | |
| 198 | + border-radius: 8rpx; | |
| 199 | + text-align: center; | |
| 200 | + // 点击反馈 | |
| 201 | + touch-action: manipulation; | |
| 202 | + transition: background-color 0.2s; | |
| 184 | 203 | } |
| 185 | 204 | |
| 205 | +/* 小块点击态 */ | |
| 206 | +.content-block:active { | |
| 207 | + background-color: #e9ecef; | |
| 208 | +} | |
| 186 | 209 | |
| 187 | -/* 网格文字样式(保留原始) */ | |
| 210 | +/* 新增:图片居中样式(兜底保障) */ | |
| 211 | +.block-icon { | |
| 212 | + display: block; // 转为块级元素 | |
| 213 | + margin: 0 auto; // 水平居中(双重保障) | |
| 214 | +} | |
| 215 | + | |
| 216 | +/* 网格文字样式(保留 + 微调) */ | |
| 188 | 217 | .grid-text { |
| 189 | - font-size: 24rpx; | |
| 218 | + font-size: 26rpx; | |
| 190 | 219 | color: #333; |
| 191 | 220 | text-align: center; |
| 192 | 221 | margin-top: 10rpx; |
| 222 | + display: block; // 新增:确保文字换行 | |
| 193 | 223 | } |
| 194 | - | |
| 195 | - | |
| 196 | 224 | </style> |
| 197 | 225 | \ No newline at end of file | ... | ... |
static/imgs/nav/home-off.png
0 → 100644
516 Bytes
static/imgs/nav/home-on.png
0 → 100644
977 Bytes
static/imgs/nav/my-off.png
0 → 100644
1.62 KB
static/imgs/nav/my-on.png
0 → 100644
1.33 KB
static/imgs/nav/work-off.png
0 → 100644
479 Bytes
static/imgs/nav/work-on.png
0 → 100644
1.28 KB