chore: 优化

pull/361/head
xiaojunnuo 2025-03-10 16:06:40 +08:00
parent 0c8a84656a
commit 0f5b9564c6
6 changed files with 43 additions and 59 deletions

View File

@ -1,7 +1,11 @@
<script setup lang="ts">
import { ref } from "vue";
import TutorialSteps from "/@/components/tutorial/tutorial-steps.vue";
import { useSettingStore } from "/@/store/modules/settings";
const props = defineProps<{
showIcon?: boolean;
}>();
const openedRef = ref(false);
function open() {
openedRef.value = true;
@ -12,8 +16,8 @@ const slots = defineSlots();
<template>
<div class="tutorial-button pointer" @click="open">
<template v-if="!slots.default">
<fs-icon icon="ant-design:question-circle-outlined"></fs-icon>
<div class="hidden md:block ml-0.5">使用教程</div>
<fs-icon v-if="showIcon" icon="ant-design:question-circle-outlined"></fs-icon>
<div class="hidden md:block">使用教程</div>
</template>
<slot></slot>
<a-modal v-model:open="openedRef" class="tutorial-modal" width="90%">

View File

@ -63,9 +63,6 @@ onMounted(async () => {
<LockScreen :avatar @to-login="handleLogout" />
</template>
<template #header-right-0>
<div class="hover:bg-accent ml-1 mr-2 cursor-pointer rounded-full hidden md:block">
<tutorial-button v-if="!settingStore.isComm" class="flex-center header-btn" />
</div>
<div class="hover:bg-accent ml-1 mr-2 cursor-pointer rounded-full">
<vip-button class="flex-center header-btn" mode="nav" />
</div>

View File

@ -1,54 +1,40 @@
import { IFrameView } from "/@/vben/layouts";
import { useSettingStore } from "/@/store/modules/settings";
import { computed } from "vue";
import TutorialButton from "/@/components/tutorial/index.vue";
export const aboutResource = [
{
title: "文档",
name: "about",
path: "/about",
redirect: "/about/doc",
name: "document",
path: "/about/doc",
component: IFrameView,
meta: {
icon: "lucide:book-open-text",
link: "https://certd.docmirror.cn",
title: "文档",
order: 9999,
show: () => {
const settingStore = useSettingStore();
return !settingStore.isComm;
}
}
},
{
title: "教程",
name: "help",
path: "/help",
meta: {
icon: "lucide:copyright",
order: 9999,
show: () => {
const settingStore = useSettingStore();
return !settingStore.isComm;
}
},
children: [
{
title: "文档",
name: "document",
path: "/about/doc",
component: IFrameView,
meta: {
icon: "lucide:book-open-text",
link: "https://certd.docmirror.cn",
title: "文档"
}
},
{
name: "Github",
path: "/about/github",
component: IFrameView,
meta: {
icon: "mdi:github",
link: "https://github.com/certd/certd",
title: "Github"
}
slot() {
return <TutorialButton className="flex-center" show-icon={false} />;
},
{
name: "Gitee",
path: "/about/gitee",
component: IFrameView,
meta: {
icon: "ion:logo-octocat",
link: "https://gitee.com/certd/certd",
title: "Gite"
}
}
]
click() {}
}
}
];

View File

@ -48,6 +48,10 @@ function handleClick() {
if (props.disabled) {
return;
}
if (props.click) {
props.click();
return;
}
rootMenu?.handleMenuItemClick?.({
parentPaths: parentPaths.value,
path: props.path

View File

@ -40,14 +40,14 @@ const hasChildren = computed(() => {
:badge-variants="menu.badgeVariants"
:icon="menu.icon"
:path="menu.path"
@click="menu.meta?.onClick"
:click="menu.meta?.click"
>
<template #title>
<span>{{ menu.name }}</span>
</template>
<template v-if="menu.meta?.slot" #default>
<fs-render :render-func="menu.meta.slot" />
</template>
<template v-else #title>
<span>{{ menu.name }}</span>
</template>
</MenuItem>
<SubMenuComp v-else :key="`${menu.path}_sub`" :active-icon="menu.activeIcon" :icon="menu.icon" :path="menu.path">
<template #content>

View File

@ -1,6 +1,6 @@
import type { Component, Ref } from 'vue';
import type { Component, Ref } from "vue";
import type { MenuRecordBadgeRaw, ThemeModeType } from '/@/vben/typings';
import type { MenuRecordBadgeRaw, ThemeModeType } from "/@/vben/typings";
interface MenuProps {
/**
@ -34,7 +34,7 @@ interface MenuProps {
* @zh_CN
* @default vertical
*/
mode?: 'horizontal' | 'vertical';
mode?: "horizontal" | "vertical";
/**
* @zh_CN
@ -85,6 +85,7 @@ interface MenuItemProps extends MenuRecordBadgeRaw {
* @zh_CN menuitem
*/
path: string;
click?: any;
}
interface MenuItemRegistered {
@ -128,12 +129,4 @@ interface SubMenuProvider {
removeSubMenu: (item: MenuItemRegistered) => void;
}
export type {
MenuItemClicked,
MenuItemProps,
MenuItemRegistered,
MenuProps,
MenuProvider,
SubMenuProps,
SubMenuProvider,
};
export type { MenuItemClicked, MenuItemProps, MenuItemRegistered, MenuProps, MenuProvider, SubMenuProps, SubMenuProvider };