Initial commit: One Pipe System

完整的管理系统,包含账户管理、卡片管理、套餐管理、财务管理等功能模块。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sexygoat
2026-01-22 16:35:33 +08:00
commit 222e5bb11a
495 changed files with 145440 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
/**
* 路由和导航相关工具函数统一导出
*/
export * from './jump'
export * from './worktab'
export * from './route'

View File

@@ -0,0 +1,37 @@
import { AppRouteRecord } from '@/types/router'
import { router } from '@/router'
// 打开外部链接
export const openExternalLink = (link: string) => {
window.open(link, '_blank')
}
/**
* 菜单跳转
* @param item 菜单项
* @param jumpToFirst 是否跳转到第一个子菜单
* @returns
*/
export const handleMenuJump = (item: AppRouteRecord, jumpToFirst: boolean = false) => {
// 处理外部链接
const { link, isIframe } = item.meta
if (link && !isIframe) {
return openExternalLink(link)
}
// 如果不需要跳转到第一个子菜单,或者没有子菜单,直接跳转当前路径
if (!jumpToFirst || !item.children?.length) {
return router.push(item.path)
}
// 获取第一个可见的子菜单,如果没有则取第一个子菜单
const firstChild = item.children.find((child) => !child.meta.isHide) || item.children[0]
// 如果第一个子菜单是外部链接则打开新窗口
if (firstChild.meta?.link) {
return openExternalLink(firstChild.meta.link)
}
// 跳转到子菜单路径
router.push(firstChild.path)
}

View File

@@ -0,0 +1,8 @@
/**
* 路由相关工具函数
*/
// 检查是否为 iframe 路由
export function isIframe(url: string): boolean {
return url.startsWith('/iframe/')
}

View File

@@ -0,0 +1,42 @@
import { useWorktabStore } from '@/store/modules/worktab'
import { RouteLocationNormalized } from 'vue-router'
import { isIframe } from './route'
import { useSettingStore } from '@/store/modules/setting'
import { HOME_PAGE } from '@/router/routesAlias'
import { getIframeRoutes } from '@/router/utils/menuToRouter'
/**
* 根据当前路由信息设置工作标签页worktab
* @param to 当前路由对象
*/
export const setWorktab = (to: RouteLocationNormalized): void => {
const worktabStore = useWorktabStore()
const { meta, path, name, params, query } = to
if (!meta.isHideTab) {
// 如果是 iframe 页面,则特殊处理工作标签页
if (isIframe(path)) {
const iframeRoute = getIframeRoutes().find((route: any) => route.path === to.path)
if (iframeRoute?.meta) {
worktabStore.openTab({
title: iframeRoute.meta.title,
path,
name: name as string,
keepAlive: meta.keepAlive as boolean,
params,
query
})
}
} else if (useSettingStore().showWorkTab || path === HOME_PAGE) {
worktabStore.openTab({
title: meta.title as string,
path,
name: name as string,
keepAlive: meta.keepAlive as boolean,
params,
query,
fixedTab: meta.fixedTab as boolean
})
}
}
}