杂务:整理文档并收口 YumiNail 修复
This commit is contained in:
@@ -6,10 +6,10 @@
|
||||
<a-alert
|
||||
v-if="isBootstrapAdmin"
|
||||
class="bootstrap-alert"
|
||||
type="warning"
|
||||
type="info"
|
||||
show-icon
|
||||
message="当前处于建店引导状态"
|
||||
description="系统里还没有可用店铺。当前账号已允许登录后台先创建第一家店铺,其他后台模块会保持不可用,创建完成后请重新登录并选择店铺。"
|
||||
message="当前处于平台总览模式"
|
||||
description="可以查看总览、店铺列表和权限入口;用户、作品、订单、优惠券等店铺业务默认仅可查看,编辑操作已关闭。"
|
||||
/>
|
||||
|
||||
<a-alert
|
||||
@@ -86,16 +86,16 @@
|
||||
<template v-else>
|
||||
<section class="admin-page-intro">
|
||||
<span class="admin-page-intro__eyebrow">{{ userInfo?.nickname || userInfo?.account || '后台账号' }}</span>
|
||||
<h1 class="admin-page-intro__title">{{ userInfo?.shopName || (isBootstrapAdmin ? '无门店工作台' : '游客模式') }}</h1>
|
||||
<h1 class="admin-page-intro__title">{{ userInfo?.shopName || (isBootstrapAdmin ? '平台总览模式' : '游客模式') }}</h1>
|
||||
<div class="admin-page-intro__meta">
|
||||
<span class="admin-page-chip">{{ currentTime }}</span>
|
||||
<span class="admin-page-chip">{{ getUserTypeText(userInfo?.type) }}</span>
|
||||
<span v-if="isBootstrapAdmin" class="admin-page-chip">游客模式</span>
|
||||
<span v-if="isBootstrapAdmin" class="admin-page-chip">平台总览</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="isBootstrapAdmin" class="admin-mobile-section-card">
|
||||
<div class="admin-mobile-section-card__title">先创建第一家店铺</div>
|
||||
<div class="admin-mobile-section-card__title">平台总览模式</div>
|
||||
<a-button type="primary" size="large" block @click="navigateTo('/admin/shops', 'shop:view')">进入店铺管理</a-button>
|
||||
</section>
|
||||
|
||||
@@ -155,13 +155,27 @@
|
||||
*/
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { DashboardOutlined, HomeOutlined, SafetyCertificateOutlined, ShopOutlined, UserOutlined } from '@ant-design/icons-vue'
|
||||
import {
|
||||
DashboardOutlined,
|
||||
FileProtectOutlined,
|
||||
GiftOutlined,
|
||||
HomeOutlined,
|
||||
MessageOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
SettingOutlined,
|
||||
ShopOutlined,
|
||||
ShoppingOutlined,
|
||||
TagOutlined,
|
||||
TeamOutlined,
|
||||
UserOutlined
|
||||
} from '@ant-design/icons-vue'
|
||||
import { userApi, type UserVO } from '@/api/admin'
|
||||
import { permissionApi, type PermissionVO } from '@/api/permission'
|
||||
import { DEFAULT_AVATAR } from '@/constants'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { useAdminViewport } from '@/composables/useAdminViewport'
|
||||
import { isBootstrapAdminUser } from './admin-helpers'
|
||||
import { isAllowedForShoplessPlatformAdmin } from '@/utils/platform-admin-permissions'
|
||||
|
||||
const router = useRouter()
|
||||
const { isMobile } = useAdminViewport()
|
||||
@@ -228,6 +242,34 @@ const quickActions = computed(() => {
|
||||
icon: ShopOutlined,
|
||||
permissionCode: 'product:view'
|
||||
},
|
||||
{
|
||||
key: 'coupons',
|
||||
title: '优惠券',
|
||||
path: '/admin/coupons',
|
||||
icon: GiftOutlined,
|
||||
permissionCode: 'coupon:view'
|
||||
},
|
||||
{
|
||||
key: 'orders',
|
||||
title: '订单管理',
|
||||
path: '/admin/orders',
|
||||
icon: ShoppingOutlined,
|
||||
permissionCode: 'order:view'
|
||||
},
|
||||
{
|
||||
key: 'tags',
|
||||
title: '标签管理',
|
||||
path: '/admin/tags',
|
||||
icon: TagOutlined,
|
||||
permissionCode: 'tag:view'
|
||||
},
|
||||
{
|
||||
key: 'artists',
|
||||
title: '美甲师管理',
|
||||
path: '/admin/nail-artists',
|
||||
icon: TeamOutlined,
|
||||
permissionCode: 'nail_artist:view'
|
||||
},
|
||||
{
|
||||
key: 'shops',
|
||||
title: '店铺管理',
|
||||
@@ -241,10 +283,48 @@ const quickActions = computed(() => {
|
||||
path: '/admin/permissions',
|
||||
icon: SafetyCertificateOutlined,
|
||||
permissionCode: 'permission:view'
|
||||
},
|
||||
{
|
||||
key: 'messages',
|
||||
title: '消息发布',
|
||||
path: '/admin/messages',
|
||||
icon: MessageOutlined,
|
||||
permissionCode: 'message:view'
|
||||
},
|
||||
{
|
||||
key: 'announcements',
|
||||
title: '公告管理',
|
||||
path: '/admin/announcements',
|
||||
icon: MessageOutlined,
|
||||
permissionCode: 'announcement:view'
|
||||
},
|
||||
{
|
||||
key: 'vip-plans',
|
||||
title: 'VIP充值配置',
|
||||
path: '/admin/vip-recharge-plans',
|
||||
icon: GiftOutlined,
|
||||
permissionCode: 'user:vip:manage'
|
||||
},
|
||||
{
|
||||
key: 'parameters',
|
||||
title: '参数管理',
|
||||
path: '/admin/messagehub-push-configs',
|
||||
icon: SettingOutlined,
|
||||
permissionCode: 'messagehub:config:manage'
|
||||
},
|
||||
{
|
||||
key: 'agreements',
|
||||
title: '协议管理',
|
||||
path: '/admin/legal-agreements',
|
||||
icon: FileProtectOutlined,
|
||||
permissionCode: 'legal_agreement:manage'
|
||||
}
|
||||
]
|
||||
|
||||
const grantedPermissions = new Set(userPermissions.value.map(permission => permission.permissionCode))
|
||||
if (isBootstrapAdmin.value) {
|
||||
return actions.filter(item => isAllowedForShoplessPlatformAdmin(item.permissionCode))
|
||||
}
|
||||
return actions.filter(item => grantedPermissions.has(item.permissionCode))
|
||||
})
|
||||
|
||||
@@ -303,6 +383,10 @@ const fetchUserPermissions = async () => {
|
||||
/** navigateTo is a local helper used by this page script. */
|
||||
const navigateTo = (path: string, permissionCode?: string) => {
|
||||
if (permissionCode) {
|
||||
if (isBootstrapAdmin.value && isAllowedForShoplessPlatformAdmin(permissionCode)) {
|
||||
router.push(path)
|
||||
return
|
||||
}
|
||||
const hasPermission = userPermissions.value.some(p => p.permissionCode === permissionCode)
|
||||
if (!hasPermission) {
|
||||
message.warning('您没有该操作的权限')
|
||||
|
||||
Reference in New Issue
Block a user