frpc-desktop/src/layout/compoenets/LeftMenu.vue

129 lines
3.4 KiB
Vue
Raw Normal View History

2023-11-27 15:03:25 +08:00
<script lang="ts" setup>
2024-08-24 14:41:39 +08:00
import { computed, defineComponent, onMounted, ref } from "vue";
2023-11-27 15:03:25 +08:00
import router from "@/router";
2024-08-24 14:41:39 +08:00
import { RouteRecordRaw } from "vue-router";
import pkg from "../../../package.json";
import Intro from "@/intro";
import "intro.js/introjs.css";
import confetti from "canvas-confetti/src/confetti.js";
2024-08-16 16:23:20 +08:00
2023-11-27 15:03:25 +08:00
defineComponent({
name: "AppMain"
});
const routes = ref<Array<RouteRecordRaw>>([]);
2024-08-24 14:41:39 +08:00
const guideSteps = ref({
Home: {
step: "1",
intro: "此功能用于控制frpc的连接状态您可以轻松地断开或重新连接。"
},
Proxy: {
step: "2",
intro:
"在这里,您可以方便地配置和管理代理设置。无论是添加、修改还是删除代理,您都可以轻松完成。"
},
Download: {
step: "3",
intro: "通过此功能您可以快速下载最新版本的frp。"
},
Config: {
step: "4",
intro:
"此功能允许您设置软件的各种配置选项,包括连接方式等。根据您的需求进行个性化设置,以优化使用体验。"
},
Logger: {
step: "5",
intro:
"在日志查看功能中您可以实时查看FRP连接的日志信息。这有助于您监控连接状态及时排查可能出现的问题。"
},
Version: {
step: "6",
intro:
"通过此功能您可以查看当前安装的Frpc-Desktop版本并检查是否有可用更新。"
}
});
2023-11-27 15:03:25 +08:00
const currentRoute = computed(() => {
return router.currentRoute.value;
});
/**
* 菜单切换
* @param mi 菜单索引
*/
2024-07-17 14:21:31 +08:00
const handleMenuChange = (route: any) => {
2023-11-27 15:03:25 +08:00
if (currentRoute.value.name === route.name) {
return;
}
router.push({
path: route.path
});
};
2024-08-11 16:54:01 +08:00
const handleOpenGitHubReleases = () => {
// ipcRenderer.send("github.openReleases")
router.push({
name: "About"
2024-08-24 14:41:39 +08:00
});
};
2024-08-05 23:22:06 +08:00
2023-11-27 15:03:25 +08:00
onMounted(() => {
routes.value = router.options.routes[0].children?.filter(
2024-08-24 14:41:39 +08:00
f => !f.meta?.hidden
2023-11-27 15:03:25 +08:00
) as Array<RouteRecordRaw>;
2024-08-24 14:41:39 +08:00
if (!localStorage.getItem("guide")) {
// 开始
Intro.onBeforeExit(function () {
// 礼花
confetti({
zIndex: 12002,
particleCount: 200,
spread: 70,
origin: { y: 0.6 }
});
localStorage.setItem("guide", new Date().getTime().toString());
}).start();
}
2023-11-27 15:03:25 +08:00
});
</script>
<template>
<div class="left-menu-container drop-shadow-xl">
<div class="logo-container">
2024-08-24 14:41:39 +08:00
<img
src="/logo/only/128x128.png"
class="logo animate__animated animate__flip"
alt="Logo"
/>
2023-11-27 15:03:25 +08:00
</div>
<ul class="menu-container">
2024-08-05 23:13:55 +08:00
<!-- enter-active-class="animate__animated animate__bounceIn"-->
<!-- leave-active-class="animate__animated animate__fadeOut"-->
2023-11-27 15:03:25 +08:00
<li
2024-08-24 14:41:39 +08:00
:data-step="guideSteps[r.name]?.step"
:data-intro="guideSteps[r.name]?.intro"
:data-disable-interaction="true"
class="menu animate__animated"
:class="currentRoute?.name === r.name ? 'menu-selected' : ''"
v-for="r in routes"
:key="r.name"
@click="handleMenuChange(r)"
2023-11-27 15:03:25 +08:00
>
2024-08-24 14:41:39 +08:00
<IconifyIconOffline
class="animate__animated"
:icon="r?.meta?.icon as string"
></IconifyIconOffline>
2023-11-27 15:03:25 +08:00
</li>
</ul>
2024-08-24 14:41:39 +08:00
<div
class="version mb-2 animate__animated"
@click="handleOpenGitHubReleases"
:data-step="guideSteps.Version?.step"
:data-intro="guideSteps.Version?.intro"
data-position="top"
>
2024-08-11 16:54:01 +08:00
{{ pkg.version }}
2024-08-05 22:46:14 +08:00
</div>
2023-11-27 15:03:25 +08:00
</div>
</template>