菜单修改优化
This commit is contained in:
@@ -52,6 +52,7 @@ type ActiveNavKey =
|
||||
| 'pricing'
|
||||
| 'patrol-delete'
|
||||
| 'query-asin'
|
||||
| 'shop-data-crawl'
|
||||
| 'withdraw'
|
||||
| 'collect-data'
|
||||
| 'image-video'
|
||||
@@ -85,7 +86,7 @@ const active = props.active
|
||||
const showNav = props.showNav
|
||||
const showHomeLink = props.showHomeLink
|
||||
const showActions = props.showActions
|
||||
const allowedColumnKeys = ref<string[] | null>(null)
|
||||
const allowedColumnKeys = ref<string[]>([])
|
||||
|
||||
const navGroups: ReadonlyArray<NavGroup> = [
|
||||
{
|
||||
@@ -114,6 +115,7 @@ const navGroups: ReadonlyArray<NavGroup> = [
|
||||
{ key: 'pricing', label: '跟价', href: '/new_web_source/price-track.html', aliases: ['price-track'] },
|
||||
{ key: 'patrol-delete', label: '巡店删除', href: '/new_web_source/patrol-delete.html' },
|
||||
{ key: 'query-asin', label: '查询ASIN', href: '/new_web_source/query-asin.html' },
|
||||
{ key: 'shop-data-crawl', label: '店铺数据抓取', href: '/new_web_source/shop-data-crawl.html', columnKey: 'shop_data_crawl', aliases: ['shop-data-crawl'] },
|
||||
{ key: 'withdraw', label: '取款', href: '/new_web_source/withdraw.html' },
|
||||
{ key: 'shop-status', label: '店铺状态查询' },
|
||||
],
|
||||
@@ -135,9 +137,6 @@ function getItemPermissionKeys(item: NavItem) {
|
||||
}
|
||||
|
||||
const visibleNavGroups = computed(() => {
|
||||
if (allowedColumnKeys.value === null) {
|
||||
return navGroups
|
||||
}
|
||||
const allowedSet = new Set(allowedColumnKeys.value)
|
||||
|
||||
const groups = navGroups.flatMap((group) => {
|
||||
@@ -150,14 +149,14 @@ const visibleNavGroups = computed(() => {
|
||||
return items.length ? [{ ...group, items }] : []
|
||||
})
|
||||
|
||||
return groups.length ? groups : navGroups
|
||||
return groups
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
allowedColumnKeys.value = await getCurrentUserAppColumnKeys()
|
||||
} catch (_error) {
|
||||
allowedColumnKeys.value = null
|
||||
allowedColumnKeys.value = []
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user