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

View File

@ -63,9 +63,6 @@ onMounted(async () => {
<LockScreen :avatar @to-login="handleLogout" /> <LockScreen :avatar @to-login="handleLogout" />
</template> </template>
<template #header-right-0> <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"> <div class="hover:bg-accent ml-1 mr-2 cursor-pointer rounded-full">
<vip-button class="flex-center header-btn" mode="nav" /> <vip-button class="flex-center header-btn" mode="nav" />
</div> </div>

View File

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

View File

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

View File

@ -40,14 +40,14 @@ const hasChildren = computed(() => {
:badge-variants="menu.badgeVariants" :badge-variants="menu.badgeVariants"
:icon="menu.icon" :icon="menu.icon"
:path="menu.path" :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> <template v-if="menu.meta?.slot" #default>
<fs-render :render-func="menu.meta.slot" /> <fs-render :render-func="menu.meta.slot" />
</template> </template>
<template v-else #title>
<span>{{ menu.name }}</span>
</template>
</MenuItem> </MenuItem>
<SubMenuComp v-else :key="`${menu.path}_sub`" :active-icon="menu.activeIcon" :icon="menu.icon" :path="menu.path"> <SubMenuComp v-else :key="`${menu.path}_sub`" :active-icon="menu.activeIcon" :icon="menu.icon" :path="menu.path">
<template #content> <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 { interface MenuProps {
/** /**
@ -34,7 +34,7 @@ interface MenuProps {
* @zh_CN * @zh_CN
* @default vertical * @default vertical
*/ */
mode?: 'horizontal' | 'vertical'; mode?: "horizontal" | "vertical";
/** /**
* @zh_CN * @zh_CN
@ -85,6 +85,7 @@ interface MenuItemProps extends MenuRecordBadgeRaw {
* @zh_CN menuitem * @zh_CN menuitem
*/ */
path: string; path: string;
click?: any;
} }
interface MenuItemRegistered { interface MenuItemRegistered {
@ -128,12 +129,4 @@ interface SubMenuProvider {
removeSubMenu: (item: MenuItemRegistered) => void; removeSubMenu: (item: MenuItemRegistered) => void;
} }
export type { export type { MenuItemClicked, MenuItemProps, MenuItemRegistered, MenuProps, MenuProvider, SubMenuProps, SubMenuProvider };
MenuItemClicked,
MenuItemProps,
MenuItemRegistered,
MenuProps,
MenuProvider,
SubMenuProps,
SubMenuProvider,
};