Files
youlai-app/src/pages/work/index.vue
T
Ray.Hao 12f9b0057a refactor(menu): 菜单项增加类型判别并统一入口判权
- 菜单项增加 kind 字段,导航按判别字段分发而非嗅探地址前缀
- 菜单配置的权限标识接入 PERM 常量
- 新增 isMenuAllowed 统一首页与工作台的入口判权
- 首页删除与 WorkMenuItem 重复的局部类型
2026-10-16 20:32:23 +08:00

53 lines
1.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view>
<app-navbar title="工作台" :show-back="false" placeholder />
<!-- tabbar 壳为全出血(index/mine 的沉浸式头需要贴边),工作台网格需要自己补横向留白 -->
<view class="px-32rpx pt-16rpx">
<template v-for="(item, index) in visibleGroups" :key="index">
<wd-card :title="item.title">
<wd-grid clickable :column="4">
<wd-grid-item
v-for="(child, childIndex) in item.children"
:key="childIndex"
@click="navigate(child)"
>
<view class="p-2">
<image class="w-72rpx h-72rpx rounded-8rpx" :src="child.icon" />
</view>
<view>{{ child.title }}</view>
</wd-grid-item>
</wd-grid>
</wd-card>
</template>
</view>
</view>
</template>
<script lang="ts" setup>
import { computed } from "vue";
import { useNavigation } from "@/composables/useNavigation";
import { workMenuGroups } from "@/config/work-menu";
import { isMenuAllowed } from "@/utils/permission";
definePage({
name: "work",
style: {
navigationStyle: "custom",
navigationBarTitleText: "工作台",
},
layout: "tabbar",
});
const { navigate } = useNavigation();
// 根据权限过滤后的菜单分组,未授权分组整体不展示
const visibleGroups = computed(() => {
return workMenuGroups
.map((group) => ({
...group,
children: group.children.filter((item) => isMenuAllowed(item.perm)),
}))
.filter((group) => group.children.length > 0);
});
</script>