杂务:整理文档并收口 YumiNail 修复

This commit is contained in:
xiaowang
2026-05-21 18:43:59 +08:00
parent 3797938616
commit 9227ec6175
362 changed files with 8358 additions and 19928 deletions
+123 -18
View File
@@ -1,5 +1,11 @@
<template>
<div class="admin-layout" :class="{ 'admin-layout--mobile': isMobile }">
<div
class="admin-layout"
:class="{
'admin-layout--mobile': isMobile,
'admin-layout--collapsed': collapsed && !isMobile
}"
>
<template v-if="!isMobile">
<a-layout>
<a-layout-sider
@@ -7,11 +13,12 @@
:trigger="null"
collapsible
class="sider"
width="240"
:width="240"
:collapsed-width="80"
>
<div class="logo">
<h1 v-if="!collapsed">后台管理</h1>
<h1 v-else>后台</h1>
<h1 v-if="!collapsed">YumiNail 管理台</h1>
<h1 v-else>YN</h1>
</div>
<a-menu
:selectedKeys="selectedKeys"
@@ -39,8 +46,8 @@
<MenuFoldOutlined v-else class="trigger" @click="toggleCollapsed" />
<div v-if="isBootstrapAdmin" class="shop-hint">
<span>当前暂无可用门店,请先前往店铺管理创建</span>
<a-button type="link" @click="router.push('/admin/shops')">去创建</a-button>
<span>平台总览模式:用户、店铺、权限、消息、公告和参数可管理,其它店铺业务仅查看</span>
<a-button type="link" @click="router.push('/admin/shops')">店铺管理</a-button>
</div>
<div v-else-if="shopOptions.length > 1" class="shop-switcher">
@@ -229,6 +236,7 @@ import { message, Modal } from 'ant-design-vue'
import { adminAuthApi, type UserVO } from '@/api/admin'
import { DEFAULT_AVATAR } from '@/constants'
import { usePermission } from '@/utils/permission'
import { isAllowedForShoplessPlatformAdmin } from '@/utils/platform-admin-permissions'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { useAdminViewport } from '@/composables/useAdminViewport'
import {
@@ -294,7 +302,10 @@ const isShopAuthorizationExpired = computed(() => Boolean(userInfo.value?.shopAu
/** shopOptions is a reactive state variable used by the template and event handlers. */
const shopOptions = computed(() => getAdminShopOptions(userInfo.value))
/** shopSelectOptions is a reactive state variable used by the template and event handlers. */
const shopSelectOptions = computed(() => shopOptions.value.map(shop => ({ label: shop.name, value: shop.id })))
const shopSelectOptions = computed(() => {
const options = shopOptions.value.map(shop => ({ label: shop.name, value: shop.id }))
return options
})
/** currentShopName is a reactive state variable used by the template and event handlers. */
const currentShopName = computed(() => getAdminCurrentShopName(userInfo.value))
/** roleLabel is a reactive state variable used by the template and event handlers. */
@@ -302,7 +313,7 @@ const roleLabel = computed(() => getAdminRoleLabel(userInfo.value?.type))
/** shopScopeText is a reactive state variable used by the template and event handlers. */
const shopScopeText = computed(() => {
if (!shopOptions.value.length) {
return '游客模式'
return isBootstrapAdmin.value ? '平台总览模式' : '游客模式'
}
return `可登录门店:${shopOptions.value.map(shop => shop.name).join(' / ')}`
})
@@ -314,14 +325,11 @@ const filteredMenuItems = computed(() => {
if (!item.permissionCode) {
return true
}
if (isBootstrapAdmin.value && item.key === '/admin/shops') {
return true
if (isBootstrapAdmin.value) {
return isAllowedForShoplessPlatformAdmin(item.permissionCode)
}
return hasPermission(item.permissionCode)
})
if (isBootstrapAdmin.value) {
visibleItems = visibleItems.filter(item => item.key === '/admin' || item.key === '/admin/shops')
}
if (isShopAuthorizationExpired.value && userInfo.value?.type !== 4) {
visibleItems = visibleItems.filter(item => item.key === '/admin')
}
@@ -520,7 +528,6 @@ onMounted(async () => {
await fetchUserInfo()
if (isBootstrapAdmin.value) {
clearPermissions()
return
}
await loadUserPermissions()
})
@@ -529,6 +536,11 @@ onMounted(async () => {
<style scoped>
.admin-layout {
min-height: 100vh;
--admin-sider-width: 240px;
}
.admin-layout--collapsed {
--admin-sider-width: 80px;
}
.sider {
@@ -546,6 +558,7 @@ onMounted(async () => {
top: 0;
bottom: 0;
z-index: 1000;
transition: width 0.2s ease;
}
.logo {
@@ -561,16 +574,22 @@ onMounted(async () => {
color: white;
font-size: 18px;
font-weight: 700;
white-space: nowrap;
}
.header {
position: sticky;
top: 0;
z-index: 100;
margin-left: var(--admin-sider-width);
height: auto;
min-height: 64px;
padding: 0 24px;
background: rgba(255, 249, 242, 0.96);
box-shadow: 0 10px 24px rgba(145, 102, 82, 0.08);
backdrop-filter: blur(14px);
line-height: normal;
transition: margin-left 0.2s ease;
}
.header-shell {
@@ -588,10 +607,12 @@ onMounted(async () => {
display: flex;
align-items: center;
gap: 16px;
flex: 1 1 auto;
min-width: 0;
}
.trigger {
flex: 0 0 auto;
font-size: 18px;
cursor: pointer;
color: var(--admin-mobile-ink);
@@ -608,10 +629,14 @@ onMounted(async () => {
border-radius: 999px;
background: var(--admin-mobile-surface-alt);
color: var(--admin-mobile-ink);
min-width: 0;
max-width: 100%;
}
.shop-hint {
flex-wrap: wrap;
border-radius: 14px;
line-height: 1.4;
}
.shop-switcher-label {
@@ -620,24 +645,88 @@ onMounted(async () => {
}
.shop-select {
min-width: 220px;
min-width: 180px;
width: min(260px, 28vw);
}
.shop-pill {
flex: 0 1 auto;
font-weight: 600;
line-height: 1.2;
}
.shop-pill :deep(.anticon) {
flex: 0 0 auto;
}
.shop-pill span {
display: inline-block;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.header-right {
display: flex;
align-items: center;
flex: 0 0 auto;
min-width: 0;
}
@media (max-width: 560px) {
.header {
padding: 0 10px;
}
.header-shell {
gap: 10px;
min-height: 58px;
}
.header-left {
flex: 1 1 0;
gap: 10px;
overflow: hidden;
}
.header-right {
flex: 0 0 auto;
margin-left: auto;
}
.shop-pill {
flex: 1 1 0;
max-width: none;
min-height: 36px;
padding: 0 12px;
gap: 8px;
overflow: hidden;
}
.shop-pill span {
max-width: 100%;
}
}
@media (max-width: 420px) {
.header-shell {
gap: 8px;
}
.header-left {
gap: 8px;
}
}
.user-dropdown {
display: flex;
align-items: center;
gap: 12px;
min-height: 48px;
padding: 8px 12px;
border-radius: 10px;
line-height: 1.2;
transition: background 0.2s ease;
}
@@ -647,10 +736,14 @@ onMounted(async () => {
.username {
color: var(--admin-mobile-ink);
max-width: 120px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.content {
margin-left: 240px;
margin-left: var(--admin-sider-width);
min-height: calc(100vh - 64px);
padding: 24px;
background:
@@ -664,8 +757,20 @@ onMounted(async () => {
margin: 0 auto;
}
.admin-layout :deep(.ant-layout-sider-collapsed) + .ant-layout .content {
margin-left: 80px;
@media (max-width: 960px) {
.admin-layout,
.admin-layout--collapsed {
--admin-sider-width: 0px;
}
.sider {
display: none;
}
.header,
.content {
margin-left: 0;
}
}
.mobile-shell {