Merge remote-tracking branch 'origin/master'

master
liutao 3 weeks ago
commit df24ee20a2

@ -40,39 +40,29 @@
<text class="module-title">{{ module.name }}</text>
</view>
<view class="submodule-list">
<view v-for="(group, groupIndex) in module.groups" :key="group.id || `${moduleIndex}-${groupIndex}`" class="submodule-group">
<view class="submodule-header">
<text class="submodule-name">{{ group.name }}</text>
<view class="function-grid">
<view
v-for="(entry, entryIndex) in module.children"
:key="entry.id || `${moduleIndex}-${entryIndex}`"
class="function-item"
@click="handleClick(entry)"
>
<view class="function-icon" :style="{ background: `${hexToRgba(getModuleColor(moduleIndex), 0.1)}` }">
<uni-icons
v-if="isUniIcon(entry.icon)"
:type="getUniIconName(entry.icon)"
size="24"
:color="getModuleColor(moduleIndex)"
/>
<u-icon
v-else-if="isUviewIcon(entry.icon)"
:name="getUviewIconName(entry.icon)"
size="24"
:color="getModuleColor(moduleIndex)"
></u-icon>
<text v-else class="icon-inner">{{ getMenuSymbol(entry.name, entryIndex) }}</text>
</view>
<view class="function-grid">
<view
v-for="(entry, entryIndex) in group.children"
:key="entry.id || `${moduleIndex}-${groupIndex}-${entryIndex}`"
class="function-item"
@click="handleClick(entry)"
>
<view class="function-icon" :style="{ background: `${hexToRgba(getModuleColor(moduleIndex), 0.1)}` }">
<uni-icons
v-if="isUniIcon(entry.icon)"
:type="getUniIconName(entry.icon)"
size="24"
:color="getModuleColor(moduleIndex)"
/>
<u-icon
v-else-if="isUviewIcon(entry.icon)"
:name="getUviewIconName(entry.icon)"
size="24"
:color="getModuleColor(moduleIndex)"
></u-icon>
<text v-else class="icon-inner">{{ getMenuSymbol(entry.name, entryIndex) }}</text>
</view>
<text class="function-name">{{ entry.name }}</text>
</view>
</view>
<view v-if="groupIndex < module.groups.length - 1" class="divider"></view>
<text class="function-name">{{ entry.name }}</text>
</view>
</view>
</view>
@ -138,17 +128,12 @@ const filteredModules = computed(() => {
return modules.value
.map((module) => ({
...module,
groups: module.groups
.map((group) => ({
...group,
children: group.children.filter((entry) => {
const target = `${module.name}|${group.name}|${entry.name}`.toLowerCase()
return target.includes(keyword)
})
}))
.filter((group) => group.children.length > 0 || `${module.name}|${group.name}`.toLowerCase().includes(keyword))
children: (module.children || []).filter((entry) => {
const target = `${module.name}|${entry.name}`.toLowerCase()
return target.includes(keyword)
})
}))
.filter((module) => module.groups.length > 0 || String(module.name || '').toLowerCase().includes(keyword))
.filter((module) => (module.children || []).length > 0 || String(module.name || '').toLowerCase().includes(keyword))
})
const hasMenuPermission = computed(() => modules.value.length > 0)
@ -163,7 +148,7 @@ const emptyStateTitle = computed(() => {
const emptyStateDesc = computed(() => {
return isSearchEmpty.value
? `未搜索到与${menuSearchKeyword.value.trim()}相关的菜单项,请调整关键词后重试`
? `未搜索到与"${menuSearchKeyword.value.trim()}"相关的菜单项,请调整关键词后重试`
: `当前账号还未配置${props.title}相关菜单权限,请联系管理员完成配置`
})
@ -352,31 +337,11 @@ function handleClick(menu) {
color: #1a3a5c;
}
.submodule-list {
padding: 0 24rpx 24rpx;
}
.submodule-group {
padding-top: 24rpx;
}
.submodule-header {
padding: 0 8rpx 18rpx;
}
.submodule-name {
display: inline-block;
padding-left: 16rpx;
border-left: 6rpx solid #1a3a5c;
font-size: 30rpx;
font-weight: 600;
color: #435466;
}
.function-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 14rpx;
padding: 24rpx;
}
.function-item {
@ -417,12 +382,6 @@ function handleClick(menu) {
word-break: break-all;
}
.divider {
height: 1rpx;
background: #eef1f5;
margin: 24rpx 0 0;
}
.go-top-btn {
position: fixed;
bottom: 140rpx;

@ -178,11 +178,21 @@ export function findTabMenuByPage(menus, pagePath) {
export function buildPageModules(tabMenu) {
return toArray(tabMenu?.children)
.map((module) => ({
...module,
groups: wrapGroupEntries(module)
}))
.filter((module) => module.groups.length > 0)
.map((module) => {
const directChildren = toArray(module.children)
const hasNestedEntries = directChildren.some((child) => toArray(child.children).length > 0)
if (hasNestedEntries) {
return {
...module,
children: directChildren.flatMap((child) => toArray(child.children))
}
}
return {
...module,
children: directChildren
}
})
.filter((module) => (module.children || []).length > 0)
}
export function resolveMenuUrl(menu) {
@ -222,4 +232,4 @@ export function syncTabBarMenus(menus, options = {}) {
dynamicMenus[1]?.name || dynamicMenus[0]?.name || options.workFallback || '管理',
options.mineText || '我的'
]
}
}

Loading…
Cancel
Save