commit 6b3aa14b77568c460465ba2f312c760929f84a62 Author: Y <851796874@qq.com> Date: Fri Jun 6 18:40:46 2025 +0800 初始话 diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..00ee2de --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# http://editorconfig.org +root = true + +# 表示所有文件适用 +[*] +charset = utf-8 # 设置文件字符集为 utf-8 +end_of_line = lf # 控制换行类型(lf | cr | crlf) +indent_style = space # 缩进风格(tab | space) +indent_size = 2 # 缩进大小 +insert_final_newline = true # 始终在文件末尾插入一个新行 + +# 表示仅 md 文件适用以下规则 +[*.md] +max_line_length = off # 关闭最大行长度限制 +trim_trailing_whitespace = false # 关闭末尾空格修剪 diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..55b854a --- /dev/null +++ b/.env.development @@ -0,0 +1,15 @@ +# 应用端口 +VITE_APP_PORT=3000 + +# 代理前缀 +VITE_APP_BASE_API=/dev-api + +# 接口地址 +VITE_APP_API_URL=https://api.youlai.tech # 线上 +# VITE_APP_API_URL=http://localhost:8989 # 本地 + +# WebSocket 端点(不配置则关闭),线上 ws://api.youlai.tech/ws ,本地 ws://localhost:8989/ws +VITE_APP_WS_ENDPOINT= + +# 启用 Mock 服务 +VITE_MOCK_DEV_SERVER=false diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..17729b6 --- /dev/null +++ b/.env.production @@ -0,0 +1,6 @@ +# 代理前缀 +VITE_APP_BASE_API = '/prod-api' + + +# WebSocket端点(可选) +#VITE_APP_WS_ENDPOINT=wss://api.youlai.tech/ws diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json new file mode 100644 index 0000000..0e8546f --- /dev/null +++ b/.eslintrc-auto-import.json @@ -0,0 +1,316 @@ +{ + "globals": { + "Component": true, + "ComponentPublicInstance": true, + "ComputedRef": true, + "EffectScope": true, + "ElMessage": true, + "ElMessageBox": true, + "ElNotification": true, + "InjectionKey": true, + "PropType": true, + "Ref": true, + "VNode": true, + "asyncComputed": true, + "autoResetRef": true, + "computed": true, + "computedAsync": true, + "computedEager": true, + "computedInject": true, + "computedWithControl": true, + "controlledComputed": true, + "controlledRef": true, + "createApp": true, + "createEventHook": true, + "createGlobalState": true, + "createInjectionState": true, + "createReactiveFn": true, + "createReusableTemplate": true, + "createSharedComposable": true, + "createTemplatePromise": true, + "createUnrefFn": true, + "customRef": true, + "debouncedRef": true, + "debouncedWatch": true, + "defineAsyncComponent": true, + "defineComponent": true, + "eagerComputed": true, + "effectScope": true, + "extendRef": true, + "getCurrentInstance": true, + "getCurrentScope": true, + "h": true, + "ignorableWatch": true, + "inject": true, + "isDefined": true, + "isProxy": true, + "isReactive": true, + "isReadonly": true, + "isRef": true, + "makeDestructurable": true, + "markRaw": true, + "nextTick": true, + "onActivated": true, + "onBeforeMount": true, + "onBeforeUnmount": true, + "onBeforeUpdate": true, + "onClickOutside": true, + "onDeactivated": true, + "onErrorCaptured": true, + "onKeyStroke": true, + "onLongPress": true, + "onMounted": true, + "onRenderTracked": true, + "onRenderTriggered": true, + "onScopeDispose": true, + "onServerPrefetch": true, + "onStartTyping": true, + "onUnmounted": true, + "onUpdated": true, + "pausableWatch": true, + "provide": true, + "reactify": true, + "reactifyObject": true, + "reactive": true, + "reactiveComputed": true, + "reactiveOmit": true, + "reactivePick": true, + "readonly": true, + "ref": true, + "refAutoReset": true, + "refDebounced": true, + "refDefault": true, + "refThrottled": true, + "refWithControl": true, + "resolveComponent": true, + "resolveRef": true, + "resolveUnref": true, + "shallowReactive": true, + "shallowReadonly": true, + "shallowRef": true, + "syncRef": true, + "syncRefs": true, + "templateRef": true, + "throttledRef": true, + "throttledWatch": true, + "toRaw": true, + "toReactive": true, + "toRef": true, + "toRefs": true, + "toValue": true, + "triggerRef": true, + "tryOnBeforeMount": true, + "tryOnBeforeUnmount": true, + "tryOnMounted": true, + "tryOnScopeDispose": true, + "tryOnUnmounted": true, + "unref": true, + "unrefElement": true, + "until": true, + "useActiveElement": true, + "useAnimate": true, + "useArrayDifference": true, + "useArrayEvery": true, + "useArrayFilter": true, + "useArrayFind": true, + "useArrayFindIndex": true, + "useArrayFindLast": true, + "useArrayIncludes": true, + "useArrayJoin": true, + "useArrayMap": true, + "useArrayReduce": true, + "useArraySome": true, + "useArrayUnique": true, + "useAsyncQueue": true, + "useAsyncState": true, + "useAttrs": true, + "useBase64": true, + "useBattery": true, + "useBluetooth": true, + "useBreakpoints": true, + "useBroadcastChannel": true, + "useBrowserLocation": true, + "useCached": true, + "useClipboard": true, + "useCloned": true, + "useColorMode": true, + "useConfirmDialog": true, + "useCounter": true, + "useCssModule": true, + "useCssVar": true, + "useCssVars": true, + "useCurrentElement": true, + "useCycleList": true, + "useDark": true, + "useDateFormat": true, + "useDebounce": true, + "useDebounceFn": true, + "useDebouncedRefHistory": true, + "useDeviceMotion": true, + "useDeviceOrientation": true, + "useDevicePixelRatio": true, + "useDevicesList": true, + "useDisplayMedia": true, + "useDocumentVisibility": true, + "useDraggable": true, + "useDropZone": true, + "useElementBounding": true, + "useElementByPoint": true, + "useElementHover": true, + "useElementSize": true, + "useElementVisibility": true, + "useEventBus": true, + "useEventListener": true, + "useEventSource": true, + "useEyeDropper": true, + "useFavicon": true, + "useFetch": true, + "useFileDialog": true, + "useFileSystemAccess": true, + "useFocus": true, + "useFocusWithin": true, + "useFps": true, + "useFullscreen": true, + "useGamepad": true, + "useGeolocation": true, + "useIdle": true, + "useImage": true, + "useInfiniteScroll": true, + "useIntersectionObserver": true, + "useInterval": true, + "useIntervalFn": true, + "useKeyModifier": true, + "useLastChanged": true, + "useLocalStorage": true, + "useMagicKeys": true, + "useManualRefHistory": true, + "useMediaControls": true, + "useMediaQuery": true, + "useMemoize": true, + "useMemory": true, + "useMounted": true, + "useMouse": true, + "useMouseInElement": true, + "useMousePressed": true, + "useMutationObserver": true, + "useNavigatorLanguage": true, + "useNetwork": true, + "useNow": true, + "useObjectUrl": true, + "useOffsetPagination": true, + "useOnline": true, + "usePageLeave": true, + "useParallax": true, + "useParentElement": true, + "usePerformanceObserver": true, + "usePermission": true, + "usePointer": true, + "usePointerLock": true, + "usePointerSwipe": true, + "usePreferredColorScheme": true, + "usePreferredContrast": true, + "usePreferredDark": true, + "usePreferredLanguages": true, + "usePreferredReducedMotion": true, + "usePrevious": true, + "useRafFn": true, + "useRefHistory": true, + "useResizeObserver": true, + "useScreenOrientation": true, + "useScreenSafeArea": true, + "useScriptTag": true, + "useScroll": true, + "useScrollLock": true, + "useSessionStorage": true, + "useShare": true, + "useSlots": true, + "useSorted": true, + "useSpeechRecognition": true, + "useSpeechSynthesis": true, + "useStepper": true, + "useStorage": true, + "useStorageAsync": true, + "useStyleTag": true, + "useSupported": true, + "useSwipe": true, + "useTemplateRefsList": true, + "useTextDirection": true, + "useTextSelection": true, + "useTextareaAutosize": true, + "useThrottle": true, + "useThrottleFn": true, + "useThrottledRefHistory": true, + "useTimeAgo": true, + "useTimeout": true, + "useTimeoutFn": true, + "useTimeoutPoll": true, + "useTimestamp": true, + "useTitle": true, + "useToNumber": true, + "useToString": true, + "useToggle": true, + "useTransition": true, + "useUrlSearchParams": true, + "useUserMedia": true, + "useVModel": true, + "useVModels": true, + "useVibrate": true, + "useVirtualList": true, + "useWakeLock": true, + "useWebNotification": true, + "useWebSocket": true, + "useWebWorker": true, + "useWebWorkerFn": true, + "useWindowFocus": true, + "useWindowScroll": true, + "useWindowSize": true, + "watch": true, + "watchArray": true, + "watchAtMost": true, + "watchDebounced": true, + "watchDeep": true, + "watchEffect": true, + "watchIgnorable": true, + "watchImmediate": true, + "watchOnce": true, + "watchPausable": true, + "watchPostEffect": true, + "watchSyncEffect": true, + "watchThrottled": true, + "watchTriggerable": true, + "watchWithFilter": true, + "useRoute": true, + "useRouter": true, + "storeToRefs": true, + "whenever": true, + "DirectiveBinding": true, + "ExtractDefaultPropTypes": true, + "ExtractPropTypes": true, + "ExtractPublicPropTypes": true, + "MaybeRef": true, + "MaybeRefOrGetter": true, + "WritableComputedRef": true, + "acceptHMRUpdate": true, + "createPinia": true, + "defineStore": true, + "getActivePinia": true, + "injectLocal": true, + "mapActions": true, + "mapGetters": true, + "mapState": true, + "mapStores": true, + "mapWritableState": true, + "onBeforeRouteLeave": true, + "onBeforeRouteUpdate": true, + "onWatcherCleanup": true, + "provideLocal": true, + "setActivePinia": true, + "setMapStoreSuffix": true, + "useClipboardItems": true, + "useI18n": true, + "useId": true, + "useLink": true, + "useModel": true, + "useTemplateRef": true + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a6d77ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +node_modules +.DS_Store +dist +dist-ssr +*.local +.history + +# Editor directories and files +.idea +*.suo +*.ntvs* +*.njsproj +*.sln +*.local + +stats.html +pnpm-lock.yaml +package-lock.json +.stylelintcache +.eslintcache diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 0000000..fd2bf70 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1 @@ +npx --no-install commitlint --edit $1 diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..b18d041 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npm run lint:lint-staged diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..44421a7 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,12 @@ +dist +node_modules +public +.husky +.vscode +.idea +*.sh +*.md + +src/assets +stats.html +pnpm-lock.yaml diff --git a/.prettierrc.yaml b/.prettierrc.yaml new file mode 100644 index 0000000..d9cf0c7 --- /dev/null +++ b/.prettierrc.yaml @@ -0,0 +1,41 @@ +# 在单参数箭头函数中始终添加括号 +arrowParens: "always" +# JSX 多行元素的闭合标签另起一行 +bracketSameLine: false +# 对象字面量中的括号之间添加空格 +bracketSpacing: true +# 自动格式化嵌入的代码(如 Markdown 和 HTML 内的代码) +embeddedLanguageFormatting: "auto" +# 忽略 HTML 空白敏感度,将空白视为非重要内容 +htmlWhitespaceSensitivity: "ignore" +# 不插入 @prettier 的 pragma 注释 +insertPragma: false +# 在 JSX 中使用双引号 +jsxSingleQuote: false +# 每行代码的最大长度限制为 100 字符 +printWidth: 100 +# 在 Markdown 中保留原有的换行格式 +proseWrap: "preserve" +# 仅在必要时添加对象属性的引号 +quoteProps: "as-needed" +# 不要求文件开头插入 @prettier 的 pragma 注释 +requirePragma: false +# 在语句末尾添加分号 +semi: true +# 使用双引号而不是单引号 +singleQuote: false +# 缩进使用 2 个空格 +tabWidth: 2 +# 在多行元素的末尾添加逗号(ES5 支持的对象、数组等) +trailingComma: "es5" +# 使用空格而不是制表符缩进 +useTabs: false +# Vue 文件中的 ", + "", + "", + "" + ], + "description": "Vue3.0" + } +} diff --git a/.vscode/vue3.2.code-snippets b/.vscode/vue3.2.code-snippets new file mode 100644 index 0000000..a083940 --- /dev/null +++ b/.vscode/vue3.2.code-snippets @@ -0,0 +1,17 @@ +{ + "Vue3.2+快速生成模板": { + "scope": "vue", + "prefix": "Vue3.2+", + "body": [ + "", + "", + "", + "", + "", + "" + ], + "description": "Vue3.2+" + } +} diff --git a/.vscode/vue3.3.code-snippets b/.vscode/vue3.3.code-snippets new file mode 100644 index 0000000..705e04f --- /dev/null +++ b/.vscode/vue3.3.code-snippets @@ -0,0 +1,21 @@ +{ + "Vue3.3+defineOptions快速生成模板": { + "scope": "vue", + "prefix": "Vue3.3+", + "body": [ + "", + "", + "", + "", + "", + "" + ], + "description": "Vue3.3+defineOptions快速生成模板" + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..aef3f6d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,386 @@ + +# 2.11.5 (2024/6/18) + +## ✨ feat + +- 支持后端文件导入([#142](https://github.com/youlaitech/vue3-element-admin/pull/142)) [@cshaptx4869](https://github.com/cshaptx4869) + + +## 🐛 fix +- vue-dev-tools 插件导致菜单路由切换卡死,暂时关闭 ([28349e](https://github.com/youlaitech/vue3-element-admin/commit/28349efe147afab36531ba148eaac3a448fe6c71)) [@haoxianrui](https://github.com/haoxianrui) + + + +# 2.11.4 (2024/6/16) + +## ✨ feat + +- 操作栏增加render配置参数([#138](https://github.com/youlaitech/vue3-element-admin/pull/140)) [@cshaptx4869](https://github.com/cshaptx4869) +- 左侧工具栏增加type配置参数([#141](https://github.com/youlaitech/vue3-element-admin/pull/141)) [@diamont1001](https://github.com/diamont1001) + +## ♻️ refactor +- 更换权限分配弹窗类型为 drawer 并添加父子联动开关([2d9193](https://github.com/youlaitech/vue3-element-admin/commit/2d9193c47fd224f01f82b9c0b2bbeb5e7cb33584)) [@haoxianrui](https://github.com/haoxianrui) + + + +# 2.11.3 (2024/6/11) + +## ✨ feat + +- 支持默认工具栏的导入([#138](https://github.com/youlaitech/vue3-element-admin/pull/138)) [@cshaptx4869](https://github.com/cshaptx4869) +- 添加CURD导入示例([19e7bb](https://github.com/youlaitech/vue3-element-admin/commit/eab91effd6a01d5a3d9257249c8d06aa252b3bf8)) [@cshaptx4869](https://github.com/cshaptx4869) + +## ♻️ refactor +- 修改导出全量数据选项文本([904fec](https://github.com/youlaitech/vue3-element-admin/commit/904fecad65217650482fcdbb10ffb7f3d27eb9ea)) [@cshaptx4869](https://github.com/cshaptx4869) + +## 🐛 fix +- 菜单列表未适配el-icon导致图标不显示问题修复([e72b68](https://github.com/youlaitech/vue3-element-admin/commit/e72b68337562b5a7ea24ad55bbe00023e1266b40)) [@haoxianrui](https://github.com/haoxianrui) + +# 2.11.2 (2024/6/8) + +## ✨ feat + +- 支持表格远程筛选([#131](https://github.com/youlaitech/vue3-element-admin/pull/131)) [@cshaptx4869](https://github.com/cshaptx4869) +- 支持标签输入框([#132](https://github.com/youlaitech/vue3-element-admin/pull/132)) [@cshaptx4869](https://github.com/cshaptx4869) +- 表单项支持tips配置([#133](https://github.com/youlaitech/vue3-element-admin/pull/133)) [@cshaptx4869](https://github.com/cshaptx4869) +- 前端导出支持全量数据([#134](https://github.com/youlaitech/vue3-element-admin/pull/134)) [@cshaptx4869](https://github.com/cshaptx4869) +- 支持选中数据导出([#135](https://github.com/youlaitech/vue3-element-admin/pull/135)) [@cshaptx4869](https://github.com/cshaptx4869) +- 表格默认工具栏的导出、搜索按钮增加权限点控制([883128](https://github.com/youlaitech/vue3-element-admin/commit/8831289b655f2cc086ecdababaa89f8d8a087c42)) [@cshaptx4869](https://github.com/cshaptx4869) +- 页签title支持动态设置([23876a](https://github.com/youlaitech/vue3-element-admin/commit/23876aa396143bf77cb5c86af8d6023d9ff6555a)) [@haoxianrui](https://github.com/haoxianrui) + +## ♻️ refactor +- 默认工具栏支持自定义([#136](https://github.com/youlaitech/vue3-element-admin/pull/136)) [@cshaptx4869](https://github.com/cshaptx4869) +- 未配置全量导出接口时选项隐藏([eab91ef](https://github.com/youlaitech/vue3-element-admin/commit/eab91effd6a01d5a3d9257249c8d06aa252b3bf8)) [@cshaptx4869](https://github.com/cshaptx4869) + +## 🐛 fix +- 修复注销登出后redirect跳转路由参数丢失([5626017](https://github.com/youlaitech/vue3-element-admin/commit/562601736731afd20bb1a5140d856f6515720159)) [@haoxianrui](https://github.com/haoxianrui) + +# 2.11.1 (2024/6/6) + +## ✨ feat + +- 增加pagination、request、parseData配置参数([#119](https://github.com/youlaitech/vue3-element-admin/pull/119)) [@cshaptx4869](https://github.com/cshaptx4869) +- 增加返回顶部功能([#120](https://github.com/youlaitech/vue3-element-admin/pull/120)) [@cshaptx4869](https://github.com/cshaptx4869) +- 支持前端导出([#126](https://github.com/youlaitech/vue3-element-admin/pull/126)) [@cshaptx4869](https://github.com/cshaptx4869) + +## ♻️ refactor +- 重构布局样式(解决页面抖动问题)([#116](https://github.com/youlaitech/vue3-element-admin/pull/116)) [@cshaptx4869](https://github.com/cshaptx4869) +- 修改CURD示例编辑弹窗尺寸([#121](https://github.com/youlaitech/vue3-element-admin/pull/121)) [@cshaptx4869](https://github.com/cshaptx4869) +- 统一注册vue插件([#122](https://github.com/youlaitech/vue3-element-admin/pull/122)) [@cshaptx4869](https://github.com/cshaptx4869) +- 默认主题跟随系统([#128](https://github.com/youlaitech/vue3-element-admin/pull/128)) [@cshaptx4869](https://github.com/cshaptx4869) +- 增加"scss.lint.unknownAtRules": "ignore"代码,解决style中使用@apply提示unknow at rules@apply提示问题([Gitee#22](https://gitee.com/youlaiorg/vue3-element-admin/pulls/22)) [@zjsy521](https://gitee.com/zjsy521) + +## 🐛 fix +- 修复左侧布局移动端菜单弹出样式 ([#117](https://github.com/youlaitech/vue3-element-admin/pull/117)) [@cshaptx4869](https://github.com/cshaptx4869) + +- 修复编辑后未清空id再新增菜单覆盖的问题([0e78eeb](https://github.com/youlaitech/vue3-element-admin/commit/0e78eeb75008fa8e9732b1b4e7d7a1ea345c7a1b)) [@haoxianrui](https://github.com/haoxianrui) +- 修复水印层级问题([#123](https://github.com/youlaitech/vue3-element-admin/pull/123)) [@cshaptx4869](https://github.com/cshaptx4869) +- 修复混合布局样式问题([#124](https://github.com/youlaitech/vue3-element-admin/pull/124)) [@cshaptx4869](https://github.com/cshaptx4869) +- 修复关闭弹窗时没有clearValidate问题([#125](https://github.com/youlaitech/vue3-element-admin/pull/125)) [@andm31](https://github.com/andm31) + + + +# 2.11.0 (2024/5/27) + +## ✨ feat +- 菜单添加路由参数设置(author by [haoxianrui](https://github.com/haoxianrui)) +- 增加列表选择组件(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 增加列表选择组件使用示例(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 增加defaultToolbar配置参数(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 表单弹窗支持drawer模式(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 表单项增加computed和watchEffect配置(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 支持switch属性修改(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 表单项增加文本类型支持(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 列表列增加show配置项(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 支持搜索表单显隐控制(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 支持input属性修改(author by [cshaptx4869](https://github.com/cshaptx4869)) +- search配置新增函数能力拓展(author by [xiudaozhe](https://github.com/xiudaozhe)) +- 表格新增列设置控制(author by [haoxianrui](https://github.com/haoxianrui)) +- 搜索添加展开和收缩(author by [haoxianrui](https://github.com/haoxianrui)) +- watch函数增加配置项参数返回(author by [cshaptx4869](https://github.com/cshaptx4869)) + +## ♻️ refactor +- 重构图标选择组件(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 重构列表选择组件默认样式 (author by [cshaptx4869](https://github.com/cshaptx4869)) +- 加强对话框表单组件和列表选择组件(author by [cshaptx4869](https://github.com/cshaptx4869)) +- routeMeta增加alwaysShow字段声明(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 分页组件增加溢出滚动效果(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 修正登录表单的Ref类型(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 点击表格刷新按钮不重置页码(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 筛选列超出一定高度滚动(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 优化加强initFn函数,表单项增加initFn函数(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 重构watch、computed、watchEffect调用(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 修改操作成功提示(author by [cshaptx4869](https://github.com/cshaptx4869)) +- PageSearch 改用card作为容器,样式改用unocss写法(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 优化首页 loading 动画效果author by [haoxianrui](https://github.com/haoxianrui)) + + +## 🐛 fix +- 路由是否始终显示不限制只有顶级目录才有的配置,开放至菜单 (author by [haoxianrui](https://github.com/haoxianrui)) +- sockjs-client 报错 global is not defined 导致开发环境无法打开 WebSocket 页面问题修复 (author by [haoxianrui](https://github.com/haoxianrui)) +- 发送用户重启密码功能,最少为6位字符(小于6位登陆时不允许的问题) (author by [dreamnyj](https://gitee.com/dreamnyj)) +- 修复系统设置面板滚动条问题(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 修复表单插槽失效问题(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 修改tagsview刷新丢失query问题(author by [xiudaozhe](https://github.com/xiudaozhe)) + +## 📦️ build +- 升级 NPM 包版本至最新 (author by [haoxianrui](https://github.com/haoxianrui)) + +## ⚙️ ci +- 规整脚本执行命令(author by [cshaptx4869](https://github.com/cshaptx4869)) + + +# 2.10.1 (2024/5/4) + +## ♻️ refactor +- 抽离CURD的使用部分代码为Hooks实现(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 修改CURD导入权限点标识名(author by [cshaptx4869](https://github.com/cshaptx4869)) +- cURD表单字段支持watch监听(author by [cshaptx4869](https://github.com/cshaptx4869)) +- cURD表单input支持number修饰(author by [cshaptx4869](https://github.com/cshaptx4869)) +- cURD表单组件支持checkbox多选框(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 优化axios响应数据TS类型提示(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 修改CURD表单组件自定义类型的attrs传值(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 同步重置密码按钮权限标识重命名(author by [haoxianrui](https://github.com/haoxianrui)) +- 重构API为静态方法实现模块化管理,并将types.ts重命名为model.ts用于存放接口模型定义(author by [haoxianrui](https://github.com/haoxianrui)) + + +## 🐛 fix +- sockjs-client 报错 global is not defined 导致开发环境无法打开 WebSocket 页面问题修复 (author by [haoxianrui](https://github.com/haoxianrui)) +- 主题颜色设置覆盖暗黑模式下el-table行激活的背景色问题修复 (author by [haoxianrui](https://github.com/haoxianrui)) +- 修复因API接口调整而影响的调用页面的问题 (author by [haoxianrui](https://github.com/haoxianrui)) + +## 📦️ build +- 升级 NPM 包版本至最新 (author by [haoxianrui](https://github.com/haoxianrui)) + + +# 2.10.0 (2024/4/26) +## ✨ feat +- 封装增删改查组件(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 集成 vite-plugin-vue-devtools 插件(author by [Tricker39](https://github.com/Tricker39)) +- 增加CURD配置化实现(author by [cshaptx4869](https://github.com/cshaptx4869)) + + +# 2.9.3 (2024/04/14) +## ✨ feat +- 增加vue文件代码片段(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 菜单 hover 背景色添加值全局SCSS变量进行控制(author by [haoxianrui](https://github.com/haoxianrui)) + +## ♻️ refactor +- 加强基础国际化(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 增加语言和布局大小枚举类型(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 增加侧边栏状态枚举类型(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 使用布局枚举替换字面量(author by [haoxianrui](https://github.com/haoxianrui)) +- 控制台使用静态数据循环渲染(author by [april](mailto:april@zen-game.cn)) +- 本地缓存的 token 变量重命名(author by [haoxianrui](https://github.com/haoxianrui)) +- 完善 Vite 环境变量类型声明(author by [haoxianrui](https://github.com/haoxianrui)) + +## 🐛 fix +- 修复构建时提示iconComponent.name可能为undefined的报错 (author by [wangji1042](https://github.com/wangji1042)) +- 修复浏览器密码自动填充时可能存在的报错 (author by [cshaptx4869](https://github.com/cshaptx4869)) +- 修复eslint报错(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 移动端下点击左侧菜单节点后关闭侧边栏(author by [haoxianrui](https://github.com/haoxianrui)) +- 添加 size 类型断言修复类型报错(author by [haoxianrui](https://github.com/haoxianrui)) + +## 📦️ build +- husky9.x版本适配 (author by [cshaptx4869](https://github.com/cshaptx4869)) +- 升级 npm 包版本至最新(author by [haoxianrui](https://github.com/haoxianrui)) + +# 2.9.2 (2024/03/05) +## ✨ feat +- vscode开发扩展推荐(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 完善基础增删改查Mock接口(author by [haoxianrui](https://github.com/haoxianrui)) + +## ♻️ refactor +- 修改login密码框功能实现(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 弱化页面进入动画效果(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 取消推荐TypeScript Vue Plugin (author by [cshaptx4869](https://github.com/cshaptx4869)) +- 网站加载动画替换 (author by [haoxianrui](https://github.com/haoxianrui)) +- 优化主题和主题色监听,避免多个页面重复初始化 (author by [haoxianrui](https://github.com/haoxianrui)) + +## 🐛 fix +- AppMain 高度在非固定头部不正确导致出现滚动条问题修复 (author by [haoxianrui](https://github.com/haoxianrui)) +- 修复混合模式开启固定Head时的样式问题 (author by [cshaptx4869](https://github.com/cshaptx4869)) +- 设置面板统一字体大小 (author by [cshaptx4869](https://github.com/cshaptx4869)) + +## 📦️build +- 通过env配置控制mock服务 (author by [cshaptx4869](https://github.com/cshaptx4869)) +- 升级依赖包至最新版本 (author by [haoxianrui](https://github.com/haoxianrui)) +- 定义vite全局常量替换项目标题和版本 (author by [cshaptx4869](https://github.com/cshaptx4869)) + +# 2.9.1 (2024/02/28) +## ♻️ refactor +- 项目配置按钮移入navbar(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 优化user数据定义(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 统一设置栏的 SVG 图标风格 + +## 🐛 fix +- 规整一些开发依赖(author by [cshaptx4869](https://github.com/cshaptx4869)) +- 修复登录页主题切换问题 (author by [cshaptx4869](https://github.com/cshaptx4869)) + +## 🚀 pref + +- 压缩图片资源 (author by [cshaptx4869](https://github.com/cshaptx4869)) + + +# 2.9.0 (2024/02/25) + +## ✨ feat +- 引入 animate.css 动画库 +- 新增水印和配置 +- 动态路由菜单支持 element plus 的图标 + +## ♻️ refactor +- Layout 布局重构和相关问题修复 +- sass 使用 @use 替代 @import 引入外部文件指令 + +## 🐛 fix +- 修复管理页面部分弹窗无法打开问题 +- 主题颜色设置按钮 hover 等未变化问题修复 + + +# 2.8.1 (2024/01/10) + +## ✨ feat +- 替换 Mock 解决方案 vite-plugin-mock 为 vite-plugin-mock-dev-server 适配 Vite5 + +# 2.8.0 (2023/12/27) + +## ⬆️ chore +- 升级 Vite4 至 Vite5 + +# 2.7.1 (2023/12/12) + +## ♻️ refactor +- 将打包后的文件进行分类 (author by [ityangzhiwen](https://gitee.com/ityangzhiwen)) + +# 2.7.0 (2023/11/19) + +## ♻️ refactor +- 代码重构优化 +- 修改自动导入组件类型声明文件路径 +- 完善 typescript 类型 + +## 🐛 fix +- 修复管理页面部分弹窗无法打开问题 + + +# 2.7.0 (2023/11/19) + +## ♻️ refactor +- 代码重构 +- 修改自动导入组件类型声明文件路径 +- 完善 typescript 类型 + +## 🐛 fix +- 修复管理页面部分弹窗无法打开问题 + + +# 2.6.3 (2023/10/22) + +## ✨ feat +- 菜单管理新增目录只有一级子路由是否始终显示(alwaysShow)和路由页面是否缓存(keepAlive)的配置 +- 接口文档新增 swagger、knife4j +- 引入和支持 tsx + +## ♻️ refactor +- 代码瘦身,整理并删除未使用的 svg +- 控制台样式优化 + +## 🐛 fix +- 菜单栏折叠和展开的图标暗黑模式显示问题修复 + + +# 2.6.2 (2023/10/11) + +## 🐛 fix +- 主题设置未持久化问题 +- UnoCSS 插件无智能提示 + +## ♻️ refactor +- WebSocket 演示样式和代码优化 +- 用户管理代码重构 + +# 2.6.1 (2023/9/4) + +## 🐛 fix +- 导航顶部模式、混合模式样式在固定 Header 出现的样式问题修复 +- 固定 Header 没有持久化问题修复 +- 字典回显兼容 String 和 Number 类型 + +# 2.6.0 (2023/8/24)💥💥💥 + +## ✨ feat +- 导航顶部模式、混合模式支持(author by [april-tong](https://april-tong.com/)) +- 平台文档(内嵌)(author by [april-tong](https://april-tong.com/)) + +# 2.5.0 (2023/8/8) + +## ✨ feat +- 新增 Mock(author by [ygcaicn](https://github.com/ygcaicn)) +- 图标 DEMO(author by [ygcaicn](https://github.com/ygcaicn)) + +## 🐛 fix +- 字典支持 Number 类型 + +# 2.4.1 (2023/7/20) + +## ✨ feat +- 整合 vite-plugin-compression 插件打包优化(3.66MB → 1.58MB) (author by [april-tong](https://april-tong.com/)) +- 字典组件封装(author by [haoxr](https://juejin.cn/user/4187394044331261/posts)) + +## 🐛 fix +- 分页组件hidden无效 +- 签名无法保存至后端 +- Git 提交 stylelint 校验部分机器报错 + +# 2.4.0 (2023/6/17) + +## ✨ feat +- 新增组件标签输入框(author by [april-tong](https://april-tong.com/)) +- 新增组件签名(author by [april-tong](https://april-tong.com/)) +- 新增组件表格(author by [april-tong](https://april-tong.com/)) +- Echarts 图表添加下载功能 author by [april-tong](https://april-tong.com/)) + +## ♻️ refactor +- 限制包管理器为 pnpm 和 node 版本16+ +- 自定义组件自动导入配置 +- 搜索框样式写法优化 + +## 🐛 fix +- 用户导入的部门回显成数字问题修复 + +## ⬆️ chore +- element-plus 版本升级 2.3.5 → 2.3.6 + +# 2.3.1 (2023/5/21) + +## 🔄 refactor +- 组件示例文件名称优化 + +# 2.2.2 (2023/5/11) + +## ✨ feat +- 组件封装示例添加源码地址 +- 角色、菜单、部门、字段按钮添加权限控制 + + +# 2.3.0 (2023/5/12) + +## ⬆️ chore +- vue 版本升级 3.2.45 → 3.3.1 ([CHANGELOG](https://github.com/vuejs/core/blob/main/CHANGELOG.md)) +- vite 版本升级 4.3.1 → 4.3.5 + +## ♻️ refactor +- 使用 vue 3.3 版本新特性 `defineOptions` 在 `setup` 定义组件名称,移除重复的 `script` 标签 + +# 2.2.2 (2023/5/11) + +## ✨ feat +- 用户新增提交添加 `vueUse` 的 `useDebounceFn` 函数实现按钮防抖节流 + + +# 2.2.1 (2023/4/25) + +## 🐛 fix +- 图标选择器组件使用 `onClickOutside` 未排除下拉弹出框元素导致无法输入搜索。 + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9825cba --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021-present 有来开源组织 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.en-US.md b/README.en-US.md new file mode 100644 index 0000000..921a9de --- /dev/null +++ b/README.en-US.md @@ -0,0 +1,222 @@ +
+ vue3-element-admin +

vue3-element-admin

+ + + + + + + + + + + 有来技术 + + + 有来技术 + + + 有来技术 + + +
+ +![](https://foruda.gitee.com/images/1708618984641188532/a7cca095_716974.png "rainbow.png") + + +
+ 🖥️ Live Preview | 📲 Mobile Preview | 📑 Documentation| 🌐 Official Website | 💬 中文 +
+ + +## Introduction + +[vue3-element-admin](https://gitcode.com/youlai/vue3-element-admin) is a minimalist enterprise-level backend management frontend template built with Vue3, Vite, TypeScript, and Element-Plus. It comes with complementary Java backend [youlai-boot](https://gitee.com/youlaiorg/youlai-boot) and Node backend [youlai-nest](https://gitee.com/youlaiorg/youlai-nest). A simplified version [vue3-element-template](https://gitee.com/youlaiorg/vue3-element-template) and a JavaScript version [vue3-element-admin-js](https://gitee.com/youlaiorg/vue3-element-admin) are also available for developers to quickly start development. + + +## Project Features + +- **Simple and Easy-to-use**: Upgraded version of [vue-element-admin](https://gitee.com/panjiachen/vue-element-admin) for Vue3, with minimal encapsulation and easy to get started. +- **Data Interaction**: Support for `Mock` data and [online API documentation](https://www.apifox.cn/apidoc/shared-195e783f-4d85-4235-a038-eec696de4ea5), with accompanying [Java](https://gitee.com/youlaiorg/youlai-boot) and [Node](https://gitee.com/youlaiorg/youlai-nest) backend source code. + +- **System Functions**: Provides user management, role management, menu management, department management, dictionary management, and other functional modules. +- **Permission Management**: Supports dynamic routing, button permissions, role permissions, and data permissions. + +- **Infrastructure**: Provides internationalization, multiple layouts, dark mode, full screen, watermark, API documentation, and code generator functionality. +- **Continuous Updates**: Project is continuously updated with real-time updates of tools and dependencies. + + +## Project Screenshots + +🖥️ **Dashboard** + +![](https://www.youlai.tech/storage/blog/2025/04/30/20250430085342.png) + +⚡**API Documentation** + +![](https://www.youlai.tech/storage/blog/2025/01/18/20250118183539.png) + +📲 **Mobile Version** + +![](https://www.youlai.tech/storage/blog/2025/04/30/app.jpg) + +## Project Source Code + +| Project | Gitee | Github | GitCode| +| ---- | ----| ---- | ---- | +| vue3-element-admin ✅| [vue3-element-admin](https://gitee.com/youlaiorg/vue3-element-admin) | [vue3-element-admin](https://github.com/youlaitech/vue3-element-admin) | [vue3-element-admin](https://gitcode.com/youlai/vue3-element-admin) | +| vue3-element-admin JS Version| [vue3-element-admin-js](https://gitee.com/youlaiorg/vue3-element-admin-js) | [vue3-element-admin-js](https://github.com/youlaitech/vue3-element-admin-js) | [vue3-element-admin-js](https://gitcode.com/youlai/vue3-element-admin-js) | +| vue3-element-admin Lite Version | [vue3-element-template](https://gitee.com/youlaiorg/vue3-element-template) | [vue3-element-template](https://github.com/youlaitech/vue3-element-template) |[vue3-element-template](https://gitcode.com/youlai/vue3-element-template)| +| vue-uniapp-admin Mobile Version | [vue-uniapp-admin](https://gitee.com/youlaiorg/vue-uniapp-admin) | [vue-uniapp-admin](https://github.com/youlaitech/vue-uniapp-admin) |[vue-uniapp-admin](https://gitcode.com/youlai/vue-uniapp-admin)| +| Java Backend | [youlai-boot](https://gitee.com/youlaiorg/youlai-boot) | [youlai-boot](https://github.com/haoxianrui/youlai-boot.git) |[youlai-boot](https://gitcode.com/youlai/youlai-boot.git)| +| Node Backend | [youlai-nest](https://gitee.com/youlaiorg/youlai-nest) | [youlai-nest](https://github.com/haoxianrui/youlai-nest.git) |[youlai-nest](https://gitcode.com/youlai/youlai-nest.git)| + + + +## Development Guide + +| Name | Link | +|---------------|--------------------| +| Video Tutorial | [https://www.bilibili.com/video/BV1eFUuYyEFj](https://www.bilibili.com/video/BV1eFUuYyEFj) | +| Project Setup | [Building a Backend Management System from Scratch with Vue3, Vite, TypeScript, and Element-Plus](https://blog.csdn.net/u013737132/article/details/130191394) | +| Official Documentation | [https://www.youlai.tech/vue3-element-admin/](https://www.youlai.tech/vue3-element-admin/) | +| Code Standards | [ESLint V9 + Prettier + Stylelint + EditorConfig for Standardized and Unified Frontend Code Style](https://youlai.blog.csdn.net/article/details/145608723) | +| Commit Standards | [Husky + Lint-staged + Commitlint + Commitizen + cz-git for Git Commit Standards](https://youlai.blog.csdn.net/article/details/145615236) | +| API Documentation | [https://www.apifox.cn/apidoc/shared-195e783f-4d85-4235-a038-eec696de4ea5](https://www.apifox.cn/apidoc/shared-195e783f-4d85-4235-a038-eec696de4ea5) | + + + +## Project Setup + + +- **Environment Preparation** + +| Environment Type | Name | +|----------------|-----------------------------| +| **Development Tool** | [Visual Studio Code](https://code.visualstudio.com/Download) | +| **Runtime Environment** | Node 18 + (Recommended [22.9.0](https://npmmirror.com/mirrors/node/v22.9.0/)) | +> ⚠️ Note: Node.js version 20.6.0 has compatibility issues, please don't use it + + +- **Quick Start** + +```bash +# Clone repository +git clone https://gitee.com/youlaiorg/vue3-element-admin.git + +# Change directory +cd vue3-element-admin + +# Install pnpm +npm install pnpm -g + +# Set mirror source (optional) +pnpm config set registry https://registry.npmmirror.com + +# Install dependencies +pnpm install + +# Start development server +pnpm run dev +``` + + +## Project Deployment + +After executing the `pnpm run build` command, the project will be bundled and a `dist` directory will be generated. Next, upload the files from the `dist` directory to the `/usr/share/nginx/html` directory on your server and configure Nginx for reverse proxy. + +```bash +pnpm run build +``` + +Here is an example Nginx configuration: + +```nginx +server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + # Reverse proxy configuration + location /prod-api/ { + # Please replace api.youlai.tech with your backend API address, and keep the trailing slash / + proxy_pass http://api.youlai.tech/; + } +} +``` + +For more detailed information, please refer to this article: [Nginx Installation and Configuration](https://blog.csdn.net/u013737132/article/details/145667694). + +## Local Mock + +The project supports both online and local Mock interfaces. By default, it uses online interfaces. To switch to Mock interfaces, modify the `VITE_MOCK_DEV_SERVER` value in the `.env.development` file to `true`. + +## Backend API + +> If you have a basic understanding of Java development, follow these steps to convert online API to local backend API and create an enterprise-level full-stack development environment to help you on your full-stack journey. + +1. Get the backend source code based on `Java` and `SpringBoot` from [youlai-boot](https://gitee.com/youlaiorg/youlai-boot.git). +2. Follow the instructions in the backend project's README.md to [set up and run locally](https://gitee.com/youlaiorg/youlai-boot#%E9%A1%B9%E7%9B%AE%E8%BF%90%E8%A1%8C). +3. Modify the value of `VITE_APP_API_URL` in the `.env.development` file, changing it from https://api.youlai.tech to http://localhost:8989. + + +## Notes + +- **Auto import plugin is disabled by default** + + Component type declarations have been automatically generated for the template project. If you add and use new components, follow the instructions in the screenshot to enable automatic generation. After automatic generation is complete, remember to set it back to `false` to avoid conflicts. + + ![](https://foruda.gitee.com/images/1687755823137387608/412ea803_716974.png) + +- **Blank page when accessing the project** + + Try upgrading your browser, as older browser engines may not support certain new JavaScript syntax, such as optional chaining operator `?.`. + +- **Project synchronization with repository updates** + + After synchronizing the project with repository updates, it is recommended to run `pnpm install` to update dependencies before starting. + +- **Red highlight on project components, functions, and imports** + + Restart VSCode to try again. + +- **Other issues** + + If you have any other issues or suggestions, please open an [ISSUE](https://gitee.com/youlaiorg/vue3-element-admin/issues/new). + + +## Commit Conventions + +Execute `pnpm run commit` to invoke interactive git commit and complete the information input and selection according to the prompts. + +![](https://foruda.gitee.com/images/1687755823165218215/c1705416_716974.png) + + +## Project Statistics + +![](https://repobeats.axiom.co/api/embed/aa7cca3d6fa9c308fc659fa6e09af9a1910506c3.svg "Repobeats analytics image") + + +Thanks to all the contributors! + +[![contributors](https://contrib.rocks/image?repo=youlaitech/vue3-element-admin)](https://github.com/youlaitech/vue3-element-admin/graphs/contributors) + + +## Special Thanks + +- Thanks to the [GitCode](https://gitcode.com/) official [G-Star](https://gitcode.com/g-star) certification + ![](https://foruda.gitee.com/images/1728577513089814203/95f2a70d_716974.jpeg) + +## Community + +① Follow the "Youlai Tech" WeChat Official Account, click the **Group Chat** menu to get the QR code (this measure is taken to prevent ads from entering the group, thanks for your understanding and support). + +② Directly add WeChat **`haoxianrui`** with a note indicating "Frontend/Backend/Full Stack". + +![Youlai Tech WeChat Official Account](https://foruda.gitee.com/images/1737108820762592766/3390ed0d_716974.png) + diff --git a/README.md b/README.md new file mode 100644 index 0000000..e65f220 --- /dev/null +++ b/README.md @@ -0,0 +1,221 @@ +
+ vue3-element-admin +

vue3-element-admin

+ + + + + +
+ + + + + 有来技术 + + + 有来技术 + + + 有来技术 + + +
+ +![](https://foruda.gitee.com/images/1708618984641188532/a7cca095_716974.png "rainbow.png") + + +
+ 🖥️ 在线预览 | 📲 移动端预览 | 📑 阅读文档| 🌐 官网 | 💬 English +
+ + +## 项目简介 + +[vue3-element-admin](https://gitcode.com/youlai/vue3-element-admin) 基于 Vue3、Vite、TypeScript 和 Element-Plus 搭建的极简开箱即用企业级后台管理前端模板。 配套 Java 后端 [youlai-boot](https://gitee.com/youlaiorg/youlai-boot) 和 Node 后端 [youlai-nest](https://gitee.com/youlaiorg/youlai-nest) 。 提供开发简版[vue3-element-template](https://gitee.com/youlaiorg/vue3-element-template) 和 JS 版本[vue3-element-admin-js](https://gitee.com/youlaiorg/vue3-element-admin) 供开发者快速开发。 + + +## 项目特色 + +- **简洁易用**:基于 [vue-element-admin](https://gitee.com/panjiachen/vue-element-admin) 升级的 Vue3 版本,无过渡封装 ,易上手。 +- **数据交互**: 支持 `Mock` 数据和[线上接口文档](https://www.apifox.cn/apidoc/shared-195e783f-4d85-4235-a038-eec696de4ea5),并提供配套的 [Java](https://gitee.com/youlaiorg/youlai-boot) 和 [Node](https://gitee.com/youlaiorg/youlai-nest) 后端源码。 + +- **系统功能:** 提供用户管理、角色管理、菜单管理、部门管理、字典管理等功能模块。 +- **权限管理:** 支持动态路由、按钮权限、角色权限和数据权限等多种权限管理方式。 + +- **基础设施:** 提供国际化、多布局、暗黑模式、全屏、水印、接口文档和代码生成器等功能。 +- **持续更新**:项目持续开源更新,实时更新工具和依赖。 + + +## 项目截图 + +🖥️ **控制台** + +![](https://www.youlai.tech/storage/blog/2025/04/30/20250430085342.png) + +⚡**接口文档** + +![](https://www.youlai.tech/storage/blog/2025/01/18/20250118183539.png) + +📲 **移动端** + +![](https://www.youlai.tech/storage/blog/2025/04/30/app.jpg) + +## 项目源码 + +| 项目 | Gitee | Github | GitCode| +| ---- | ----| ---- | ---- | +| vue3-element-admin ✅| [vue3-element-admin](https://gitee.com/youlaiorg/vue3-element-admin) | [vue3-element-admin](https://github.com/youlaitech/vue3-element-admin) | [vue3-element-admin](https://gitcode.com/youlai/vue3-element-admin) | +| vue3-element-admin JS版| [vue3-element-admin-js](https://gitee.com/youlaiorg/vue3-element-admin-js) | [vue3-element-admin-js](https://github.com/youlaitech/vue3-element-admin-js) | [vue3-element-admin-js](https://gitcode.com/youlai/vue3-element-admin-js) | +| vue3-element-admin 精简版 | [vue3-element-template](https://gitee.com/youlaiorg/vue3-element-template) | [vue3-element-template](https://github.com/youlaitech/vue3-element-template) |[vue3-element-template](https://gitcode.com/youlai/vue3-element-template)| +| vue-uniapp-admin 移动版 | [vue-uniapp-admin](https://gitee.com/youlaiorg/vue-uniapp-admin) | [vue-uniapp-admin](https://github.com/youlaitech/vue-uniapp-admin) |[vue-uniapp-admin](https://gitcode.com/youlai/vue-uniapp-admin)| +| Java 后端 | [youlai-boot](https://gitee.com/youlaiorg/youlai-boot) | [youlai-boot](https://github.com/haoxianrui/youlai-boot.git) |[youlai-boot](https://gitcode.com/youlai/youlai-boot.git)| +| Node 后端 | [youlai-nest](https://gitee.com/youlaiorg/youlai-nest) | [youlai-nest](https://github.com/haoxianrui/youlai-nest.git) |[youlai-nest](https://gitcode.com/youlai/youlai-nest.git)| + + + +## 开发指南 + +| 名称 | 地址 | +|---------------|--------------------| +| 视频教程 | [https://www.bilibili.com/video/BV1eFUuYyEFj](https://www.bilibili.com/video/BV1eFUuYyEFj) | +| 项目搭建 | [基于 Vue3 + Vite + TypeScript + Element-Plus 从0到1搭建后台管理系统](https://blog.csdn.net/u013737132/article/details/130191394) | +| 官方文档 | [https://www.youlai.tech/vue3-element-admin/](https://www.youlai.tech/vue3-element-admin/) | +| 代码规范 | [ESLint V9 + Prettier + Stylelint + EditorConfig 约束和统一前端代码规范](https://youlai.blog.csdn.net/article/details/145608723) | +| 提交规范 | [Husky + Lint-staged + Commitlint + Commitizen + cz-git 配置 Git 提交规范](https://youlai.blog.csdn.net/article/details/145615236) | +| 接口文档 | [https://www.apifox.cn/apidoc/shared-195e783f-4d85-4235-a038-eec696de4ea5](https://www.apifox.cn/apidoc/shared-195e783f-4d85-4235-a038-eec696de4ea5) | + + + +## 项目启动 + + +- **环境准备** + +| 环境类型 | 名称 | +|----------------|-----------------------------| +| **开发工具** | [Visual Studio Code](https://code.visualstudio.com/Download) | +| **运行环境** | Node 18 + (推荐[22.9.0](https://npmmirror.com/mirrors/node/v22.9.0/)) | +> ⚠️ 注意:Node.js 20.6.0版本存在兼容性问题,请勿使用 + + +- **快速开始** + +```bash +# 克隆代码 +git clone https://gitee.com/youlaiorg/vue3-element-admin.git + +# 切换目录 +cd vue3-element-admin + +# 安装 pnpm +npm install pnpm -g + +# 设置镜像源(可忽略) +pnpm config set registry https://registry.npmmirror.com + +# 安装依赖 +pnpm install + +# 启动运行 +pnpm run dev +``` + + +## 项目部署 + +执行 `pnpm run build` 命令后,项目将被打包并生成 `dist` 目录。接下来,将 `dist` 目录下的文件上传到服务器 `/usr/share/nginx/html` 目录下,并配置 Nginx 进行反向代理。 + +```bash +pnpm run build +``` + +以下是 Nginx 的配置示例: + +```nginx +server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + # 反向代理配置 + location /prod-api/ { + # 请将 api.youlai.tech 替换为您的后端 API 地址,并注意保留后面的斜杠 / + proxy_pass http://api.youlai.tech/; + } +} +``` + +更多详细信息,请参考这篇文章:[Nginx 安装和配置](https://blog.csdn.net/u013737132/article/details/145667694)。 + +## 本地Mock + +项目同时支持在线和本地 Mock 接口,默认使用线上接口,如需替换为 Mock 接口,修改文件 `.env.development` 的 `VITE_MOCK_DEV_SERVER` 为 `true` **即可**。 + +## 后端接口 + +> 如果您具备Java开发基础,按照以下步骤将在线接口转为本地后端接口,创建企业级前后端分离开发环境,助您走向全栈之路。 + +1. 获取基于 `Java` 和 `SpringBoot` 开发的后端 [youlai-boot](https://gitee.com/youlaiorg/youlai-boot.git) 源码。 +2. 根据后端工程的说明文档 [README.md](https://gitee.com/youlaiorg/youlai-boot#%E9%A1%B9%E7%9B%AE%E8%BF%90%E8%A1%8C) 完成本地启动。 +3. 修改 `.env.development` 文件中的 `VITE_APP_API_URL` 的值,将其从 https://api.youlai.tech 更改为 http://localhost:8989 即可。 + + +## 注意事项 + +- **自动导入插件自动生成默认关闭** + + 模板项目的组件类型声明已自动生成。如果添加和使用新的组件,请按照图示方法开启自动生成。在自动生成完成后,记得将其设置为 `false`,避免重复执行引发冲突。 + + ![](https://foruda.gitee.com/images/1687755823137387608/412ea803_716974.png) + +- **项目启动浏览器访问空白** + + 请升级浏览器尝试,低版本浏览器内核可能不支持某些新的 JavaScript 语法,比如可选链操作符 `?.`。 + +- **项目同步仓库更新升级** + + 项目同步仓库更新升级之后,建议 `pnpm install` 安装更新依赖之后启动 。 + +- **项目组件、函数和引用爆红** + + 重启 VSCode 尝试 + +- **其他问题** + + 如果有其他问题或者建议,建议 [ISSUE](https://gitee.com/youlaiorg/vue3-element-admin/issues/new) + + +## 提交规范 + +执行 `pnpm run commit` 唤起 git commit 交互,根据提示完成信息的输入和选择。 + +![](https://foruda.gitee.com/images/1687755823165218215/c1705416_716974.png) + + +## 项目统计 + +![](https://repobeats.axiom.co/api/embed/aa7cca3d6fa9c308fc659fa6e09af9a1910506c3.svg "Repobeats analytics image") + + +Thanks to all the contributors! + +[![contributors](https://contrib.rocks/image?repo=youlaitech/vue3-element-admin)](https://github.com/youlaitech/vue3-element-admin/graphs/contributors) + + +## 特别感谢 + +- 感谢 [GitCode](https://gitcode.com/) 官方的 [G-Star](https://gitcode.com/g-star) 认证 + ![](https://foruda.gitee.com/images/1728577513089814203/95f2a70d_716974.jpeg) + +## 加群交流 + +① 关注「有来技术」公众号,点击菜单 **交流群** 获取加群二维码(此举防止广告进群,感谢理解和支持)。 + +② 直接添加微信 **`haoxianrui`** 备注「前端/后端/全栈」。 + +![有来技术公众号](https://foruda.gitee.com/images/1737108820762592766/3390ed0d_716974.png) diff --git a/commitlint.config.cjs b/commitlint.config.cjs new file mode 100644 index 0000000..5f556e2 --- /dev/null +++ b/commitlint.config.cjs @@ -0,0 +1,93 @@ +module.exports = { + // 继承的规则 + extends: ["@commitlint/config-conventional"], + // 自定义规则 + rules: { + // @see https://commitlint.js.org/#/reference-rules + + // 提交类型枚举,git提交type必须是以下类型 + "type-enum": [ + 2, + "always", + [ + "feat", // 新增功能 + "fix", // 修复缺陷 + "docs", // 文档变更 + "style", // 代码格式(不影响功能,例如空格、分号等格式修正) + "refactor", // 代码重构(不包括 bug 修复、功能新增) + "perf", // 性能优化 + "test", // 添加疏漏测试或已有测试改动 + "build", // 构建流程、外部依赖变更(如升级 npm 包、修改 webpack 配置等) + "ci", // 修改 CI 配置、脚本 + "revert", // 回滚 commit + "chore", // 对构建过程或辅助工具和库的更改(不影响源文件、测试用例) + "wip", // 对构建过程或辅助工具和库的更改(不影响源文件、测试用例) + ], + ], + "subject-case": [0], // subject大小写不做校验 + }, + + prompt: { + messages: { + type: "选择你要提交的类型 :", + scope: "选择一个提交范围(可选):", + customScope: "请输入自定义的提交范围 :", + subject: "填写简短精炼的变更描述 :\n", + body: '填写更加详细的变更描述(可选)。使用 "|" 换行 :\n', + breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行 :\n', + footerPrefixesSelect: "选择关联issue前缀(可选):", + customFooterPrefix: "输入自定义issue前缀 :", + footer: "列举关联issue (可选) 例如: #31, #I3244 :\n", + generatingByAI: "正在通过 AI 生成你的提交简短描述...", + generatedSelectByAI: "选择一个 AI 生成的简短描述:", + confirmCommit: "是否提交或修改commit ?", + }, + // prettier-ignore + types: [ + { value: "feat", name: "特性: ✨ 新增功能", emoji: ":sparkles:" }, + { value: "fix", name: "修复: 🐛 修复缺陷", emoji: ":bug:" }, + { value: "docs", name: "文档: 📝 文档变更(更新README文件,或者注释)", emoji: ":memo:" }, + { value: "style", name: "格式: 🌈 代码格式(空格、格式化、缺失的分号等)", emoji: ":lipstick:" }, + { value: "refactor", name: "重构: 🔄 代码重构(不修复错误也不添加特性的代码更改)", emoji: ":recycle:" }, + { value: "perf", name: "性能: 🚀 性能优化", emoji: ":zap:" }, + { value: "test", name: "测试: 🧪 添加疏漏测试或已有测试改动", emoji: ":white_check_mark:"}, + { value: "build", name: "构建: 📦️ 构建流程、外部依赖变更(如升级 npm 包、修改 vite 配置等)", emoji: ":package:"}, + { value: "ci", name: "集成: ⚙️ 修改 CI 配置、脚本", emoji: ":ferris_wheel:"}, + { value: "revert", name: "回退: ↩️ 回滚 commit",emoji: ":rewind:"}, + { value: "chore", name: "其他: 🛠️ 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)", emoji: ":hammer:"}, + { value: "wip", name: "开发中: 🚧 开发阶段临时提交", emoji: ":construction:"}, + ], + useEmoji: true, + emojiAlign: "center", + useAI: false, + aiNumber: 1, + themeColorCode: "", + scopes: [], + allowCustomScopes: true, + allowEmptyScopes: true, + customScopesAlign: "bottom", + customScopesAlias: "custom", + emptyScopesAlias: "empty", + upperCaseSubject: false, + markBreakingChangeMode: false, + allowBreakingChanges: ["feat", "fix"], + breaklineNumber: 100, + breaklineChar: "|", + skipQuestions: [], + issuePrefixes: [{ value: "closed", name: "closed: ISSUES has been processed" }], + customIssuePrefixAlign: "top", + emptyIssuePrefixAlias: "skip", + customIssuePrefixAlias: "custom", + allowCustomIssuePrefix: true, + allowEmptyIssuePrefix: true, + confirmColorize: true, + maxHeaderLength: Infinity, + maxSubjectLength: Infinity, + minSubjectLength: 0, + scopeOverrides: undefined, + defaultBody: "", + defaultIssues: "", + defaultScope: "", + defaultSubject: "", + }, +}; diff --git a/eslint.config.ts b/eslint.config.ts new file mode 100644 index 0000000..7e3fb4c --- /dev/null +++ b/eslint.config.ts @@ -0,0 +1,216 @@ +// https://eslint.org/docs/latest/use/configure/configuration-files-new + +import eslint from "@eslint/js"; +import pluginVue from "eslint-plugin-vue"; +import * as typescriptEslint from "typescript-eslint"; +import vueParser from "vue-eslint-parser"; +import globals from "globals"; +import configPrettier from "eslint-config-prettier"; + +// 解析自动导入配置 +import fs from "node:fs"; +let autoImportGlobals = {}; +try { + autoImportGlobals = + JSON.parse(fs.readFileSync("./.eslintrc-auto-import.json", "utf-8")).globals || {}; +} catch (error) { + // 文件不存在或解析错误时使用空对象 + console.warn("Could not load auto-import globals", error); +} + +// Element Plus组件 +const elementPlusComponents = { + // Element Plus 组件添加为全局变量,避免 no-undef 报错 + ElInput: "readonly", + ElSelect: "readonly", + ElSwitch: "readonly", + ElCascader: "readonly", + ElInputNumber: "readonly", + ElTimePicker: "readonly", + ElTimeSelect: "readonly", + ElDatePicker: "readonly", + ElTreeSelect: "readonly", + ElText: "readonly", + ElRadioGroup: "readonly", + ElCheckboxGroup: "readonly", + ElOption: "readonly", + ElRadio: "readonly", + ElCheckbox: "readonly", + ElInputTag: "readonly", + ElForm: "readonly", + ElFormItem: "readonly", + ElTable: "readonly", + ElTableColumn: "readonly", + ElButton: "readonly", + ElDialog: "readonly", + ElPagination: "readonly", + ElMessage: "readonly", + ElMessageBox: "readonly", + ElNotification: "readonly", + ElTree: "readonly", +}; + +export default [ + // 忽略文件配置 + { + ignores: [ + "**/node_modules/**", + "**/dist/**", + "**/*.min.*", + "**/auto-imports.d.ts", + "**/components.d.ts", + ], + }, + + // 基础 JavaScript 配置 + eslint.configs.recommended, + + // Vue 推荐配置 + ...pluginVue.configs["flat/recommended"], + + // TypeScript 推荐配置 + ...typescriptEslint.configs.recommended, + + // 全局配置 + { + // 指定要检查的文件 + files: ["**/*.{js,mjs,cjs,ts,mts,cts,vue}"], + languageOptions: { + ecmaVersion: "latest", + sourceType: "module", + globals: { + ...globals.browser, // 浏览器环境全局变量 + ...globals.node, // Node.js 环境全局变量 + ...globals.es2022, // ES2022 全局对象 + ...autoImportGlobals, // 自动导入的 API 函数 + ...elementPlusComponents, // Element Plus 组件 + // 全局类型定义,解决 TypeScript 中定义但 ESLint 不识别的问题 + PageQuery: "readonly", + PageResult: "readonly", + OptionType: "readonly", + ApiResponse: "readonly", + ExcelResult: "readonly", + TagView: "readonly", + AppSettings: "readonly", + __APP_INFO__: "readonly", + }, + }, + plugins: { + vue: pluginVue, + "@typescript-eslint": typescriptEslint.plugin, + }, + rules: { + // 基础规则 + "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", + "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", + + // ES6+ 规则 + "prefer-const": "error", + "no-var": "error", + "object-shorthand": "error", + + // 最佳实践 + eqeqeq: "off", + "no-multi-spaces": "error", + "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }], + + // 禁用与 TypeScript 冲突的规则 + "no-unused-vars": "off", + "no-undef": "off", + "no-redeclare": "off", + "@typescript-eslint/ban-ts-comment": "off", + }, + }, + + // Vue 文件特定配置 + { + files: ["**/*.vue"], + languageOptions: { + parser: vueParser, + parserOptions: { + ecmaVersion: "latest", + sourceType: "module", + parser: typescriptEslint.parser, + extraFileExtensions: [".vue"], + }, + }, + rules: { + // Vue 规则 + "vue/multi-word-component-names": "off", + "vue/no-v-html": "off", + "vue/require-default-prop": "off", + "vue/require-explicit-emits": "error", + "vue/no-unused-vars": "error", + "vue/no-mutating-props": "off", + "vue/valid-v-for": "warn", + "vue/no-template-shadow": "warn", + "vue/return-in-computed-property": "warn", + "vue/block-order": [ + "error", + { + order: ["template", "script", "style"], + }, + ], + "vue/html-self-closing": [ + "error", + { + html: { + void: "always", + normal: "never", + component: "always", + }, + svg: "always", + math: "always", + }, + ], + "vue/component-name-in-template-casing": ["error", "PascalCase"], + "@typescript-eslint/no-explicit-any": "off", + }, + }, + + // TypeScript 文件特定配置 + { + files: ["**/*.{ts,tsx,mts,cts}"], + languageOptions: { + parser: typescriptEslint.parser, + parserOptions: { + project: true, + tsconfigRootDir: import.meta.dirname, + }, + }, + rules: { + // TypeScript 规则 + "@typescript-eslint/no-explicit-any": "off", // 允许使用any类型,方便开发 + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-empty-object-type": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-unused-vars": "warn", // 降级为警告 + "@typescript-eslint/no-unused-expressions": "warn", // 降级为警告 + "@typescript-eslint/consistent-type-imports": "off", // 关闭强制使用type import + "@typescript-eslint/no-import-type-side-effects": "error", + }, + }, + + // .d.ts 文件配置 + { + files: ["**/*.d.ts"], + rules: { + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": "off", + }, + }, + + // CURD 组件配置 + { + files: ["**/components/CURD/**/*.{ts,vue}"], + rules: { + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-explicit-any": "off", + }, + }, + + // Prettier 集成(必须放在最后) + configPrettier, +]; diff --git a/index.html b/index.html new file mode 100644 index 0000000..1c086a7 --- /dev/null +++ b/index.html @@ -0,0 +1,93 @@ + + + + + + + + + vue3-element-admin + + + +
+
+
+
+
+
+
+
+
+ + + + + diff --git a/licenses/vue-element-admin/LICENSE b/licenses/vue-element-admin/LICENSE new file mode 100644 index 0000000..3fce384 --- /dev/null +++ b/licenses/vue-element-admin/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017-present PanJiaChen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/licenses/vue3-element-admin/LICENSE b/licenses/vue3-element-admin/LICENSE new file mode 100644 index 0000000..9825cba --- /dev/null +++ b/licenses/vue3-element-admin/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021-present 有来开源组织 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/mock/auth.mock.ts b/mock/auth.mock.ts new file mode 100644 index 0000000..153142c --- /dev/null +++ b/mock/auth.mock.ts @@ -0,0 +1,44 @@ +import { defineMock } from "./base"; + +export default defineMock([ + { + url: "auth/captcha", + method: ["GET"], + body: { + code: "00000", + data: { + captchaKey: "534b8ef2b0a24121bec76391ddd159f9", + captchaBase64: + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAkCAIAAADNSmkJAAAFKUlEQVR4Xu2ZXUwcVRiGV70wMWo08V5NvPXCrDbFaGpMaZW2hqQxaoiJTRsaMBCNSYtpa2JTKiFSelFa+Q/QZcMWqEhBlh+htbEpZhMrBQrlJ0hBywLLyrJ0WZbje3bqOvPNLHPWrDvdOE9ONmfe78zkzMs335wzWJhJQrBQweS/wTQ6QWgYHdoIOcecOe05O+t2WkutO+p2ZF3Ksg/YV9ZW6FATYajR3nveg60H9327r3O8c35lHgp+r05dPdJzBL73TPSQ8SaCKIxGLsPlop+K0JHrEkPuoT31e5qGmmjARACF0agYyGVNlyVm/pzZXrN9fHGcBkz0UBid+31u93i3XFFT80vN8cvHqWqih8Lo1NpUqS5vwh3vnd223VQ10UNh9NbyrcFQUK6oCawHUipSqGqiB83oBf+CXFGDMp1mS6OqiR4Ko7FexkpOrqhpHGw82nOUqiZ6KIzGrkRuorW0dJMmOy+hOCfYGzb2RBFv6HRO0gEJw/U7y+pgL1bwmTxexN6sZ31TdEwEhdG+gA+7EqyXpUO1uZH20cWL8hMTRt1N9tBXzCJrOIRoCPJpSO2RAp4HmtCdIfZ+2JWgEBN9LbR28seTGU0Zue1tMLp+YIAMSADzfvbkKX4/eb28j4YODiGin3heqmIlLja5hAUCu+nmGY3JWKvpMAlqNGgebsauBOvlqSX+JEx7p7EbTLen53XlzfmWUioqXikrc68Y8N2juJ/fyVsNChGHEE//rBANYWaZz+TRQqpLaBgNsPfDrgSpbS21YtV87IdjrlkX9JZbt5DOma2t9ITo5F+5glN22WwL/n+yDv00mw06orKxOqQ5+J04hhViwzAXETIcJDVm8uxZqktoGx2Nj9t43Wgaul/ERQiGQvtbWnDWgZYW9CXlQFjZ/7ciyHNn+Z2MexTimIeLz59TiIln0M1e+IbPpOAaDUnEYPTi6iqKxpbycs/qKo1tCslfKcffPn9enuMiPPY1vxO/ckeFQ4h46cdGqUWoidE/y54q5tPY5WDrGzQqIXot4BgchEE57e00IMCw2/1qZSVO/7SjA78o9INzcxsbrL+fnTnDDh9mmZn8F30oG1Hm+nABv5mQMopDS/h1HxtqTzWbABMe9sxpPoe9zezeOo1GELqWhPS8t46M0IAYHbdvR1aHbaOjbjfLz2eFhez6dba4yAfgF30o0BFVE8+Mjh/wFxPI+I5mAEHU6Ls+38vhTFwOBGhMDF8gkFpbC5ffsdv/uBs6dIj19dExEtARVXv9YNbop8NFY3aZ6gRRo+tu3IBHnzmdNCBMXldXJKPfL74WzWUJRE+coDUknqsOdZXQbAJYwluVTbOZI3Qt8GFzMwxyjo3RgBiN4fr+elXVpZGRLWXl6PdOTtJBSlBDUK/lnIrjOlrtqWYTQDJaF6FrTXu9sOa1ysrVoM5HVE1GFxZQcyJ/p+xzv6K/rbr6N6+XDpUBl0tKFIrbz78qWB6YnWFMCBld4XLBms+7df75ook/GNzb0GCV7U1Qfz9p64TyQWNjYD3qe9rj4SMJtQP3MyjSDPzWIRHPjH7X4YAvfXoPuyZf9Pbi3PcuXIh4mp3NllYC6XY79C+jl2o8PBipxjnBttn4MgMNnWgfcRJGPI2OL8hTj3LloIlmRicvBhiNykvecpqoa3RSY4DRcLAwyicuOepVR1JjgNFYHWONHL04czTX0UmNAUYD7Pr+xc4wqTHGaBb2OtZvHUmNYUazcA2J6etdUmOk0f8rTKMTxF91RG0D1SwYGwAAAABJRU5ErkJggg==", + }, + msg: "一切ok", + }, + }, + + { + url: "auth/login", + method: ["POST"], + body: { + code: "00000", + data: { + accessToken: + "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImRlcHRJZCI6MSwiZGF0YVNjb3BlIjoxLCJ1c2VySWQiOjIsImlhdCI6MTcyODE5MzA1MiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9BRE1JTiJdLCJqdGkiOiJhZDg3NzlhZDZlYWY0OWY3OTE4M2ZmYmI5OWM4MjExMSJ9.58YHwL3sNNC22jyAmOZeSm-7MITzfHb_epBIz7LvWeA", + tokenType: "Bearer", + refreshToken: + "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImRlcHRJZCI6MSwiZGF0YVNjb3BlIjoxLCJ1c2VySWQiOjIsImlhdCI6MTcyODE5MzA1MiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9BRE1JTiJdLCJqdGkiOiJhZDg3NzlhZDZlYWY0OWY3OTE4M2ZmYmI5OWM4MjExMSJ9.58YHwL3sNNC22jyAmOZeSm-7MITzfHb_epBIz7LvWeA", + expires: null, + }, + msg: "一切ok", + }, + }, + + { + url: "auth/logout", + method: ["DELETE"], + body: { + code: "00000", + data: {}, + msg: "string", + }, + }, +]); diff --git a/mock/base.ts b/mock/base.ts new file mode 100644 index 0000000..e68e642 --- /dev/null +++ b/mock/base.ts @@ -0,0 +1,7 @@ +import path from "path"; +import { createDefineMock } from "vite-plugin-mock-dev-server"; + +export const defineMock = createDefineMock((mock) => { + // 拼接url + mock.url = path.join(import.meta.env.VITE_APP_BASE_API + "/api/v1/", mock.url); +}); diff --git a/mock/dept.mock.ts b/mock/dept.mock.ts new file mode 100644 index 0000000..e9b6d1b --- /dev/null +++ b/mock/dept.mock.ts @@ -0,0 +1,153 @@ +import { defineMock } from "./base"; + +export default defineMock([ + { + url: "dept/options", + method: ["GET"], + body: { + code: "00000", + data: [ + { + value: 1, + label: "有来技术", + children: [ + { + value: 2, + label: "研发部门", + }, + { + value: 3, + label: "测试部门", + }, + ], + }, + ], + msg: "一切ok", + }, + }, + + { + url: "dept", + method: ["GET"], + body: { + code: "00000", + data: [ + { + id: 1, + parentId: 0, + name: "有来技术", + code: "YOULAI", + sort: 1, + status: 1, + children: [ + { + id: 2, + parentId: 1, + name: "研发部门", + code: "RD001", + sort: 1, + status: 1, + children: [], + createTime: null, + updateTime: "2022-04-19 12:46", + }, + { + id: 3, + parentId: 1, + name: "测试部门", + code: "QA001", + sort: 1, + status: 1, + children: [], + createTime: null, + updateTime: "2022-04-19 12:46", + }, + ], + createTime: null, + updateTime: null, + }, + ], + msg: "一切ok", + }, + }, + + // 新增部门 + { + url: "dept", + method: ["POST"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "新增部门" + body.name + "成功", + }; + }, + }, + + // 获取部门表单数据 + { + url: "dept/:id/form", + method: ["GET"], + body: ({ params }) => { + return { + code: "00000", + data: deptMap[params.id], + msg: "一切ok", + }; + }, + }, + + // 修改部门 + { + url: "dept/:id", + method: ["PUT"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "修改部门" + body.name + "成功", + }; + }, + }, + + // 删除部门 + { + url: "dept/:id", + method: ["DELETE"], + body({ params }) { + return { + code: "00000", + data: null, + msg: "删除部门" + params.id + "成功", + }; + }, + }, +]); + +// 部门映射表数据 +const deptMap: Record = { + 1: { + id: 1, + name: "有来技术", + code: "YOULAI", + parentId: 0, + status: 1, + sort: 1, + }, + 2: { + id: 2, + name: "研发部门", + code: "RD001", + parentId: 1, + status: 1, + sort: 1, + }, + 3: { + id: 3, + name: "测试部门", + code: "QA001", + parentId: 1, + status: 1, + sort: 1, + }, +}; diff --git a/mock/dict.mock.ts b/mock/dict.mock.ts new file mode 100644 index 0000000..c108bb5 --- /dev/null +++ b/mock/dict.mock.ts @@ -0,0 +1,312 @@ +import { defineMock } from "./base"; + +export default defineMock([ + { + url: "dicts/page", + method: ["GET"], + body: { + code: "00000", + data: { + list: [ + { + id: 1, + name: "性别", + dictCode: "gender", + status: 1, + }, + ], + total: 1, + }, + msg: "一切ok", + }, + }, + + /** + * 字典列表 + */ + { + url: "dicts", + method: ["GET"], + body: { + code: "00000", + data: { + list: [ + { + value: "gender", + label: "性别", + }, + ], + total: 1, + }, + msg: "一切ok", + }, + }, + + // 新增字典 + { + url: "dicts", + method: ["POST"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "新增字典" + body.name + "成功", + }; + }, + }, + + // 获取字典表单数据 + { + url: "dicts/:id/form", + method: ["GET"], + body: ({ params }) => { + return { + code: "00000", + data: dictMap[params.id], + msg: "一切ok", + }; + }, + }, + + // 修改字典 + { + url: "dicts/:id", + method: ["PUT"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "修改字典" + body.name + "成功", + }; + }, + }, + + // 删除字典 + { + url: "dicts/:ids", + method: ["DELETE"], + body({ params }) { + return { + code: "00000", + data: null, + msg: "删除字典" + params.ids + "成功", + }; + }, + }, + + //--------------------------------------------------- + // 字典项相关接口 + //--------------------------------------------------- + + // 字典项分页列表 + { + url: "dicts/:dictCode/items/page", + method: ["GET"], + body: { + code: "00000", + data: { + list: [ + { + id: 1, + dictCode: "gender", + label: "男", + value: "1", + sort: 1, + status: 1, + }, + { + id: 2, + dictCode: "gender", + label: "女", + value: "2", + sort: 2, + status: 1, + }, + { + id: 3, + dictCode: "gender", + label: "保密", + value: "0", + sort: 3, + status: 1, + }, + ], + total: 3, + }, + msg: "一切ok", + }, + }, + // 字典项列表 + { + url: "dicts/:dictCode/items", + method: ["GET"], + body: ({ params }) => { + const dictCode = params.dictCode; + + let list = null; + + if (dictCode == "gender") { + list = [ + { + value: "1", + label: "男", + }, + { + value: "2", + label: "女", + }, + { + value: "0", + label: "保密", + }, + ]; + } else if (dictCode == "notice_level") { + list = [ + { + value: "L", + label: "低", + tag: "info", + }, + { + value: "M", + label: "中", + tag: "warning", + }, + { + value: "H", + label: "高", + tag: "danger", + }, + ]; + } else if (dictCode == "notice_type") { + list = [ + { + value: "1", + label: "系统升级", + tag: "success", + }, + { + value: "2", + label: "系统维护", + tag: "primary", + }, + { + value: "3", + label: "安全警告", + tag: "danger", + }, + { + value: "4", + label: "假期通知", + tag: "success", + }, + { + value: "5", + label: "公司新闻", + tag: "primary", + }, + { + value: "99", + label: "其他", + tag: "info", + }, + ]; + } + + return { + code: "00000", + data: list, + msg: "一切ok", + }; + }, + }, + // 新增字典项 + { + url: "dicts/:dictCode/items", + method: ["POST"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "新增字典" + body.name + "成功", + }; + }, + }, + + // 字典项表单数据 + { + url: "dicts/:dictCode/items/:itemId/form", + method: ["GET"], + body: ({ params }) => { + return { + code: "00000", + data: dictItemMap[params.itemId], + msg: "一切ok", + }; + }, + }, + + // 修改字典项 + { + url: "dicts/:dictCode/items/:itemId", + method: ["PUT"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "修改字典项" + body.name + "成功", + }; + }, + }, + + // 删除字典 + { + url: "dicts/:dictCode/items/:itemId", + method: ["DELETE"], + body({ params }) { + return { + code: "00000", + data: null, + msg: "删除字典" + params.itemId + "成功", + }; + }, + }, +]); + +// 字典映射表数据 +const dictMap: Record = { + 1: { + id: 1, + name: "性别", + dictCode: "gender", + status: 1, + }, +}; + +// 字典项映射表数据 +const dictItemMap: Record = { + 1: { + id: 1, + value: "1", + label: "男", + sort: 1, + status: 1, + tagType: "primary", + }, + 2: { + id: 2, + value: "2", + label: "女", + sort: 2, + status: 1, + tagType: "danger", + }, + 3: { + id: 3, + value: "0", + label: "保密", + sort: 3, + status: 1, + tagType: "info", + }, +}; diff --git a/mock/log.mock.ts b/mock/log.mock.ts new file mode 100644 index 0000000..b75963e --- /dev/null +++ b/mock/log.mock.ts @@ -0,0 +1,207 @@ +import { defineMock } from "./base"; + +export default defineMock([ + { + url: "logs/page", + method: ["GET"], + body: { + code: "00000", + data: { + list: [ + { + id: 36192, + module: "菜单", + content: "菜单列表", + requestUri: "/api/v1/menus", + method: null, + ip: "183.156.148.241", + region: "浙江省 杭州市", + browser: "Chrome 109.0.0.0", + os: "OSX", + executionTime: 5, + createBy: null, + createTime: "2024-07-07 20:38:47", + operator: "系统管理员", + }, + { + id: 36190, + module: "字典", + content: "字典分页列表", + requestUri: "/api/v1/dict/page", + method: null, + ip: "183.156.148.241", + region: "浙江省 杭州市", + browser: "Chrome 109.0.0.0", + os: "OSX", + executionTime: 9, + createBy: null, + createTime: "2024-07-07 20:38:45", + operator: "系统管理员", + }, + { + id: 36193, + module: "部门", + content: "部门列表", + requestUri: "/api/v1/dept", + method: null, + ip: "192.168.31.134", + region: "0 内网IP", + browser: "Chrome 125.0.0.0", + os: "Windows 10 or Windows Server 2016", + executionTime: 27, + createBy: null, + createTime: "2024-07-07 20:38:45", + operator: "系统管理员", + }, + { + id: 36191, + module: "菜单", + content: "菜单列表", + requestUri: "/api/v1/menus", + method: null, + ip: "192.168.31.134", + region: "0 内网IP", + browser: "Chrome 125.0.0.0", + os: "Windows 10 or Windows Server 2016", + executionTime: 39, + createBy: null, + createTime: "2024-07-07 20:38:44", + operator: "系统管理员", + }, + { + id: 36189, + module: "角色", + content: "角色分页列表", + requestUri: "/api/v1/roles/page", + method: null, + ip: "192.168.31.134", + region: "0 内网IP", + browser: "Chrome 125.0.0.0", + os: "Windows 10 or Windows Server 2016", + executionTime: 55, + createBy: null, + createTime: "2024-07-07 20:38:43", + operator: "系统管理员", + }, + { + id: 36188, + module: "用户", + content: "用户分页列表", + requestUri: "/api/v1/users/page", + method: null, + ip: "192.168.31.134", + region: "0 内网IP", + browser: "Chrome 125.0.0.0", + os: "Windows 10 or Windows Server 2016", + executionTime: 92, + createBy: null, + createTime: "2024-07-07 20:38:42", + operator: "系统管理员", + }, + { + id: 36187, + module: "登录", + content: "登录", + requestUri: "/api/v1/auth/login", + method: null, + ip: "192.168.31.134", + region: "0 内网IP", + browser: "Chrome 125.0.0.0", + os: "Windows 10 or Windows Server 2016", + executionTime: 19340, + createBy: null, + createTime: "2024-07-07 20:38:09", + operator: "系统管理员", + }, + { + id: 36186, + module: "登录", + content: "登录", + requestUri: "/api/v1/auth/login", + method: null, + ip: "192.168.31.134", + region: "0 内网IP", + browser: "Chrome 125.0.0.0", + os: "Windows 10 or Windows Server 2016", + executionTime: 19869, + createBy: null, + createTime: "2024-07-07 20:37:59", + operator: "系统管理员", + }, + { + id: 36185, + module: "登录", + content: "登录", + requestUri: "/api/v1/auth/login", + method: null, + ip: "112.103.111.59", + region: "黑龙江省 哈尔滨市", + browser: "Chrome 97.0.4692.98", + os: "Android", + executionTime: 96, + createBy: null, + createTime: "2024-07-07 20:37:21", + operator: "系统管理员", + }, + { + id: 36184, + module: "登录", + content: "登录", + requestUri: "/api/v1/auth/login", + method: null, + ip: "114.86.204.190", + region: "上海 上海市", + browser: "Chrome 125.0.0.0", + os: "Windows 10 or Windows Server 2016", + executionTime: 89, + createBy: null, + createTime: "2024-07-07 20:29:37", + operator: "系统管理员", + }, + ], + total: 36188, + }, + msg: "一切ok", + }, + }, + { + url: "logs/visit-trend", + method: ["GET"], + body: { + code: "00000", + data: { + dates: [ + "2024-06-30", + "2024-07-01", + "2024-07-02", + "2024-07-03", + "2024-07-04", + "2024-07-05", + "2024-07-06", + "2024-07-07", + ], + pvList: [1751, 5168, 4882, 5301, 4721, 4885, 1901, 1003], + uvList: null, + ipList: [207, 566, 565, 631, 579, 496, 222, 152], + }, + msg: "一切ok", + }, + }, + + { + url: "logs/visit-stats", + method: ["GET"], + body: { + code: "00000", + data: { + todayPvCount: 1629, + totalPvCount: 286086, + pvGrowthRate: -0.65, + todayIpCount: 169, + totalIpCount: 19985, + ipGrowthRate: -0.57, + }, + msg: "一切ok", + }, + }, +]); diff --git a/mock/menu.mock.ts b/mock/menu.mock.ts new file mode 100644 index 0000000..02d72db --- /dev/null +++ b/mock/menu.mock.ts @@ -0,0 +1,2082 @@ +import { defineMock } from "./base"; + +export default defineMock([ + { + url: "menus/routes", + method: ["GET"], + body: { + code: "00000", + data: [ + { + path: "/system", + component: "Layout", + redirect: "/system/user", + name: "/system", + meta: { + title: "系统管理", + icon: "system", + hidden: false, + alwaysShow: false, + params: null, + }, + children: [ + { + path: "user", + component: "system/user/index", + name: "User", + meta: { + title: "用户管理", + icon: "el-icon-User", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "role", + component: "system/role/index", + name: "Role", + meta: { + title: "角色管理", + icon: "role", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "menu", + component: "system/menu/index", + name: "SysMenu", + meta: { + title: "菜单管理", + icon: "menu", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "dept", + component: "system/dept/index", + name: "Dept", + meta: { + title: "部门管理", + icon: "tree", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "dict", + component: "system/dict/index", + name: "Dict", + meta: { + title: "字典管理", + icon: "dict", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "log", + component: "system/log/index", + name: "Log", + meta: { + title: "系统日志", + icon: "document", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "dict-item", + component: "system/dict/dict-item", + name: "DictItem", + meta: { + title: "字典项", + icon: "", + hidden: true, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "config", + component: "system/config/index", + name: "Config", + meta: { + title: "系统配置", + icon: "setting", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "notice", + component: "system/notice/index", + name: "Notice", + meta: { + title: "通知公告", + icon: "", + hidden: false, + alwaysShow: false, + params: null, + }, + }, + ], + }, + { + path: "/codegen", + component: "Layout", + name: "/codegen", + meta: { + title: "系统工具", + icon: "menu", + hidden: false, + alwaysShow: false, + params: null, + }, + children: [ + { + path: "codegen", + component: "codegen/index", + name: "Codegen", + meta: { + title: "代码生成", + icon: "code", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + ], + }, + { + path: "/api", + component: "Layout", + name: "/api", + meta: { + title: "接口文档", + icon: "api", + hidden: false, + alwaysShow: true, + params: null, + }, + children: [ + { + path: "apifox", + component: "demo/api/apifox", + name: "Apifox", + meta: { + title: "Apifox", + icon: "api", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + ], + }, + { + path: "/doc", + component: "Layout", + redirect: "https://juejin.cn/post/7228990409909108793", + name: "/doc", + meta: { + title: "平台文档", + icon: "document", + hidden: false, + alwaysShow: false, + params: null, + }, + children: [ + { + path: "internal-doc", + component: "demo/internal-doc", + name: "InternalDoc", + meta: { + title: "document", + icon: "document", + hidden: false, + alwaysShow: false, + params: null, + }, + }, + { + path: "https://juejin.cn/post/7228990409909108793", + name: "Https://juejin.cn/post/7228990409909108793", + meta: { + title: "平台文档(外链)", + icon: "link", + hidden: false, + alwaysShow: false, + params: null, + }, + }, + ], + }, + { + path: "/multi-level", + component: "Layout", + name: "/multiLevel", + meta: { + title: "多级菜单", + icon: "cascader", + hidden: false, + alwaysShow: true, + params: null, + }, + children: [ + { + path: "multi-level1", + component: "demo/multi-level/level1", + name: "MultiLevel1", + meta: { + title: "菜单一级", + icon: "", + hidden: false, + alwaysShow: true, + params: null, + }, + children: [ + { + path: "multi-level2", + component: "demo/multi-level/children/level2", + name: "MultiLevel2", + meta: { + title: "菜单二级", + icon: "", + hidden: false, + alwaysShow: false, + params: null, + }, + children: [ + { + path: "multi-level3-1", + component: "demo/multi-level/children/children/level3-1", + name: "MultiLevel31", + meta: { + title: "菜单三级-1", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "multi-level3-2", + component: "demo/multi-level/children/children/level3-2", + name: "MultiLevel32", + meta: { + title: "菜单三级-2", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + ], + }, + ], + }, + ], + }, + { + path: "/component", + component: "Layout", + name: "/component", + meta: { + title: "组件封装", + icon: "menu", + hidden: false, + alwaysShow: false, + params: null, + }, + children: [ + { + path: "curd", + component: "demo/curd/index", + name: "Curd", + meta: { + title: "增删改查", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "table-select", + component: "demo/table-select/index", + name: "TableSelect", + meta: { + title: "列表选择器", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "wang-editor", + component: "demo/wang-editor", + name: "WangEditor", + meta: { + title: "富文本编辑器", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "upload", + component: "demo/upload", + name: "Upload", + meta: { + title: "图片上传", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "dict-demo", + component: "demo/dictionary", + name: "DictDemo", + meta: { + title: "字典组件", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "icon-selector", + component: "demo/icon-selector", + name: "IconSelector", + meta: { + title: "图标选择器", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "drag", + component: "demo/drag", + name: "Drag", + meta: { + title: "拖拽组件", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "text-scroll", + component: "demo/text-scroll", + name: "TextScroll", + meta: { + title: "滚动文本", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + ], + }, + { + path: "/route-param", + component: "Layout", + name: "/routeParam", + meta: { + title: "路由参数", + icon: "el-icon-ElementPlus", + hidden: false, + alwaysShow: true, + params: null, + }, + children: [ + { + path: "route-param-type1", + component: "demo/route-param", + name: "RouteParamType1", + meta: { + title: "参数(type=1)", + icon: "el-icon-Star", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: { + type: "1", + }, + }, + }, + { + path: "route-param-type2", + component: "demo/route-param", + name: "RouteParamType2", + meta: { + title: "参数(type=2)", + icon: "el-icon-StarFilled", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: { + type: "2", + }, + }, + }, + ], + }, + { + path: "/function", + component: "Layout", + name: "/function", + meta: { + title: "功能演示", + icon: "menu", + hidden: false, + alwaysShow: false, + params: null, + }, + children: [ + { + path: "icon-demo", + component: "demo/icons", + name: "IconDemo", + meta: { + title: "Icons", + icon: "el-icon-Notification", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "/function/websocket", + component: "demo/websocket", + name: "/function/websocket", + meta: { + title: "Websocket", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "other/:id", + component: "demo/other", + name: "Other/:id", + meta: { + title: "敬请期待...", + icon: "", + hidden: false, + alwaysShow: false, + params: null, + }, + }, + ], + }, + ], + msg: "一切ok", + }, + }, + + // 获取菜单树形表格列表 + { + url: "menus", + method: ["GET"], + body: { + code: "00000", + data: [ + { + id: 1, + parentId: 0, + name: "系统管理", + type: "CATALOG", + routeName: "", + routePath: "/system", + component: "Layout", + sort: 1, + visible: 1, + icon: "system", + redirect: "/system/user", + perm: null, + children: [ + { + id: 2, + parentId: 1, + name: "用户管理", + type: "MENU", + routeName: "User", + routePath: "user", + component: "system/user/index", + sort: 1, + visible: 1, + icon: "el-icon-User", + redirect: null, + perm: null, + children: [ + { + id: 105, + parentId: 2, + name: "用户查询", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 0, + visible: 1, + icon: "", + redirect: null, + perm: "sys:user:query", + children: [], + }, + { + id: 31, + parentId: 2, + name: "用户新增", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 1, + visible: 1, + icon: "", + redirect: "", + perm: "sys:user:add", + children: [], + }, + { + id: 32, + parentId: 2, + name: "用户编辑", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 2, + visible: 1, + icon: "", + redirect: "", + perm: "sys:user:edit", + children: [], + }, + { + id: 33, + parentId: 2, + name: "用户删除", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: "", + perm: "sys:user:delete", + children: [], + }, + { + id: 88, + parentId: 2, + name: "重置密码", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 4, + visible: 1, + icon: "", + redirect: null, + perm: "sys:user:password:reset", + children: [], + }, + { + id: 106, + parentId: 2, + name: "用户导入", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 5, + visible: 1, + icon: "", + redirect: null, + perm: "sys:user:import", + children: [], + }, + { + id: 107, + parentId: 2, + name: "用户导出", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 6, + visible: 1, + icon: "", + redirect: null, + perm: "sys:user:export", + children: [], + }, + ], + }, + { + id: 3, + parentId: 1, + name: "角色管理", + type: "MENU", + routeName: "Role", + routePath: "role", + component: "system/role/index", + sort: 2, + visible: 1, + icon: "role", + redirect: null, + perm: null, + children: [ + { + id: 70, + parentId: 3, + name: "角色新增", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 1, + visible: 1, + icon: "", + redirect: null, + perm: "sys:role:add", + children: [], + }, + { + id: 71, + parentId: 3, + name: "角色编辑", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 2, + visible: 1, + icon: "", + redirect: null, + perm: "sys:role:edit", + children: [], + }, + { + id: 72, + parentId: 3, + name: "角色删除", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: null, + perm: "sys:role:delete", + children: [], + }, + ], + }, + { + id: 4, + parentId: 1, + name: "菜单管理", + type: "MENU", + routeName: "Menu", + routePath: "menu", + component: "system/menu/index", + sort: 3, + visible: 1, + icon: "menu", + redirect: null, + perm: null, + children: [ + { + id: 73, + parentId: 4, + name: "菜单新增", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 1, + visible: 1, + icon: "", + redirect: null, + perm: "sys:menu:add", + children: [], + }, + { + id: 74, + parentId: 4, + name: "菜单编辑", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: null, + perm: "sys:menu:edit", + children: [], + }, + { + id: 75, + parentId: 4, + name: "菜单删除", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: null, + perm: "sys:menu:delete", + children: [], + }, + ], + }, + { + id: 5, + parentId: 1, + name: "部门管理", + type: "MENU", + routeName: "Dept", + routePath: "dept", + component: "system/dept/index", + sort: 4, + visible: 1, + icon: "tree", + redirect: null, + perm: null, + children: [ + { + id: 76, + parentId: 5, + name: "部门新增", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 1, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dept:add", + children: [], + }, + { + id: 77, + parentId: 5, + name: "部门编辑", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 2, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dept:edit", + children: [], + }, + { + id: 78, + parentId: 5, + name: "部门删除", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dept:delete", + children: [], + }, + ], + }, + { + id: 6, + parentId: 1, + name: "字典管理", + type: "MENU", + routeName: "Dict", + routePath: "dict", + component: "system/dict/index", + sort: 5, + visible: 1, + icon: "dict", + redirect: null, + perm: null, + children: [ + { + id: 79, + parentId: 6, + name: "字典新增", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 1, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dict:add", + children: [], + }, + { + id: 81, + parentId: 6, + name: "字典编辑", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 2, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dict_type:edit", + children: [], + }, + { + id: 84, + parentId: 6, + name: "字典删除", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dict_type:delete", + children: [], + }, + ], + }, + { + id: 135, + parentId: 1, + name: "字典项", + type: "MENU", + routeName: "DictData", + routePath: "dict-item", + component: "system/dict/dict-item", + sort: 6, + visible: 0, + icon: "", + redirect: null, + perm: null, + children: [ + { + id: 136, + parentId: 135, + name: "字典项新增", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 4, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dict-item:add", + children: [], + }, + { + id: 137, + parentId: 135, + name: "字典项编辑", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 5, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dict-item:edit", + children: [], + }, + { + id: 138, + parentId: 135, + name: "字典项删除", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 6, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dict-item:delete", + children: [], + }, + ], + }, + { + id: 117, + parentId: 1, + name: "系统日志", + type: "MENU", + routeName: "Log", + routePath: "log", + component: "system/log/index", + sort: 6, + visible: 1, + icon: "document", + redirect: null, + perm: null, + children: [], + }, + { + id: 120, + parentId: 1, + name: "系统配置", + type: "MENU", + routeName: "Config", + routePath: "config", + component: "system/config/index", + sort: 7, + visible: 1, + icon: "setting", + redirect: null, + perm: null, + children: [ + { + id: 121, + parentId: 120, + name: "查询系统配置", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 1, + visible: 1, + icon: "", + redirect: null, + perm: "sys:config:query", + children: [], + }, + { + id: 122, + parentId: 120, + name: "新增系统配置", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 2, + visible: 1, + icon: "", + redirect: null, + perm: "sys:config:add", + children: [], + }, + { + id: 123, + parentId: 120, + name: "修改系统配置", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: null, + perm: "sys:config:update", + children: [], + }, + { + id: 124, + parentId: 120, + name: "删除系统配置", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 4, + visible: 1, + icon: "", + redirect: null, + perm: "sys:config:delete", + children: [], + }, + { + id: 125, + parentId: 120, + name: "刷新系统配置", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 5, + visible: 1, + icon: "", + redirect: null, + perm: "sys:config:refresh", + children: [], + }, + ], + }, + { + id: 126, + parentId: 1, + name: "通知公告", + type: "MENU", + routeName: "Notice", + routePath: "notice", + component: "system/notice/index", + sort: 9, + visible: 1, + icon: "", + redirect: null, + perm: null, + children: [ + { + id: 127, + parentId: 126, + name: "查询", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 1, + visible: 1, + icon: "", + redirect: null, + perm: "sys:notice:query", + children: [], + }, + { + id: 128, + parentId: 126, + name: "新增", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 2, + visible: 1, + icon: "", + redirect: null, + perm: "sys:notice:add", + children: [], + }, + { + id: 129, + parentId: 126, + name: "编辑", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 3, + visible: 1, + icon: "", + redirect: null, + perm: "sys:notice:edit", + children: [], + }, + { + id: 130, + parentId: 126, + name: "删除", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 4, + visible: 1, + icon: "", + redirect: null, + perm: "sys:notice:delete", + children: [], + }, + { + id: 133, + parentId: 126, + name: "发布", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 5, + visible: 1, + icon: "", + redirect: null, + perm: "sys:notice:publish", + children: [], + }, + { + id: 134, + parentId: 126, + name: "撤回", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 6, + visible: 1, + icon: "", + redirect: null, + perm: "sys:notice:revoke", + children: [], + }, + ], + }, + ], + }, + { + id: 118, + parentId: 0, + name: "系统工具", + type: "CATALOG", + routeName: null, + routePath: "/codegen", + component: "Layout", + sort: 2, + visible: 1, + icon: "menu", + redirect: null, + perm: null, + children: [ + { + id: 119, + parentId: 118, + name: "代码生成", + type: "MENU", + routeName: "Codegen", + routePath: "codegen", + component: "codegen/index", + sort: 1, + visible: 1, + icon: "code", + redirect: null, + perm: null, + children: [], + }, + ], + }, + { + id: 40, + parentId: 0, + name: "接口文档", + type: "CATALOG", + routeName: null, + routePath: "/api", + component: "Layout", + sort: 7, + visible: 1, + icon: "api", + redirect: "", + perm: null, + children: [ + { + id: 41, + parentId: 40, + name: "Apifox", + type: "MENU", + routeName: null, + routePath: "apifox", + component: "demo/api/apifox", + sort: 1, + visible: 1, + icon: "api", + redirect: "", + perm: null, + children: [], + }, + ], + }, + { + id: 26, + parentId: 0, + name: "平台文档", + type: "CATALOG", + routeName: null, + routePath: "/doc", + component: "Layout", + sort: 8, + visible: 1, + icon: "document", + redirect: "https://juejin.cn/post/7228990409909108793", + perm: null, + children: [ + { + id: 102, + parentId: 26, + name: "平台文档(内嵌)", + type: "EXTLINK", + routeName: null, + routePath: "internal-doc", + component: "demo/internal-doc", + sort: 1, + visible: 1, + icon: "document", + redirect: "", + perm: null, + children: [], + }, + { + id: 30, + parentId: 26, + name: "平台文档(外链)", + type: "EXTLINK", + routeName: null, + routePath: "https://juejin.cn/post/7228990409909108793", + component: "", + sort: 2, + visible: 1, + icon: "link", + redirect: "", + perm: null, + children: [], + }, + ], + }, + { + id: 20, + parentId: 0, + name: "多级菜单", + type: "CATALOG", + routeName: null, + routePath: "/multi-level", + component: "Layout", + sort: 9, + visible: 1, + icon: "cascader", + redirect: "", + perm: null, + children: [ + { + id: 21, + parentId: 20, + name: "菜单一级", + type: "MENU", + routeName: null, + routePath: "multi-level1", + component: "demo/multi-level/level1", + sort: 1, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [ + { + id: 22, + parentId: 21, + name: "菜单二级", + type: "MENU", + routeName: null, + routePath: "multi-level2", + component: "demo/multi-level/children/level2", + sort: 1, + visible: 1, + icon: "", + redirect: null, + perm: null, + children: [ + { + id: 23, + parentId: 22, + name: "菜单三级-1", + type: "MENU", + routeName: null, + routePath: "multi-level3-1", + component: "demo/multi-level/children/children/level3-1", + sort: 1, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + { + id: 24, + parentId: 22, + name: "菜单三级-2", + type: "MENU", + routeName: null, + routePath: "multi-level3-2", + component: "demo/multi-level/children/children/level3-2", + sort: 2, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + ], + }, + ], + }, + ], + }, + { + id: 36, + parentId: 0, + name: "组件封装", + type: "CATALOG", + routeName: null, + routePath: "/component", + component: "Layout", + sort: 10, + visible: 1, + icon: "menu", + redirect: "", + perm: null, + children: [ + { + id: 108, + parentId: 36, + name: "增删改查", + type: "MENU", + routeName: null, + routePath: "curd", + component: "demo/curd/index", + sort: 0, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + { + id: 109, + parentId: 36, + name: "列表选择器", + type: "MENU", + routeName: null, + routePath: "table-select", + component: "demo/table-select/index", + sort: 1, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + { + id: 37, + parentId: 36, + name: "富文本编辑器", + type: "MENU", + routeName: null, + routePath: "wang-editor", + component: "demo/wang-editor", + sort: 2, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + { + id: 38, + parentId: 36, + name: "图片上传", + type: "MENU", + routeName: null, + routePath: "upload", + component: "demo/upload", + sort: 3, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + { + id: 95, + parentId: 36, + name: "字典组件", + type: "MENU", + routeName: null, + routePath: "dict-demo", + component: "demo/dict", + sort: 4, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + { + id: 39, + parentId: 36, + name: "图标选择器", + type: "MENU", + routeName: null, + routePath: "icon-selector", + component: "demo/icon-selector", + sort: 4, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + ], + }, + { + id: 110, + parentId: 0, + name: "路由参数", + type: "CATALOG", + routeName: null, + routePath: "/route-param", + component: "Layout", + sort: 11, + visible: 1, + icon: "el-icon-ElementPlus", + redirect: null, + perm: null, + children: [ + { + id: 111, + parentId: 110, + name: "参数(type=1)", + type: "MENU", + routeName: null, + routePath: "route-param-type1", + component: "demo/route-param", + sort: 1, + visible: 1, + icon: "el-icon-Star", + redirect: null, + perm: null, + children: [], + }, + { + id: 112, + parentId: 110, + name: "参数(type=2)", + type: "MENU", + routeName: null, + routePath: "route-param-type2", + component: "demo/route-param", + sort: 2, + visible: 1, + icon: "el-icon-StarFilled", + redirect: null, + perm: null, + children: [], + }, + ], + }, + { + id: 89, + parentId: 0, + name: "功能演示", + type: "CATALOG", + routeName: null, + routePath: "/function", + component: "Layout", + sort: 12, + visible: 1, + icon: "menu", + redirect: "", + perm: null, + children: [ + { + id: 97, + parentId: 89, + name: "Icons", + type: "MENU", + routeName: null, + routePath: "icon-demo", + component: "demo/icons", + sort: 2, + visible: 1, + icon: "el-icon-Notification", + redirect: "", + perm: null, + children: [], + }, + { + id: 90, + parentId: 89, + name: "Websocket", + type: "MENU", + routeName: null, + routePath: "/function/websocket", + component: "demo/websocket", + sort: 3, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + { + id: 91, + parentId: 89, + name: "敬请期待...", + type: "CATALOG", + routeName: null, + routePath: "other/:id", + component: "demo/other", + sort: 4, + visible: 1, + icon: "", + redirect: "", + perm: null, + children: [], + }, + ], + }, + ], + msg: "一切ok", + }, + }, + + // 获取菜单树形下拉列表 + { + url: "menus/options", + method: ["GET"], + body: { + code: "00000", + data: [ + { + value: "1", + label: "系统管理", + children: [ + { + value: "2", + label: "用户管理", + children: [ + { + value: "105", + label: "用户查询", + }, + { + value: "31", + label: "用户新增", + }, + { + value: "32", + label: "用户编辑", + }, + { + value: "33", + label: "用户删除", + }, + { + value: "88", + label: "重置密码", + }, + { + value: "106", + label: "用户导入", + }, + { + value: "107", + label: "用户导出", + }, + ], + }, + { + value: "3", + label: "角色管理", + children: [ + { + value: "139", + label: "角色查询", + }, + { + value: "70", + label: "角色新增", + }, + { + value: "71", + label: "角色编辑", + }, + { + value: "72", + label: "角色删除", + }, + ], + }, + { + value: "4", + label: "菜单管理", + children: [ + { + value: "73", + label: "菜单新增", + }, + { + value: "140", + label: "菜单查询", + }, + { + value: "75", + label: "菜单删除", + }, + { + value: "74", + label: "菜单编辑", + }, + ], + }, + { + value: "5", + label: "部门管理", + children: [ + { + value: "76", + label: "部门新增", + }, + { + value: "141", + label: "部门查询", + }, + { + value: "77", + label: "部门编辑", + }, + { + value: "78", + label: "部门删除", + }, + ], + }, + { + value: "6", + label: "字典管理", + children: [ + { + value: "79", + label: "字典新增", + }, + { + value: "142", + label: "字典查询", + }, + { + value: "81", + label: "字典编辑", + }, + { + value: "84", + label: "字典删除", + }, + ], + }, + { + value: "117", + label: "系统日志", + }, + { + value: "135", + label: "字典项", + children: [ + { + value: "143", + label: "字典项查询", + }, + { + value: "136", + label: "字典项新增", + }, + { + value: "137", + label: "字典项编辑", + }, + { + value: "138", + label: "字典项删除", + }, + ], + }, + { + value: "120", + label: "系统配置", + children: [ + { + value: "121", + label: "系统配置查询", + }, + { + value: "122", + label: "系统配置新增", + }, + { + value: "123", + label: "系统配置修改", + }, + { + value: "124", + label: "系统配置删除", + }, + { + value: "125", + label: "系统配置刷新", + }, + ], + }, + { + value: "126", + label: "通知公告", + children: [ + { + value: "127", + label: "通知查询", + }, + { + value: "128", + label: "通知新增", + }, + { + value: "129", + label: "通知编辑", + }, + { + value: "130", + label: "通知删除", + }, + { + value: "133", + label: "通知发布", + }, + { + value: "134", + label: "通知撤回", + }, + ], + }, + ], + }, + { + value: "118", + label: "系统工具", + children: [ + { + value: "119", + label: "代码生成", + }, + ], + }, + { + value: "40", + label: "接口文档", + children: [ + { + value: "41", + label: "Apifox", + }, + ], + }, + { + value: "26", + label: "平台文档", + children: [ + { + value: "102", + label: "document", + }, + { + value: "30", + label: "平台文档(外链)", + }, + ], + }, + { + value: "20", + label: "多级菜单", + children: [ + { + value: "21", + label: "菜单一级", + children: [ + { + value: "22", + label: "菜单二级", + children: [ + { + value: "23", + label: "菜单三级-1", + }, + { + value: "24", + label: "菜单三级-2", + }, + ], + }, + ], + }, + ], + }, + { + value: "36", + label: "组件封装", + children: [ + { + value: "108", + label: "增删改查", + }, + { + value: "109", + label: "列表选择器", + }, + { + value: "37", + label: "富文本编辑器", + }, + { + value: "38", + label: "图片上传", + }, + { + value: "39", + label: "图标选择器", + }, + { + value: "95", + label: "字典组件", + }, + ], + }, + { + value: "110", + label: "路由参数", + children: [ + { + value: "111", + label: "参数(type=1)", + }, + { + value: "112", + label: "参数(type=2)", + }, + ], + }, + { + value: "89", + label: "功能演示", + children: [ + { + value: "97", + label: "Icons", + }, + { + value: "90", + label: "Websocket", + }, + { + value: "91", + label: "敬请期待...", + }, + ], + }, + ], + + msg: "一切ok", + }, + }, + + // 新增菜单 + { + url: "menus", + method: ["POST"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "新增菜单" + body.name + "成功", + }; + }, + }, + + // 获取菜单表单数据 + { + url: "menus/:id/form", + method: ["GET"], + body: ({ params }) => { + return { + code: "00000", + data: menuMap[params.id], + msg: "一切ok", + }; + }, + }, + + // 修改菜单 + { + url: "menus/:id", + method: ["PUT"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "修改菜单" + body.name + "成功", + }; + }, + }, + + // 删除菜单 + { + url: "menus/:id", + method: ["DELETE"], + body({ params }) { + return { + code: "00000", + data: null, + msg: "删除菜单" + params.id + "成功", + }; + }, + }, +]); + +// 菜单映射表数据 +const menuMap: Record = { + 1: { + id: 1, + parentId: 0, + name: "系统管理", + type: "CATALOG", + routeName: "", + routePath: "/system", + component: "Layout", + perm: null, + visible: 1, + sort: 1, + icon: "system", + redirect: "/system/user", + keepAlive: null, + alwaysShow: null, + params: null, + }, + 2: { + id: 2, + parentId: 1, + name: "用户管理", + type: "MENU", + routeName: "User", + routePath: "user", + component: "system/user/index", + perm: null, + visible: 1, + sort: 1, + icon: "user", + redirect: null, + keepAlive: 1, + alwaysShow: null, + }, + 3: { + id: 3, + parentId: 1, + name: "角色管理", + type: "MENU", + routeName: "Role", + routePath: "role", + component: "system/role/index", + perm: null, + visible: 1, + sort: 2, + icon: "role", + redirect: null, + keepAlive: 1, + alwaysShow: null, + }, + 4: { + id: 4, + parentId: 1, + name: "菜单管理", + type: "MENU", + routeName: "Menu", + routePath: "menu", + component: "system/menu/index", + perm: null, + visible: 1, + sort: 3, + icon: "menu", + redirect: null, + keepAlive: 1, + alwaysShow: null, + }, + 5: { + id: 5, + parentId: 1, + name: "部门管理", + type: "MENU", + routeName: "Dept", + routePath: "dept", + component: "system/dept/index", + perm: null, + visible: 1, + sort: 4, + icon: "tree", + redirect: null, + keepAlive: 1, + alwaysShow: null, + }, + 6: { + id: 6, + parentId: 1, + name: "字典管理", + type: "MENU", + routeName: "Dict", + routePath: "dict", + component: "system/dict/index", + perm: null, + visible: 1, + sort: 5, + icon: "dict", + redirect: null, + keepAlive: 1, + alwaysShow: null, + }, +}; diff --git a/mock/notice.mock.ts b/mock/notice.mock.ts new file mode 100644 index 0000000..c140c16 --- /dev/null +++ b/mock/notice.mock.ts @@ -0,0 +1,416 @@ +import { defineMock } from "./base"; + +export default defineMock([ + { + url: "notices/page", + method: ["GET"], + body: { + code: "00000", + data: { + list: [ + { + id: 1, + title: "v2.12.0 新增系统日志,访问趋势统计功能。", + publishStatus: 1, + type: 1, + publisherName: "系统管理员", + level: "L", + publishTime: "2024-09-30 17:21", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + { + id: 2, + title: "v2.13.0 新增菜单搜索。", + publishStatus: 1, + type: 1, + publisherName: "系统管理员", + level: "L", + publishTime: "2024-09-30 17:22", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + { + id: 3, + title: "\r\nv2.14.0 新增个人中心。", + publishStatus: 1, + type: 1, + publisherName: "系统管理员", + level: "L", + publishTime: "2024-09-30 17:23", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + { + id: 4, + title: "v2.15.0 登录页面改造。", + publishStatus: 1, + type: 1, + publisherName: "系统管理员", + level: "L", + publishTime: "2024-09-30 17:24", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + { + id: 5, + title: "v2.16.0 通知公告、字典翻译组件。", + publishStatus: 1, + type: 1, + publisherName: "系统管理员", + level: "L", + publishTime: "2024-09-30 17:25", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + { + id: 6, + title: "系统将于本周六凌晨 2 点进行维护,预计维护时间为 2 小时。", + publishStatus: 1, + type: 2, + publisherName: "系统管理员", + level: "L", + publishTime: "2024-09-30 17:26", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + { + id: 7, + title: "最近发现一些钓鱼邮件,请大家提高警惕,不要点击陌生链接。", + publishStatus: 1, + type: 3, + publisherName: "系统管理员", + level: "L", + publishTime: "2024-09-30 17:27", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + { + id: 8, + title: "国庆假期从 10 月 1 日至 10 月 7 日放假,共 7 天。", + publishStatus: 1, + type: 4, + publisherName: "系统管理员", + level: "L", + publishTime: "2024-09-30 17:28", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + { + id: 9, + title: "公司将在 10 月 15 日举办新产品发布会,敬请期待。", + publishStatus: 1, + type: 5, + publisherName: "系统管理员", + level: "L", + publishTime: "2024-09-30 17:29", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + { + id: 10, + title: "v2.16.1 版本修复了 WebSocket 重复连接导致的后台线程阻塞问题,优化了通知公告。", + publishStatus: 1, + type: 1, + publisherName: "系统管理员", + level: "L", + publishTime: "2024-09-30 17:30", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + ], + total: 10, + }, + msg: "一切ok", + }, + }, + + // 新增通知 + { + url: "notices", + method: ["POST"], + body() { + return { + code: "00000", + data: null, + msg: "新增成功", + }; + }, + }, + + // 获取通知表单数据 + { + url: "notices/:id/form", + method: ["GET"], + body: ({ params }) => { + return { + code: "00000", + data: noticeMap[params.id], + msg: "一切ok", + }; + }, + }, + + // 获取通知详情 + { + url: "notices/:id/detail", + method: ["GET"], + body: ({ params }) => { + return { + code: "00000", + data: noticeMap[params.id], + msg: "一切ok", + }; + }, + }, + // 修改通知 + { + url: "roles/:id", + method: ["PUT"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "修改通知" + body.name + "成功", + }; + }, + }, + + // 删除通知 + { + url: "roles/:id", + method: ["DELETE"], + body({ params }) { + return { + code: "00000", + data: null, + msg: "删除通知" + params.id + "成功", + }; + }, + }, + + // 我的通知分页列表 + { + url: "notices/my-page", + method: ["GET"], + body: { + code: "00000", + data: { + list: [ + { + id: 10, + title: "v2.16.1 版本修复了 WebSocket 重复连接导致的后台线程阻塞问题,优化了通知公告。", + type: 1, + level: "L", + publisherName: "系统管理员", + publishTime: "2024-09-30 17:30", + isRead: 0, + }, + { + id: 9, + title: "公司将在 10 月 15 日举办新产品发布会,敬请期待。", + type: 5, + level: "L", + publisherName: "系统管理员", + publishTime: "2024-09-30 17:29", + isRead: 0, + }, + { + id: 8, + title: "国庆假期从 10 月 1 日至 10 月 7 日放假,共 7 天。", + type: 4, + level: "L", + publisherName: "系统管理员", + publishTime: "2024-09-30 17:28", + isRead: 0, + }, + { + id: 7, + title: "最近发现一些钓鱼邮件,请大家提高警惕,不要点击陌生链接。", + type: 3, + level: "L", + publisherName: "系统管理员", + publishTime: "2024-09-30 17:27", + isRead: 0, + }, + { + id: 6, + title: "系统将于本周六凌晨 2 点进行维护,预计维护时间为 2 小时。", + type: 2, + level: "L", + publisherName: "系统管理员", + publishTime: "2024-09-30 17:26", + isRead: 0, + }, + ], + total: 10, + }, + msg: "一切ok", + }, + }, +]); + +// 通知映射表数据 +const noticeMap: Record = { + 1: { + id: 1, + title: "v2.12.0 新增系统日志,访问趋势统计功能。", + publishStatus: 1, + type: 1, + publisherName: "系统管理员", + level: "L", + levelLabel: null, + publishTime: "2024-09-30 17:21", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + 2: { + id: 2, + title: "v2.13.0 新增菜单搜索。", + publishStatus: 1, + type: 1, + publisherName: "系统管理员", + level: "L", + levelLabel: null, + publishTime: "2024-09-30 17:22", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + 3: { + id: 3, + title: "\r\nv2.14.0 新增个人中心。", + publishStatus: 1, + type: 1, + publisherName: "系统管理员", + level: "L", + levelLabel: null, + publishTime: "2024-09-30 17:23", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + 4: { + id: 4, + title: "v2.15.0 登录页面改造。", + publishStatus: 1, + type: 1, + publisherName: "系统管理员", + level: "L", + levelLabel: null, + publishTime: "2024-09-30 17:24", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + + 5: { + id: 5, + title: "v2.16.0 通知公告、字典翻译组件。", + publishStatus: 1, + type: 1, + publisherName: "系统管理员", + level: "L", + levelLabel: null, + publishTime: "2024-09-30 17:25", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + 6: { + id: 6, + title: "系统将于本周六凌晨 2 点进行维护,预计维护时间为 2 小时。", + publishStatus: 1, + type: 2, + publisherName: "系统管理员", + level: "L", + levelLabel: null, + publishTime: "2024-09-30 17:26", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + 7: { + id: 7, + title: "最近发现一些钓鱼邮件,请大家提高警惕,不要点击陌生链接。", + publishStatus: 1, + type: 3, + publisherName: "系统管理员", + level: "L", + levelLabel: null, + publishTime: "2024-09-30 17:27", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + 8: { + id: 8, + title: "国庆假期从 10 月 1 日至 10 月 7 日放假,共 7 天。", + publishStatus: 1, + type: 4, + publisherName: "系统管理员", + level: "L", + levelLabel: null, + publishTime: "2024-09-30 17:28", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + 9: { + id: 9, + title: "公司将在 10 月 15 日举办新产品发布会,敬请期待。", + publishStatus: 1, + type: 5, + publisherName: "系统管理员", + level: "L", + levelLabel: null, + publishTime: "2024-09-30 17:29", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, + 10: { + id: 10, + title: "v2.16.1 版本修复了 WebSocket 重复连接导致的后台线程阻塞问题,优化了通知公告。", + publishStatus: 1, + type: 1, + publisherName: "系统管理员", + level: "L", + levelLabel: null, + publishTime: "2024-09-30 17:30", + isRead: null, + targetType: 1, + createTime: "2024-09-28 11:21", + revokeTime: "2024-09-30 17:21", + }, +}; diff --git a/mock/role.mock.ts b/mock/role.mock.ts new file mode 100644 index 0000000..ee85699 --- /dev/null +++ b/mock/role.mock.ts @@ -0,0 +1,334 @@ +import { defineMock } from "./base"; + +export default defineMock([ + { + url: "roles/options", + method: ["GET"], + body: { + code: "00000", + data: [ + { + value: 2, + label: "系统管理员", + }, + { + value: 4, + label: "系统管理员1", + }, + { + value: 5, + label: "系统管理员2", + }, + { + value: 6, + label: "系统管理员3", + }, + { + value: 7, + label: "系统管理员4", + }, + { + value: 8, + label: "系统管理员5", + }, + { + value: 9, + label: "系统管理员6", + }, + { + value: 10, + label: "系统管理员7", + }, + { + value: 11, + label: "系统管理员8", + }, + { + value: 12, + label: "系统管理员9", + }, + { + value: 3, + label: "访问游客", + }, + ], + msg: "一切ok", + }, + }, + + { + url: "roles/page", + method: ["GET"], + body: { + code: "00000", + data: { + list: [ + { + id: 2, + name: "系统管理员", + code: "ADMIN", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + { + id: 3, + name: "访问游客", + code: "GUEST", + status: 1, + sort: 3, + createTime: "2021-05-26 15:49:05", + updateTime: "2019-05-05 16:00:00", + }, + { + id: 4, + name: "系统管理员1", + code: "ADMIN1", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + { + id: 5, + name: "系统管理员2", + code: "ADMIN2", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + { + id: 6, + name: "系统管理员3", + code: "ADMIN3", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + { + id: 7, + name: "系统管理员4", + code: "ADMIN4", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + { + id: 8, + name: "系统管理员5", + code: "ADMIN5", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + { + id: 9, + name: "系统管理员6", + code: "ADMIN6", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: "2023-12-04 11:43:15", + }, + { + id: 10, + name: "系统管理员7", + code: "ADMIN7", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + { + id: 11, + name: "系统管理员8", + code: "ADMIN8", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + ], + total: 10, + }, + msg: "一切ok", + }, + }, + + // 新增角色 + { + url: "roles", + method: ["POST"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "新增角色" + body.name + "成功", + }; + }, + }, + + // 获取角色表单数据 + { + url: "roles/:id/form", + method: ["GET"], + body: ({ params }) => { + return { + code: "00000", + data: roleMap[params.id], + msg: "一切ok", + }; + }, + }, + // 修改角色 + { + url: "roles/:id", + method: ["PUT"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "修改角色" + body.name + "成功", + }; + }, + }, + + // 删除角色 + { + url: "roles/:id", + method: ["DELETE"], + body({ params }) { + return { + code: "00000", + data: null, + msg: "删除角色" + params.id + "成功", + }; + }, + }, + // 获取角色拥有的菜单ID + { + url: "roles/:id/menuIds", + method: ["GET"], + body: ({}) => { + return { + code: "00000", + data: [ + 1, 2, 31, 32, 33, 88, 3, 70, 71, 72, 4, 73, 75, 74, 5, 76, 77, 78, 6, 79, 81, 84, 85, 86, + 87, 40, 41, 26, 30, 20, 21, 22, 23, 24, 89, 90, 91, 36, 37, 38, 39, 93, 94, 95, 97, 102, + 89, 90, 91, 93, 94, 95, 97, 102, 103, 104, + ], + msg: "一切ok", + }; + }, + }, + // 保存角色菜单 + { + url: "roles/:id/menus", + method: ["PUT"], + body: { + code: "00000", + data: null, + msg: "一切ok", + }, + }, +]); + +// 角色映射表数据 +const roleMap: Record = { + 2: { + id: 2, + name: "系统管理员", + code: "ADMIN", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + 3: { + id: 3, + name: "访问游客", + code: "GUEST", + status: 1, + sort: 3, + createTime: "2021-05-26 15:49:05", + updateTime: "2019-05-05 16:00:00", + }, + 4: { + id: 4, + name: "系统管理员1", + code: "ADMIN1", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + 5: { + id: 5, + name: "系统管理员2", + code: "ADMIN2", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + + 6: { + id: 6, + name: "系统管理员3", + code: "ADMIN3", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + 7: { + id: 7, + name: "系统管理员4", + code: "ADMIN4", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + 8: { + id: 8, + name: "系统管理员5", + code: "ADMIN5", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + 9: { + id: 9, + name: "系统管理员6", + code: "ADMIN6", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: "2023-12-04 11:43:15", + }, + 10: { + id: 10, + name: "系统管理员7", + code: "ADMIN7", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, + 11: { + id: 11, + name: "系统管理员8", + code: "ADMIN8", + status: 1, + sort: 2, + createTime: "2021-03-25 12:39:54", + updateTime: null, + }, +}; diff --git a/mock/user.mock.ts b/mock/user.mock.ts new file mode 100644 index 0000000..bf2fc98 --- /dev/null +++ b/mock/user.mock.ts @@ -0,0 +1,251 @@ +import { defineMock } from "./base"; + +export default defineMock([ + { + url: "users/me", + method: ["GET"], + body: { + code: "00000", + data: { + userId: 2, + username: "admin", + nickname: "系统管理员", + avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif", + roles: ["ADMIN"], + perms: [ + "sys:user:query", + "sys:user:add", + "sys:user:edit", + "sys:user:delete", + "sys:user:import", + "sys:user:export", + "sys:user:reset-password", + + "sys:role:query", + "sys:role:add", + "sys:role:edit", + "sys:role:delete", + + "sys:dept:query", + "sys:dept:add", + "sys:dept:edit", + "sys:dept:delete", + + "sys:menu:query", + "sys:menu:add", + "sys:menu:edit", + "sys:menu:delete", + + "sys:dict:query", + "sys:dict:add", + "sys:dict:edit", + "sys:dict:delete", + "sys:dict:delete", + + "sys:dict-item:query", + "sys:dict-item:add", + "sys:dict-item:edit", + "sys:dict-item:delete", + + "sys:notice:query", + "sys:notice:add", + "sys:notice:edit", + "sys:notice:delete", + "sys:notice:revoke", + "sys:notice:publish", + + "sys:config:query", + "sys:config:add", + "sys:config:update", + "sys:config:delete", + "sys:config:refresh", + ], + }, + msg: "一切ok", + }, + }, + + { + url: "users/page", + method: ["GET"], + body: { + code: "00000", + data: { + list: [ + { + id: 2, + username: "admin", + nickname: "系统管理员", + mobile: "17621210366", + gender: 1, + avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif", + email: "", + status: 1, + deptId: 1, + roleIds: [2], + }, + { + id: 3, + username: "test", + nickname: "测试小用户", + mobile: "17621210366", + gender: 1, + avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif", + email: "youlaitech@163.com", + status: 1, + deptId: 3, + roleIds: [3], + }, + ], + total: 2, + }, + msg: "一切ok", + }, + }, + + // 新增用户 + { + url: "users", + method: ["POST"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "新增用户" + body.nickname + "成功", + }; + }, + }, + + // 获取用户表单数据 + { + url: "users/:userId/form", + method: ["GET"], + body: ({ params }) => { + return { + code: "00000", + data: userMap[params.userId], + msg: "一切ok", + }; + }, + }, + // 修改用户 + { + url: "users/:userId", + method: ["PUT"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "修改用户" + body.nickname + "成功", + }; + }, + }, + + // 删除用户 + { + url: "users/:userId", + method: ["DELETE"], + body({ params }) { + return { + code: "00000", + data: null, + msg: "删除用户" + params.id + "成功", + }; + }, + }, + + // 重置密码 + { + url: "users/:userId/password/reset", + method: ["PUT"], + body({ query }) { + return { + code: "00000", + data: null, + msg: "重置密码成功,新密码为:" + query.password, + }; + }, + }, + + // 导出Excel + { + url: "users/_export", + method: ["GET"], + headers: { + "Content-Disposition": "attachment; filename=%E7%94%A8%E6%88%B7%E5%88%97%E8%A1%A8.xlsx", + "Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + }, + }, + + { + url: "users/profile", + method: ["GET"], + body: { + code: "00000", + data: { + id: 2, + username: "admin", + nickname: "系统管理员", + avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif", + gender: 1, + mobile: "17621210366", + email: null, + deptName: "有来技术", + roleNames: "系统管理员", + createTime: "2019-10-10", + }, + }, + }, + + { + url: "users/profile", + method: ["PUT"], + body() { + return { + code: "00000", + data: null, + msg: "修改个人信息成功", + }; + }, + }, + + { + url: "users/password", + method: ["PUT"], + body() { + return { + code: "00000", + data: null, + msg: "修改密码成功", + }; + }, + }, +]); + +// 用户映射表数据 +const userMap: Record = { + 2: { + id: 2, + username: "admin", + nickname: "系统管理员", + mobile: "17621210366", + gender: 1, + avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif", + email: "", + status: 1, + deptId: 1, + roleIds: [2], + }, + 3: { + id: 3, + username: "test", + nickname: "测试小用户", + mobile: "17621210366", + gender: 1, + avatar: "https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif", + email: "youlaitech@163.com", + status: 1, + deptId: 3, + roleIds: [3], + }, +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..eff8195 --- /dev/null +++ b/package.json @@ -0,0 +1,128 @@ +{ + "name": "vue3-element-admin", + "description": "Vue3 + Vite + TypeScript + Element-Plus 的后台管理模板,vue-element-admin 的 Vue3 版本", + "version": "3.0.0", + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "vue-tsc --noEmit & vite build", + "preview": "vite preview", + "build-only": "vite build", + "type-check": "vue-tsc --noEmit", + "lint:eslint": "eslint --cache \"src/**/*.{vue,ts,js}\" --fix", + "lint:prettier": "prettier --write \"**/*.{js,cjs,ts,json,css,scss,vue,html,md}\"", + "lint:stylelint": "stylelint --cache \"**/*.{css,scss,vue}\" --fix", + "lint:lint-staged": "lint-staged", + "lint": "npm run lint:eslint && npm run lint:prettier && npm run lint:stylelint", + "preinstall": "npx only-allow pnpm", + "prepare": "husky", + "commit": "git-cz" + }, + "config": { + "commitizen": { + "path": "node_modules/cz-git" + } + }, + "lint-staged": { + "*.{js,ts}": [ + "eslint --fix", + "prettier --write" + ], + "*.{cjs,json}": [ + "prettier --write" + ], + "*.{vue,html}": [ + "eslint --fix", + "prettier --write", + "stylelint --fix" + ], + "*.{scss,css}": [ + "stylelint --fix", + "prettier --write" + ], + "*.md": [ + "prettier --write" + ] + }, + "dependencies": { + "@element-plus/icons-vue": "^2.3.1", + "@stomp/stompjs": "^7.1.1", + "@vueuse/core": "^12.8.2", + "@wangeditor-next/editor": "^5.6.34", + "@wangeditor-next/editor-for-vue": "^5.1.14", + "animate.css": "^4.1.1", + "axios": "^1.9.0", + "codemirror": "^5.65.19", + "codemirror-editor-vue3": "^2.8.0", + "default-passive-events": "^2.0.0", + "echarts": "^5.6.0", + "element-plus": "^2.9.11", + "exceljs": "^4.4.0", + "lodash-es": "^4.17.21", + "nprogress": "^0.2.0", + "path-browserify": "^1.0.1", + "path-to-regexp": "^8.2.0", + "pinia": "^3.0.3", + "qs": "^6.14.0", + "sortablejs": "^1.15.6", + "vue": "^3.5.16", + "vue-draggable-plus": "^0.6.0", + "vue-i18n": "^11.1.5", + "vue-router": "^4.5.1" + }, + "devDependencies": { + "@commitlint/cli": "^19.8.1", + "@commitlint/config-conventional": "^19.8.1", + "@eslint/js": "^9.28.0", + "@iconify/utils": "^2.3.0", + "@types/codemirror": "^5.60.16", + "@types/lodash-es": "^4.17.12", + "@types/node": "^22.15.29", + "@types/nprogress": "^0.2.3", + "@types/path-browserify": "^1.0.3", + "@types/qs": "^6.14.0", + "@types/sortablejs": "^1.15.8", + "@typescript-eslint/eslint-plugin": "^8.33.1", + "@typescript-eslint/parser": "^8.33.1", + "@vitejs/plugin-vue": "^5.2.4", + "autoprefixer": "^10.4.21", + "commitizen": "^4.3.1", + "cz-git": "^1.11.1", + "eslint": "^9.28.0", + "eslint-config-prettier": "^10.1.5", + "eslint-plugin-prettier": "^5.4.1", + "eslint-plugin-vue": "^10.1.0", + "globals": "^15.15.0", + "husky": "^9.1.7", + "lint-staged": "^15.5.2", + "postcss": "^8.5.4", + "postcss-html": "^1.8.0", + "postcss-scss": "^4.0.9", + "prettier": "^3.5.3", + "sass": "^1.89.1", + "stylelint": "^16.20.0", + "stylelint-config-html": "^1.1.0", + "stylelint-config-recess-order": "^6.0.0", + "stylelint-config-recommended": "^15.0.0", + "stylelint-config-recommended-scss": "^14.1.0", + "stylelint-config-recommended-vue": "^1.6.0", + "stylelint-prettier": "^5.0.3", + "terser": "^5.41.0", + "typescript": "^5.8.3", + "typescript-eslint": "^8.33.1", + "unocss": "65.4.3", + "unplugin-auto-import": "^19.3.0", + "unplugin-vue-components": "^28.7.0", + "vite": "^6.3.5", + "vite-plugin-mock-dev-server": "^1.8.7", + "vue-eslint-parser": "^10.1.3", + "vue-tsc": "^2.2.10" + }, + "engines": { + "node": ">=18.0.0" + }, + "repository": "https://gitee.com/youlaiorg/vue3-element-admin.git", + "author": "有来开源组织", + "license": "MIT" +} diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..5e82ccc Binary files /dev/null and b/public/favicon.ico differ diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..7a5f3ff --- /dev/null +++ b/src/App.vue @@ -0,0 +1,32 @@ + + + diff --git a/src/api/auth.api.ts b/src/api/auth.api.ts new file mode 100644 index 0000000..772e9ef --- /dev/null +++ b/src/api/auth.api.ts @@ -0,0 +1,86 @@ +import request from "@/utils/request"; + +const AUTH_BASE_URL = "/api/v1/auth"; + +const AuthAPI = { + /** 登录接口*/ + login(data: LoginFormData) { + const formData = new FormData(); + formData.append("username", data.username); + formData.append("password", data.password); + formData.append("captchaKey", data.captchaKey); + formData.append("captchaCode", data.captchaCode); + return request({ + url: `${AUTH_BASE_URL}/login`, + method: "post", + data: formData, + headers: { + "Content-Type": "multipart/form-data", + }, + }); + }, + + /** 刷新 token 接口*/ + refreshToken(refreshToken: string) { + return request({ + url: `${AUTH_BASE_URL}/refresh-token`, + method: "post", + params: { refreshToken }, + headers: { + Authorization: "no-auth", + }, + }); + }, + + /** 退出登录接口 */ + logout() { + return request({ + url: `${AUTH_BASE_URL}/logout`, + method: "delete", + }); + }, + + /** 获取验证码接口*/ + getCaptcha() { + return request({ + url: `${AUTH_BASE_URL}/captcha`, + method: "get", + }); + }, +}; + +export default AuthAPI; + +/** 登录表单数据 */ +export interface LoginFormData { + /** 用户名 */ + username: string; + /** 密码 */ + password: string; + /** 验证码缓存key */ + captchaKey: string; + /** 验证码 */ + captchaCode: string; + /** 记住我 */ + rememberMe: boolean; +} + +/** 登录响应 */ +export interface LoginResult { + /** 访问令牌 */ + accessToken: string; + /** 刷新令牌 */ + refreshToken: string; + /** 令牌类型 */ + tokenType: string; + /** 过期时间(秒) */ + expiresIn: number; +} + +/** 验证码信息 */ +export interface CaptchaInfo { + /** 验证码缓存key */ + captchaKey: string; + /** 验证码图片Base64字符串 */ + captchaBase64: string; +} diff --git a/src/api/codegen.api.ts b/src/api/codegen.api.ts new file mode 100644 index 0000000..cddee81 --- /dev/null +++ b/src/api/codegen.api.ts @@ -0,0 +1,191 @@ +import request from "@/utils/request"; + +const GENERATOR_BASE_URL = "/api/v1/codegen"; + +const GeneratorAPI = { + /** 获取数据表分页列表 */ + getTablePage(params: TablePageQuery) { + return request>({ + url: `${GENERATOR_BASE_URL}/table/page`, + method: "get", + params, + }); + }, + + /** 获取代码生成配置 */ + getGenConfig(tableName: string) { + return request({ + url: `${GENERATOR_BASE_URL}/${tableName}/config`, + method: "get", + }); + }, + + /** 获取代码生成配置 */ + saveGenConfig(tableName: string, data: GenConfigForm) { + return request({ + url: `${GENERATOR_BASE_URL}/${tableName}/config`, + method: "post", + data, + }); + }, + + /** 获取代码生成预览数据 */ + getPreviewData(tableName: string) { + return request({ + url: `${GENERATOR_BASE_URL}/${tableName}/preview`, + method: "get", + }); + }, + + /** 重置代码生成配置 */ + resetGenConfig(tableName: string) { + return request({ + url: `${GENERATOR_BASE_URL}/${tableName}/config`, + method: "delete", + }); + }, + + /** + * 下载 ZIP 文件 + * @param url + * @param fileName + */ + download(tableName: string) { + return request({ + url: `${GENERATOR_BASE_URL}/${tableName}/download`, + method: "get", + responseType: "blob", + }).then((response) => { + const fileName = decodeURI( + response.headers["content-disposition"].split(";")[1].split("=")[1] + ); + + const blob = new Blob([response.data], { type: "application/zip" }); + const a = document.createElement("a"); + const url = window.URL.createObjectURL(blob); + a.href = url; + a.download = fileName; + a.click(); + window.URL.revokeObjectURL(url); + }); + }, +}; + +export default GeneratorAPI; + +/** 代码生成预览对象 */ +export interface GeneratorPreviewVO { + /** 文件生成路径 */ + path: string; + /** 文件名称 */ + fileName: string; + /** 文件内容 */ + content: string; +} + +/** 数据表分页查询参数 */ +export interface TablePageQuery extends PageQuery { + /** 关键字(表名) */ + keywords?: string; +} + +/** 数据表分页对象 */ +export interface TablePageVO { + /** 表名称 */ + tableName: string; + + /** 表描述 */ + tableComment: string; + + /** 存储引擎 */ + engine: string; + + /** 字符集排序规则 */ + tableCollation: string; + + /** 创建时间 */ + createTime: string; +} + +/** 代码生成配置表单 */ +export interface GenConfigForm { + /** 主键 */ + id?: string; + + /** 表名 */ + tableName?: string; + + /** 业务名 */ + businessName?: string; + + /** 模块名 */ + moduleName?: string; + + /** 包名 */ + packageName?: string; + + /** 实体名 */ + entityName?: string; + + /** 作者 */ + author?: string; + + /** 上级菜单 */ + parentMenuId?: string; + + /** 后端应用名 */ + backendAppName?: string; + /** 前端应用名 */ + frontendAppName?: string; + + /** 字段配置列表 */ + fieldConfigs?: FieldConfig[]; +} + +/** 字段配置 */ +export interface FieldConfig { + /** 主键 */ + id?: string; + + /** 列名 */ + columnName?: string; + + /** 列类型 */ + columnType?: string; + + /** 字段名 */ + fieldName?: string; + + /** 字段类型 */ + fieldType?: string; + + /** 字段描述 */ + fieldComment?: string; + + /** 是否在列表显示 */ + isShowInList?: number; + + /** 是否在表单显示 */ + isShowInForm?: number; + + /** 是否在查询条件显示 */ + isShowInQuery?: number; + + /** 是否必填 */ + isRequired?: number; + + /** 表单类型 */ + formType?: number; + + /** 查询类型 */ + queryType?: number; + + /** 字段长度 */ + maxLength?: number; + + /** 字段排序 */ + fieldSort?: number; + + /** 字典类型 */ + dictType?: string; +} diff --git a/src/api/file.api.ts b/src/api/file.api.ts new file mode 100644 index 0000000..504d916 --- /dev/null +++ b/src/api/file.api.ts @@ -0,0 +1,81 @@ +import request from "@/utils/request"; + +const FileAPI = { + /** + * 上传文件 + * + * @param formData + */ + upload(formData: FormData) { + return request({ + url: "/api/v1/files", + method: "post", + data: formData, + headers: { + "Content-Type": "multipart/form-data", + }, + }); + }, + + /** + * 上传文件 + */ + uploadFile(file: File) { + const formData = new FormData(); + formData.append("file", file); + return request({ + url: "/api/v1/files", + method: "post", + data: formData, + headers: { + "Content-Type": "multipart/form-data", + }, + }); + }, + + /** + * 删除文件 + * + * @param filePath 文件完整路径 + */ + delete(filePath?: string) { + return request({ + url: "/api/v1/files", + method: "delete", + params: { filePath }, + }); + }, + + /** + * 下载文件 + * @param url + * @param fileName + */ + download(url: string, fileName?: string) { + return request({ + url, + method: "get", + responseType: "blob", + }).then((res) => { + const blob = new Blob([res.data]); + const a = document.createElement("a"); + const url = window.URL.createObjectURL(blob); + a.href = url; + a.download = fileName || "下载文件"; + a.click(); + window.URL.revokeObjectURL(url); + }); + }, +}; + +export default FileAPI; + +/** + * 文件API类型声明 + */ +export interface FileInfo { + /** 文件名 */ + name: string; + /** 文件路径 */ + url: string; +} diff --git a/src/api/system/config.api.ts b/src/api/system/config.api.ts new file mode 100644 index 0000000..42ba767 --- /dev/null +++ b/src/api/system/config.api.ts @@ -0,0 +1,95 @@ +import request from "@/utils/request"; + +const CONFIG_BASE_URL = "/api/v1/config"; + +const ConfigAPI = { + /** 系统配置分页 */ + getPage(queryParams?: ConfigPageQuery) { + return request>({ + url: `${CONFIG_BASE_URL}/page`, + method: "get", + params: queryParams, + }); + }, + + /** 系统配置表单数据 */ + getFormData(id: string) { + return request({ + url: `${CONFIG_BASE_URL}/${id}/form`, + method: "get", + }); + }, + + /** 新增系统配置 */ + create(data: ConfigForm) { + return request({ + url: `${CONFIG_BASE_URL}`, + method: "post", + data, + }); + }, + + /** 更新系统配置 */ + update(id: string, data: ConfigForm) { + return request({ + url: `${CONFIG_BASE_URL}/${id}`, + method: "put", + data, + }); + }, + + /** + * 删除系统配置 + * + * @param ids 系统配置ID + */ + deleteById(id: string) { + return request({ + url: `${CONFIG_BASE_URL}/${id}`, + method: "delete", + }); + }, + + refreshCache() { + return request({ + url: `${CONFIG_BASE_URL}/refresh`, + method: "PUT", + }); + }, +}; + +export default ConfigAPI; + +/** $系统配置分页查询参数 */ +export interface ConfigPageQuery extends PageQuery { + /** 搜索关键字 */ + keywords?: string; +} + +/** 系统配置表单对象 */ +export interface ConfigForm { + /** 主键 */ + id?: string; + /** 配置名称 */ + configName?: string; + /** 配置键 */ + configKey?: string; + /** 配置值 */ + configValue?: string; + /** 描述、备注 */ + remark?: string; +} + +/** 系统配置分页对象 */ +export interface ConfigPageVO { + /** 主键 */ + id?: string; + /** 配置名称 */ + configName?: string; + /** 配置键 */ + configKey?: string; + /** 配置值 */ + configValue?: string; + /** 描述、备注 */ + remark?: string; +} diff --git a/src/api/system/dept.api.ts b/src/api/system/dept.api.ts new file mode 100644 index 0000000..6182a55 --- /dev/null +++ b/src/api/system/dept.api.ts @@ -0,0 +1,130 @@ +import request from "@/utils/request"; + +const DEPT_BASE_URL = "/api/v1/dept"; + +const DeptAPI = { + /** + * 获取部门列表 + * + * @param queryParams 查询参数(可选) + * @returns 部门树形表格数据 + */ + getList(queryParams?: DeptQuery) { + return request({ + url: `${DEPT_BASE_URL}`, + method: "get", + params: queryParams, + }); + }, + + /** 获取部门下拉列表 */ + getOptions() { + return request({ + url: `${DEPT_BASE_URL}/options`, + method: "get", + }); + }, + + /** + * 获取部门表单数据 + * + * @param id 部门ID + * @returns 部门表单数据 + */ + getFormData(id: string) { + return request({ + url: `${DEPT_BASE_URL}/${id}/form`, + method: "get", + }); + }, + + /** + * 新增部门 + * + * @param data 部门表单数据 + * @returns 请求结果 + */ + create(data: DeptForm) { + return request({ + url: `${DEPT_BASE_URL}`, + method: "post", + data, + }); + }, + + /** + * 修改部门 + * + * @param id 部门ID + * @param data 部门表单数据 + * @returns 请求结果 + */ + update(id: string, data: DeptForm) { + return request({ + url: `${DEPT_BASE_URL}/${id}`, + method: "put", + data, + }); + }, + + /** + * 删除部门 + * + * @param ids 部门ID,多个以英文逗号(,)分隔 + * @returns 请求结果 + */ + deleteByIds(ids: string) { + return request({ + url: `${DEPT_BASE_URL}/${ids}`, + method: "delete", + }); + }, +}; + +export default DeptAPI; + +/** 部门查询参数 */ +export interface DeptQuery { + /** 搜索关键字 */ + keywords?: string; + /** 状态 */ + status?: number; +} + +/** 部门类型 */ +export interface DeptVO { + /** 子部门 */ + children?: DeptVO[]; + /** 创建时间 */ + createTime?: Date; + /** 部门ID */ + id?: string; + /** 部门名称 */ + name?: string; + /** 部门编号 */ + code?: string; + /** 父部门ID */ + parentid?: string; + /** 排序 */ + sort?: number; + /** 状态(1:启用;0:禁用) */ + status?: number; + /** 修改时间 */ + updateTime?: Date; +} + +/** 部门表单类型 */ +export interface DeptForm { + /** 部门ID(新增不填) */ + id?: string; + /** 部门名称 */ + name?: string; + /** 部门编号 */ + code?: string; + /** 父部门ID */ + parentId: string; + /** 排序 */ + sort?: number; + /** 状态(1:启用;0:禁用) */ + status?: number; +} diff --git a/src/api/system/dict.api.ts b/src/api/system/dict.api.ts new file mode 100644 index 0000000..0f8a4fd --- /dev/null +++ b/src/api/system/dict.api.ts @@ -0,0 +1,310 @@ +import request from "@/utils/request"; + +const DICT_BASE_URL = "/api/v1/dicts"; + +const DictAPI = { + //--------------------------------------------------- + // 字典相关接口 + //--------------------------------------------------- + + /** + * 字典分页列表 + * + * @param queryParams 查询参数 + * @returns 字典分页结果 + */ + getPage(queryParams: DictPageQuery) { + return request>({ + url: `${DICT_BASE_URL}/page`, + method: "get", + params: queryParams, + }); + }, + + /** + * 字典列表 + * + * @returns 字典列表 + */ + getList() { + return request({ + url: `${DICT_BASE_URL}`, + method: "get", + }); + }, + + /** + * 字典表单数据 + * + * @param id 字典ID + * @returns 字典表单数据 + */ + getFormData(id: string) { + return request({ + url: `${DICT_BASE_URL}/${id}/form`, + method: "get", + }); + }, + + /** + * 新增字典 + * + * @param data 字典表单数据 + */ + create(data: DictForm) { + return request({ + url: `${DICT_BASE_URL}`, + method: "post", + data, + }); + }, + + /** + * 修改字典 + * + * @param id 字典ID + * @param data 字典表单数据 + */ + update(id: string, data: DictForm) { + return request({ + url: `${DICT_BASE_URL}/${id}`, + method: "put", + data, + }); + }, + + /** + * 删除字典 + * + * @param ids 字典ID,多个以英文逗号(,)分隔 + */ + deleteByIds(ids: string) { + return request({ + url: `${DICT_BASE_URL}/${ids}`, + method: "delete", + }); + }, + + //--------------------------------------------------- + // 字典项相关接口 + //--------------------------------------------------- + /** + * 获取字典分页列表 + * + * @param queryParams 查询参数 + * @returns 字典分页结果 + */ + getDictItemPage(dictCode: string, queryParams: DictItemPageQuery) { + return request>({ + url: `${DICT_BASE_URL}/${dictCode}/items/page`, + method: "get", + params: queryParams, + }); + }, + + /** + * 获取字典项列表 + */ + getDictItems(dictCode: string) { + return request({ + url: `${DICT_BASE_URL}/${dictCode}/items`, + method: "get", + }); + }, + + /** + * 新增字典项 + */ + createDictItem(dictCode: string, data: DictItemForm) { + return request({ + url: `${DICT_BASE_URL}/${dictCode}/items`, + method: "post", + data, + }); + }, + + /** + * 获取字典项表单数据 + * + * @param id 字典项ID + * @returns 字典项表单数据 + */ + getDictItemFormData(dictCode: string, id: string) { + return request({ + url: `${DICT_BASE_URL}/${dictCode}/items/${id}/form`, + method: "get", + }); + }, + + /** + * 修改字典项 + */ + updateDictItem(dictCode: string, id: string, data: DictItemForm) { + return request({ + url: `${DICT_BASE_URL}/${dictCode}/items/${id}`, + method: "put", + data, + }); + }, + + /** + * 删除字典项 + */ + deleteDictItems(dictCode: string, ids: string) { + return request({ + url: `${DICT_BASE_URL}/${dictCode}/items/${ids}`, + method: "delete", + }); + }, +}; + +export default DictAPI; + +/** + * 字典查询参数 + */ +export interface DictPageQuery extends PageQuery { + /** + * 关键字(字典名称/编码) + */ + keywords?: string; + + /** + * 字典状态(1:启用,0:禁用) + */ + status?: number; +} + +/** + * 字典分页对象 + */ +export interface DictPageVO { + /** + * 字典ID + */ + id: string; + /** + * 字典名称 + */ + name: string; + /** + * 字典编码 + */ + dictCode: string; + /** + * 字典状态(1:启用,0:禁用) + */ + status: number; +} + +/** + * 字典 + */ +export interface DictForm { + /** + * 字典ID + */ + id?: string; + /** + * 字典名称 + */ + name?: string; + /** + * 字典编码 + */ + dictCode?: string; + /** + * 字典状态(1-启用,0-禁用) + */ + status?: number; + /** + * 备注 + */ + remark?: string; +} + +/** + * 字典查询参数 + */ +export interface DictItemPageQuery extends PageQuery { + /** 关键字(字典数据值/标签) */ + keywords?: string; + + /** 字典编码 */ + dictCode?: string; +} + +/** + * 字典分页对象 + */ +export interface DictItemPageVO { + /** + * 字典ID + */ + id: string; + /** + * 字典编码 + */ + dictCode: string; + /** + * 字典数据值 + */ + value: string; + /** + * 字典数据标签 + */ + label: string; + /** + * 状态(1:启用,0:禁用) + */ + status: number; + /** + * 字典排序 + */ + sort?: number; +} + +/** + * 字典 + */ +export interface DictItemForm { + /** + * 字典ID + */ + id?: string; + /** + * 字典编码 + */ + dictCode?: string; + /** + * 字典数据值 + */ + value?: string; + /** + * 字典数据标签 + */ + label?: string; + /** + * 状态(1:启用,0:禁用) + */ + status?: number; + /** + * 字典排序 + */ + sort?: number; + + /** + * 标签类型 + */ + tagType?: "success" | "warning" | "info" | "primary" | "danger" | ""; +} + +/** + * 字典项下拉选项 + */ +export interface DictItemOption { + value: number | string; + label: string; + tagType?: "" | "success" | "info" | "warning" | "danger"; + [key: string]: any; +} diff --git a/src/api/system/log.api.ts b/src/api/system/log.api.ts new file mode 100644 index 0000000..402478a --- /dev/null +++ b/src/api/system/log.api.ts @@ -0,0 +1,121 @@ +import request from "@/utils/request"; + +const LOG_BASE_URL = "/api/v1/logs"; + +const LogAPI = { + /** + * 获取日志分页列表 + * + * @param queryParams 查询参数 + */ + getPage(queryParams: LogPageQuery) { + return request>({ + url: `${LOG_BASE_URL}/page`, + method: "get", + params: queryParams, + }); + }, + + /** + * 获取访问趋势 + * + * @param queryParams + * @returns + */ + getVisitTrend(queryParams: VisitTrendQuery) { + return request({ + url: `${LOG_BASE_URL}/visit-trend`, + method: "get", + params: queryParams, + }); + }, + + /** + * 获取访问统计 + * + * @param queryParams + * @returns + */ + getVisitStats() { + return request({ + url: `${LOG_BASE_URL}/visit-stats`, + method: "get", + }); + }, +}; + +export default LogAPI; + +/** + * 日志分页查询对象 + */ +export interface LogPageQuery extends PageQuery { + /** 搜索关键字 */ + keywords?: string; + /** 操作时间 */ + createTime?: [string, string]; +} + +/** + * 系统日志分页VO + */ +export interface LogPageVO { + /** 主键 */ + id: string; + /** 日志模块 */ + module: string; + /** 日志内容 */ + content: string; + /** 请求路径 */ + requestUri: string; + /** 请求方法 */ + method: string; + /** IP 地址 */ + ip: string; + /** 地区 */ + region: string; + /** 浏览器 */ + browser: string; + /** 终端系统 */ + os: string; + /** 执行时间(毫秒) */ + executionTime: number; + /** 操作人 */ + operator: string; +} + +/** 访问趋势视图对象 */ +export interface VisitTrendVO { + /** 日期列表 */ + dates: string[]; + /** 浏览量(PV) */ + pvList: number[]; + /** 访客数(UV) */ + uvList: number[]; + /** IP数 */ + ipList: number[]; +} + +/** 访问趋势查询参数 */ +export interface VisitTrendQuery { + /** 开始日期 */ + startDate: string; + /** 结束日期 */ + endDate: string; +} + +/** 访问统计 */ +export interface VisitStatsVO { + /** 今日访客数(UV) */ + todayUvCount: number; + /** 总访客数 */ + totalUvCount: number; + /** 访客数同比增长率(相对于昨天同一时间段的增长率) */ + uvGrowthRate: number; + /** 今日浏览量(PV) */ + todayPvCount: number; + /** 总浏览量 */ + totalPvCount: number; + /** 同比增长率(相对于昨天同一时间段的增长率) */ + pvGrowthRate: number; +} diff --git a/src/api/system/menu.api.ts b/src/api/system/menu.api.ts new file mode 100644 index 0000000..45f95b3 --- /dev/null +++ b/src/api/system/menu.api.ts @@ -0,0 +1,209 @@ +import request from "@/utils/request"; +// 菜单基础URL +const MENU_BASE_URL = "/api/v1/menus"; + +const MenuAPI = { + /** + * 获取当前用户的路由列表 + *

+ * 无需传入角色,后端解析token获取角色自行判断是否拥有路由的权限 + * + * @returns 路由列表 + */ + getRoutes() { + return request({ + url: `${MENU_BASE_URL}/routes`, + method: "get", + }); + }, + + /** + * 获取菜单树形列表 + * + * @param queryParams 查询参数 + * @returns 菜单树形列表 + */ + getList(queryParams: MenuQuery) { + return request({ + url: `${MENU_BASE_URL}`, + method: "get", + params: queryParams, + }); + }, + + /** + * 获取菜单下拉数据源 + * + * @returns 菜单下拉数据源 + */ + getOptions(onlyParent?: boolean) { + return request({ + url: `${MENU_BASE_URL}/options`, + method: "get", + params: { onlyParent }, + }); + }, + + /** + * 获取菜单表单数据 + * + * @param id 菜单ID + */ + getFormData(id: string) { + return request({ + url: `${MENU_BASE_URL}/${id}/form`, + method: "get", + }); + }, + + /** + * 添加菜单 + * + * @param data 菜单表单数据 + * @returns 请求结果 + */ + create(data: MenuForm) { + return request({ + url: `${MENU_BASE_URL}`, + method: "post", + data, + }); + }, + + /** + * 修改菜单 + * + * @param id 菜单ID + * @param data 菜单表单数据 + * @returns 请求结果 + */ + update(id: string, data: MenuForm) { + return request({ + url: `${MENU_BASE_URL}/${id}`, + method: "put", + data, + }); + }, + + /** + * 删除菜单 + * + * @param id 菜单ID + * @returns 请求结果 + */ + deleteById(id: string) { + return request({ + url: `${MENU_BASE_URL}/${id}`, + method: "delete", + }); + }, +}; + +export default MenuAPI; + +import type { MenuTypeEnum } from "@/enums/system/menu.enum"; + +/** 菜单查询参数 */ +export interface MenuQuery { + /** 搜索关键字 */ + keywords?: string; +} + +/** 菜单视图对象 */ +export interface MenuVO { + /** 子菜单 */ + children?: MenuVO[]; + /** 组件路径 */ + component?: string; + /** ICON */ + icon?: string; + /** 菜单ID */ + id?: string; + /** 菜单名称 */ + name?: string; + /** 父菜单ID */ + parentId?: string; + /** 按钮权限标识 */ + perm?: string; + /** 跳转路径 */ + redirect?: string; + /** 路由名称 */ + routeName?: string; + /** 路由相对路径 */ + routePath?: string; + /** 菜单排序(数字越小排名越靠前) */ + sort?: number; + /** 菜单 */ + type?: MenuTypeEnum; + /** 菜单是否可见(1:显示;0:隐藏) */ + visible?: number; +} + +/** 菜单表单对象 */ +export interface MenuForm { + /** 菜单ID */ + id?: string; + /** 父菜单ID */ + parentId?: string; + /** 菜单名称 */ + name?: string; + /** 菜单是否可见(1-是 0-否) */ + visible: number; + /** ICON */ + icon?: string; + /** 排序 */ + sort?: number; + /** 路由名称 */ + routeName?: string; + /** 路由路径 */ + routePath?: string; + /** 组件路径 */ + component?: string; + /** 跳转路由路径 */ + redirect?: string; + /** 菜单 */ + type?: MenuTypeEnum; + /** 权限标识 */ + perm?: string; + /** 【菜单】是否开启页面缓存 */ + keepAlive?: number; + /** 【目录】只有一个子路由是否始终显示 */ + alwaysShow?: number; + /** 参数 */ + params?: KeyValue[]; +} + +interface KeyValue { + key: string; + value: string; +} + +/** RouteVO,路由对象 */ +export interface RouteVO { + /** 子路由列表 */ + children: RouteVO[]; + /** 组件路径 */ + component?: string; + /** 路由属性 */ + meta?: Meta; + /** 路由名称 */ + name?: string; + /** 路由路径 */ + path?: string; + /** 跳转链接 */ + redirect?: string; +} + +/** Meta,路由属性 */ +export interface Meta { + /** 【目录】只有一个子路由是否始终显示 */ + alwaysShow?: boolean; + /** 是否隐藏(true-是 false-否) */ + hidden?: boolean; + /** ICON */ + icon?: string; + /** 【菜单】是否开启页面缓存 */ + keepAlive?: boolean; + /** 路由title */ + title?: string; +} diff --git a/src/api/system/notice.api.ts b/src/api/system/notice.api.ts new file mode 100644 index 0000000..471c5e7 --- /dev/null +++ b/src/api/system/notice.api.ts @@ -0,0 +1,199 @@ +import request from "@/utils/request"; + +const NOTICE_BASE_URL = "/api/v1/notices"; + +const NoticeAPI = { + /** 获取通知公告分页数据 */ + getPage(queryParams?: NoticePageQuery) { + return request>({ + url: `${NOTICE_BASE_URL}/page`, + method: "get", + params: queryParams, + }); + }, + + /** + * 获取通知公告表单数据 + * + * @param id 通知 + * @returns 通知表单数据 + */ + getFormData(id: string) { + return request({ + url: `${NOTICE_BASE_URL}/${id}/form`, + method: "get", + }); + }, + + /** + * 添加通知公告 + * + * @param data 通知表单数据 + * @returns + */ + create(data: NoticeForm) { + return request({ + url: `${NOTICE_BASE_URL}`, + method: "post", + data, + }); + }, + + /** + * 更新通知公告 + * + * @param id 通知ID + * @param data 通知表单数据 + */ + update(id: string, data: NoticeForm) { + return request({ + url: `${NOTICE_BASE_URL}/${id}`, + method: "put", + data, + }); + }, + + /** + * 批量删除通知公告,多个以英文逗号(,)分割 + * + * @param ids 通知公告ID字符串,多个以英文逗号(,)分割 + */ + deleteByIds(ids: string) { + return request({ + url: `${NOTICE_BASE_URL}/${ids}`, + method: "delete", + }); + }, + + /** + * 发布通知 + * + * @param id 被发布的通知公告id + * @returns + */ + publish(id: string) { + return request({ + url: `${NOTICE_BASE_URL}/${id}/publish`, + method: "put", + }); + }, + + /** + * 撤回通知 + * + * @param id 撤回的通知id + * @returns + */ + revoke(id: string) { + return request({ + url: `${NOTICE_BASE_URL}/${id}/revoke`, + method: "put", + }); + }, + /** + * 查看通知 + * + * @param id + */ + getDetail(id: string) { + return request({ + url: `${NOTICE_BASE_URL}/${id}/detail`, + method: "get", + }); + }, + + /* 全部已读 */ + readAll() { + return request({ + url: `${NOTICE_BASE_URL}/read-all`, + method: "put", + }); + }, + + /** 获取我的通知分页列表 */ + getMyNoticePage(queryParams?: NoticePageQuery) { + return request>({ + url: `${NOTICE_BASE_URL}/my-page`, + method: "get", + params: queryParams, + }); + }, +}; + +export default NoticeAPI; + +/** 通知公告分页查询参数 */ +export interface NoticePageQuery extends PageQuery { + /** 标题 */ + title?: string; + /** 发布状态(0:未发布,1:已发布,-1:已撤回) */ + publishStatus?: number; + + isRead?: number; +} + +/** 通知公告表单对象 */ +export interface NoticeForm { + id?: string; + /** 通知标题 */ + title?: string; + /** 通知内容 */ + content?: string; + /** 通知类型 */ + type?: number; + /** 优先级(L:低,M:中,H:高) */ + level?: string; + /** 目标类型(1-全体 2-指定) */ + targetType?: number; + /** 目标ID合集,以,分割 */ + targetUserIds?: string; +} + +/** 通知公告分页对象 */ +export interface NoticePageVO { + id: string; + /** 通知标题 */ + title?: string; + /** 通知内容 */ + content?: string; + /** 通知类型 */ + type?: number; + /** 发布人 */ + publisherId?: bigint; + /** 优先级(0-低 1-中 2-高) */ + priority?: number; + /** 目标类型(0-全体 1-指定) */ + targetType?: number; + /** 发布状态(0-未发布 1已发布 2已撤回) */ + publishStatus?: number; + /** 发布时间 */ + publishTime?: Date; + /** 撤回时间 */ + revokeTime?: Date; +} + +export interface NoticeDetailVO { + /** 通知ID */ + id?: string; + + /** 通知标题 */ + title?: string; + + /** 通知内容 */ + content?: string; + + /** 通知类型 */ + type?: number; + + /** 发布人 */ + publisherName?: string; + + /** 优先级(L-低 M-中 H-高) */ + level?: string; + + /** 发布时间 */ + publishTime?: Date; + + /** 发布状态 */ + publishStatus?: number; +} diff --git a/src/api/system/role.api.ts b/src/api/system/role.api.ts new file mode 100644 index 0000000..6a822ef --- /dev/null +++ b/src/api/system/role.api.ts @@ -0,0 +1,138 @@ +import request from "@/utils/request"; + +const ROLE_BASE_URL = "/api/v1/roles"; + +const RoleAPI = { + /** 获取角色分页数据 */ + getPage(queryParams?: RolePageQuery) { + return request>({ + url: `${ROLE_BASE_URL}/page`, + method: "get", + params: queryParams, + }); + }, + + /** 获取角色下拉数据源 */ + getOptions() { + return request({ + url: `${ROLE_BASE_URL}/options`, + method: "get", + }); + }, + /** + * 获取角色的菜单ID集合 + * + * @param roleId 角色ID + * @returns 角色的菜单ID集合 + */ + getRoleMenuIds(roleId: string) { + return request({ + url: `${ROLE_BASE_URL}/${roleId}/menuIds`, + method: "get", + }); + }, + + /** + * 分配菜单权限 + * + * @param roleId 角色ID + * @param data 菜单ID集合 + */ + updateRoleMenus(roleId: string, data: number[]) { + return request({ + url: `${ROLE_BASE_URL}/${roleId}/menus`, + method: "put", + data, + }); + }, + + /** + * 获取角色表单数据 + * + * @param id 角色ID + * @returns 角色表单数据 + */ + getFormData(id: string) { + return request({ + url: `${ROLE_BASE_URL}/${id}/form`, + method: "get", + }); + }, + + /** 添加角色 */ + create(data: RoleForm) { + return request({ + url: `${ROLE_BASE_URL}`, + method: "post", + data, + }); + }, + + /** + * 更新角色 + * + * @param id 角色ID + * @param data 角色表单数据 + */ + update(id: string, data: RoleForm) { + return request({ + url: `${ROLE_BASE_URL}/${id}`, + method: "put", + data, + }); + }, + + /** + * 批量删除角色,多个以英文逗号(,)分割 + * + * @param ids 角色ID字符串,多个以英文逗号(,)分割 + */ + deleteByIds(ids: string) { + return request({ + url: `${ROLE_BASE_URL}/${ids}`, + method: "delete", + }); + }, +}; + +export default RoleAPI; + +/** 角色分页查询参数 */ +export interface RolePageQuery extends PageQuery { + /** 搜索关键字 */ + keywords?: string; +} + +/** 角色分页对象 */ +export interface RolePageVO { + /** 角色ID */ + id?: string; + /** 角色编码 */ + code?: string; + /** 角色名称 */ + name?: string; + /** 排序 */ + sort?: number; + /** 角色状态 */ + status?: number; + /** 创建时间 */ + createTime?: Date; + /** 修改时间 */ + updateTime?: Date; +} + +/** 角色表单对象 */ +export interface RoleForm { + /** 角色ID */ + id?: string; + /** 角色编码 */ + code?: string; + /** 数据权限 */ + dataScope?: number; + /** 角色名称 */ + name?: string; + /** 排序 */ + sort?: number; + /** 角色状态(1-正常;0-停用) */ + status?: number; +} diff --git a/src/api/system/user.api.ts b/src/api/system/user.api.ts new file mode 100644 index 0000000..2a26b34 --- /dev/null +++ b/src/api/system/user.api.ts @@ -0,0 +1,384 @@ +import request from "@/utils/request"; + +const USER_BASE_URL = "/api/v1/users"; + +const UserAPI = { + /** + * 获取当前登录用户信息 + * + * @returns 登录用户昵称、头像信息,包括角色和权限 + */ + getInfo() { + return request({ + url: `${USER_BASE_URL}/me`, + method: "get", + }); + }, + + /** + * 获取用户分页列表 + * + * @param queryParams 查询参数 + */ + getPage(queryParams: UserPageQuery) { + return request>({ + url: `${USER_BASE_URL}/page`, + method: "get", + params: queryParams, + }); + }, + + /** + * 获取用户表单详情 + * + * @param userId 用户ID + * @returns 用户表单详情 + */ + getFormData(userId: string) { + return request({ + url: `${USER_BASE_URL}/${userId}/form`, + method: "get", + }); + }, + + /** + * 添加用户 + * + * @param data 用户表单数据 + */ + create(data: UserForm) { + return request({ + url: `${USER_BASE_URL}`, + method: "post", + data, + }); + }, + + /** + * 修改用户 + * + * @param id 用户ID + * @param data 用户表单数据 + */ + update(id: string, data: UserForm) { + return request({ + url: `${USER_BASE_URL}/${id}`, + method: "put", + data, + }); + }, + + /** + * 修改用户密码 + * + * @param id 用户ID + * @param password 新密码 + */ + resetPassword(id: string, password: string) { + return request({ + url: `${USER_BASE_URL}/${id}/password/reset`, + method: "put", + params: { password }, + }); + }, + + /** + * 批量删除用户,多个以英文逗号(,)分割 + * + * @param ids 用户ID字符串,多个以英文逗号(,)分割 + */ + deleteByIds(ids: string) { + return request({ + url: `${USER_BASE_URL}/${ids}`, + method: "delete", + }); + }, + + /** 下载用户导入模板 */ + downloadTemplate() { + return request({ + url: `${USER_BASE_URL}/template`, + method: "get", + responseType: "blob", + }); + }, + + /** + * 导出用户 + * + * @param queryParams 查询参数 + */ + export(queryParams: UserPageQuery) { + return request({ + url: `${USER_BASE_URL}/export`, + method: "get", + params: queryParams, + responseType: "blob", + }); + }, + + /** + * 导入用户 + * + * @param deptId 部门ID + * @param file 导入文件 + */ + import(deptId: string, file: File) { + const formData = new FormData(); + formData.append("file", file); + return request({ + url: `${USER_BASE_URL}/import`, + method: "post", + params: { deptId }, + data: formData, + headers: { + "Content-Type": "multipart/form-data", + }, + }); + }, + + /** 获取个人中心用户信息 */ + getProfile() { + return request({ + url: `${USER_BASE_URL}/profile`, + method: "get", + }); + }, + + /** 修改个人中心用户信息 */ + updateProfile(data: UserProfileForm) { + return request({ + url: `${USER_BASE_URL}/profile`, + method: "put", + data, + }); + }, + + /** 修改个人中心用户密码 */ + changePassword(data: PasswordChangeForm) { + return request({ + url: `${USER_BASE_URL}/password`, + method: "put", + data, + }); + }, + + /** 发送短信验证码(绑定或更换手机号)*/ + sendMobileCode(mobile: string) { + return request({ + url: `${USER_BASE_URL}/mobile/code`, + method: "post", + params: { mobile }, + }); + }, + + /** 绑定或更换手机号 */ + bindOrChangeMobile(data: MobileUpdateForm) { + return request({ + url: `${USER_BASE_URL}/mobile`, + method: "put", + data, + }); + }, + + /** 发送邮箱验证码(绑定或更换邮箱)*/ + sendEmailCode(email: string) { + return request({ + url: `${USER_BASE_URL}/email/code`, + method: "post", + params: { email }, + }); + }, + + /** 绑定或更换邮箱 */ + bindOrChangeEmail(data: EmailUpdateForm) { + return request({ + url: `${USER_BASE_URL}/email`, + method: "put", + data, + }); + }, + + /** + * 获取用户下拉列表 + */ + getOptions() { + return request({ + url: `${USER_BASE_URL}/options`, + method: "get", + }); + }, +}; + +export default UserAPI; + +/** 登录用户信息 */ +export interface UserInfo { + /** 用户ID */ + userId?: string; + + /** 用户名 */ + username?: string; + + /** 昵称 */ + nickname?: string; + + /** 头像URL */ + avatar?: string; + + /** 角色 */ + roles: string[]; + + /** 权限 */ + perms: string[]; +} + +/** + * 用户分页查询对象 + */ +export interface UserPageQuery extends PageQuery { + /** 搜索关键字 */ + keywords?: string; + + /** 用户状态 */ + status?: number; + + /** 部门ID */ + deptId?: string; + + /** 开始时间 */ + createTime?: [string, string]; +} + +/** 用户分页对象 */ +export interface UserPageVO { + /** 用户ID */ + id: string; + /** 用户头像URL */ + avatar?: string; + /** 创建时间 */ + createTime?: Date; + /** 部门名称 */ + deptName?: string; + /** 用户邮箱 */ + email?: string; + /** 性别 */ + gender?: number; + /** 手机号 */ + mobile?: string; + /** 用户昵称 */ + nickname?: string; + /** 角色名称,多个使用英文逗号(,)分割 */ + roleNames?: string; + /** 用户状态(1:启用;0:禁用) */ + status?: number; + /** 用户名 */ + username?: string; +} + +/** 用户表单类型 */ +export interface UserForm { + /** 用户ID */ + id?: string; + /** 用户头像 */ + avatar?: string; + /** 部门ID */ + deptId?: string; + /** 邮箱 */ + email?: string; + /** 性别 */ + gender?: number; + /** 手机号 */ + mobile?: string; + /** 昵称 */ + nickname?: string; + /** 角色ID集合 */ + roleIds?: number[]; + /** 用户状态(1:正常;0:禁用) */ + status?: number; + /** 用户名 */ + username?: string; +} + +/** 个人中心用户信息 */ +export interface UserProfileVO { + /** 用户ID */ + id?: string; + + /** 用户名 */ + username?: string; + + /** 昵称 */ + nickname?: string; + + /** 头像URL */ + avatar?: string; + + /** 性别 */ + gender?: number; + + /** 手机号 */ + mobile?: string; + + /** 邮箱 */ + email?: string; + + /** 部门名称 */ + deptName?: string; + + /** 角色名称,多个使用英文逗号(,)分割 */ + roleNames?: string; + + /** 创建时间 */ + createTime?: Date; +} + +/** 个人中心用户信息表单 */ +export interface UserProfileForm { + /** 用户ID */ + id?: string; + + /** 用户名 */ + username?: string; + + /** 昵称 */ + nickname?: string; + + /** 头像URL */ + avatar?: string; + + /** 性别 */ + gender?: number; + + /** 手机号 */ + mobile?: string; + + /** 邮箱 */ + email?: string; +} + +/** 修改密码表单 */ +export interface PasswordChangeForm { + /** 原密码 */ + oldPassword?: string; + /** 新密码 */ + newPassword?: string; + /** 确认新密码 */ + confirmPassword?: string; +} + +/** 修改手机表单 */ +export interface MobileUpdateForm { + /** 手机号 */ + mobile?: string; + /** 验证码 */ + code?: string; +} + +/** 修改邮箱表单 */ +export interface EmailUpdateForm { + /** 邮箱 */ + email?: string; + /** 验证码 */ + code?: string; +} diff --git a/src/assets/icons/api.svg b/src/assets/icons/api.svg new file mode 100644 index 0000000..0181bdd --- /dev/null +++ b/src/assets/icons/api.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/backtop.svg b/src/assets/icons/backtop.svg new file mode 100644 index 0000000..f8e6aa0 --- /dev/null +++ b/src/assets/icons/backtop.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/bell.svg b/src/assets/icons/bell.svg new file mode 100644 index 0000000..262d0ac --- /dev/null +++ b/src/assets/icons/bell.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/bilibili.svg b/src/assets/icons/bilibili.svg new file mode 100644 index 0000000..b86747c --- /dev/null +++ b/src/assets/icons/bilibili.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/browser.svg b/src/assets/icons/browser.svg new file mode 100644 index 0000000..15c3927 --- /dev/null +++ b/src/assets/icons/browser.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/captcha.svg b/src/assets/icons/captcha.svg new file mode 100644 index 0000000..8b1da30 --- /dev/null +++ b/src/assets/icons/captcha.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/cascader.svg b/src/assets/icons/cascader.svg new file mode 100644 index 0000000..57209bf --- /dev/null +++ b/src/assets/icons/cascader.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/client.svg b/src/assets/icons/client.svg new file mode 100644 index 0000000..7373b3d --- /dev/null +++ b/src/assets/icons/client.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/close.svg b/src/assets/icons/close.svg new file mode 100644 index 0000000..e99c978 --- /dev/null +++ b/src/assets/icons/close.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/close_all.svg b/src/assets/icons/close_all.svg new file mode 100644 index 0000000..2005198 --- /dev/null +++ b/src/assets/icons/close_all.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/close_left.svg b/src/assets/icons/close_left.svg new file mode 100644 index 0000000..fc5cf71 --- /dev/null +++ b/src/assets/icons/close_left.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/close_other.svg b/src/assets/icons/close_other.svg new file mode 100644 index 0000000..27ffc32 --- /dev/null +++ b/src/assets/icons/close_other.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/close_right.svg b/src/assets/icons/close_right.svg new file mode 100644 index 0000000..b96dc1c --- /dev/null +++ b/src/assets/icons/close_right.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/cnblogs.svg b/src/assets/icons/cnblogs.svg new file mode 100644 index 0000000..4920a4c --- /dev/null +++ b/src/assets/icons/cnblogs.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/code.svg b/src/assets/icons/code.svg new file mode 100644 index 0000000..d8b546c --- /dev/null +++ b/src/assets/icons/code.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/collapse.svg b/src/assets/icons/collapse.svg new file mode 100644 index 0000000..1507568 --- /dev/null +++ b/src/assets/icons/collapse.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/csdn.svg b/src/assets/icons/csdn.svg new file mode 100644 index 0000000..e16bad0 --- /dev/null +++ b/src/assets/icons/csdn.svg @@ -0,0 +1,6 @@ + + ic/csdn + + + + diff --git a/src/assets/icons/dict.svg b/src/assets/icons/dict.svg new file mode 100644 index 0000000..db60220 --- /dev/null +++ b/src/assets/icons/dict.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/document.svg b/src/assets/icons/document.svg new file mode 100644 index 0000000..aaa0574 --- /dev/null +++ b/src/assets/icons/document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/down.svg b/src/assets/icons/down.svg new file mode 100644 index 0000000..5fc8b88 --- /dev/null +++ b/src/assets/icons/down.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/download.svg b/src/assets/icons/download.svg new file mode 100644 index 0000000..a8077dc --- /dev/null +++ b/src/assets/icons/download.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/enter.svg b/src/assets/icons/enter.svg new file mode 100644 index 0000000..9e199df --- /dev/null +++ b/src/assets/icons/enter.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/esc.svg b/src/assets/icons/esc.svg new file mode 100644 index 0000000..2f85dd2 --- /dev/null +++ b/src/assets/icons/esc.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/file.svg b/src/assets/icons/file.svg new file mode 100644 index 0000000..fac9bf0 --- /dev/null +++ b/src/assets/icons/file.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/fullscreen-exit.svg b/src/assets/icons/fullscreen-exit.svg new file mode 100644 index 0000000..2452f2b --- /dev/null +++ b/src/assets/icons/fullscreen-exit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/fullscreen.svg b/src/assets/icons/fullscreen.svg new file mode 100644 index 0000000..4b6ee11 --- /dev/null +++ b/src/assets/icons/fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/gitcode.svg b/src/assets/icons/gitcode.svg new file mode 100644 index 0000000..7a02760 --- /dev/null +++ b/src/assets/icons/gitcode.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/gitee.svg b/src/assets/icons/gitee.svg new file mode 100644 index 0000000..c799c2f --- /dev/null +++ b/src/assets/icons/gitee.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/github.svg b/src/assets/icons/github.svg new file mode 100644 index 0000000..1adfa4e --- /dev/null +++ b/src/assets/icons/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/homepage.svg b/src/assets/icons/homepage.svg new file mode 100644 index 0000000..1e1feab --- /dev/null +++ b/src/assets/icons/homepage.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/java.svg b/src/assets/icons/java.svg new file mode 100644 index 0000000..eaa93db --- /dev/null +++ b/src/assets/icons/java.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/juejin.svg b/src/assets/icons/juejin.svg new file mode 100644 index 0000000..937ace3 --- /dev/null +++ b/src/assets/icons/juejin.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/language.svg b/src/assets/icons/language.svg new file mode 100644 index 0000000..e754062 --- /dev/null +++ b/src/assets/icons/language.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/menu.svg b/src/assets/icons/menu.svg new file mode 100644 index 0000000..f5875d3 --- /dev/null +++ b/src/assets/icons/menu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/message.svg b/src/assets/icons/message.svg new file mode 100644 index 0000000..deacdc3 --- /dev/null +++ b/src/assets/icons/message.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/monitor.svg b/src/assets/icons/monitor.svg new file mode 100644 index 0000000..f153b9c --- /dev/null +++ b/src/assets/icons/monitor.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/project.svg b/src/assets/icons/project.svg new file mode 100644 index 0000000..eaf6a12 --- /dev/null +++ b/src/assets/icons/project.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/qq.svg b/src/assets/icons/qq.svg new file mode 100644 index 0000000..a59086b --- /dev/null +++ b/src/assets/icons/qq.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/refresh.svg b/src/assets/icons/refresh.svg new file mode 100644 index 0000000..e598ed1 --- /dev/null +++ b/src/assets/icons/refresh.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/role.svg b/src/assets/icons/role.svg new file mode 100644 index 0000000..5d25278 --- /dev/null +++ b/src/assets/icons/role.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/search.svg b/src/assets/icons/search.svg new file mode 100644 index 0000000..2312daf --- /dev/null +++ b/src/assets/icons/search.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/setting.svg b/src/assets/icons/setting.svg new file mode 100644 index 0000000..fbc4945 --- /dev/null +++ b/src/assets/icons/setting.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/size.svg b/src/assets/icons/size.svg new file mode 100644 index 0000000..f92f852 --- /dev/null +++ b/src/assets/icons/size.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/system.svg b/src/assets/icons/system.svg new file mode 100644 index 0000000..2e6045b --- /dev/null +++ b/src/assets/icons/system.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/table.svg b/src/assets/icons/table.svg new file mode 100644 index 0000000..1a16abb --- /dev/null +++ b/src/assets/icons/table.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/todo.svg b/src/assets/icons/todo.svg new file mode 100644 index 0000000..f48e667 --- /dev/null +++ b/src/assets/icons/todo.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/tree.svg b/src/assets/icons/tree.svg new file mode 100644 index 0000000..51aea8f --- /dev/null +++ b/src/assets/icons/tree.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/typescript.svg b/src/assets/icons/typescript.svg new file mode 100644 index 0000000..781d6f8 --- /dev/null +++ b/src/assets/icons/typescript.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/up.svg b/src/assets/icons/up.svg new file mode 100644 index 0000000..3b6c535 --- /dev/null +++ b/src/assets/icons/up.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/user.svg b/src/assets/icons/user.svg new file mode 100644 index 0000000..8e693ec --- /dev/null +++ b/src/assets/icons/user.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/visitor.svg b/src/assets/icons/visitor.svg new file mode 100644 index 0000000..1fd8dbe --- /dev/null +++ b/src/assets/icons/visitor.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/vue.svg b/src/assets/icons/vue.svg new file mode 100644 index 0000000..456f876 --- /dev/null +++ b/src/assets/icons/vue.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/wechat.svg b/src/assets/icons/wechat.svg new file mode 100644 index 0000000..2fc5803 --- /dev/null +++ b/src/assets/icons/wechat.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/xml.svg b/src/assets/icons/xml.svg new file mode 100644 index 0000000..f041213 --- /dev/null +++ b/src/assets/icons/xml.svg @@ -0,0 +1 @@ + diff --git a/src/assets/images/401.svg b/src/assets/images/401.svg new file mode 100644 index 0000000..6096d41 --- /dev/null +++ b/src/assets/images/401.svg @@ -0,0 +1,398 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/images/404.svg b/src/assets/images/404.svg new file mode 100644 index 0000000..b9bf23c --- /dev/null +++ b/src/assets/images/404.svg @@ -0,0 +1,340 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/images/login-bg.svg b/src/assets/images/login-bg.svg new file mode 100644 index 0000000..70f391f --- /dev/null +++ b/src/assets/images/login-bg.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/logo.png b/src/assets/logo.png new file mode 100644 index 0000000..524fb13 Binary files /dev/null and b/src/assets/logo.png differ diff --git a/src/components/AppLink/index.vue b/src/components/AppLink/index.vue new file mode 100644 index 0000000..b3b8f17 --- /dev/null +++ b/src/components/AppLink/index.vue @@ -0,0 +1,38 @@ + + + diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue new file mode 100644 index 0000000..9d49e1f --- /dev/null +++ b/src/components/Breadcrumb/index.vue @@ -0,0 +1,85 @@ + + + + + diff --git a/src/components/CURD/PageContent.vue b/src/components/CURD/PageContent.vue new file mode 100644 index 0000000..8437cac --- /dev/null +++ b/src/components/CURD/PageContent.vue @@ -0,0 +1,934 @@ + + + + + diff --git a/src/components/CURD/PageModal.vue b/src/components/CURD/PageModal.vue new file mode 100644 index 0000000..3b8195a --- /dev/null +++ b/src/components/CURD/PageModal.vue @@ -0,0 +1,273 @@ + + + + + diff --git a/src/components/CURD/PageSearch.vue b/src/components/CURD/PageSearch.vue new file mode 100644 index 0000000..8f42a55 --- /dev/null +++ b/src/components/CURD/PageSearch.vue @@ -0,0 +1,161 @@ + + + + + diff --git a/src/components/CURD/types.ts b/src/components/CURD/types.ts new file mode 100644 index 0000000..d777587 --- /dev/null +++ b/src/components/CURD/types.ts @@ -0,0 +1,223 @@ +import type { DialogProps, DrawerProps, FormItemRule, PaginationProps } from "element-plus"; +import type { FormProps, TableProps, ColProps, ButtonProps, CardProps } from "element-plus"; +import type PageContent from "./PageContent.vue"; +import type PageModal from "./PageModal.vue"; +import type PageSearch from "./PageSearch.vue"; +import type { CSSProperties } from "vue"; + +export type PageSearchInstance = InstanceType; +export type PageContentInstance = InstanceType; +export type PageModalInstance = InstanceType; + +export type IObject = Record; + +type DateComponent = "date-picker" | "time-picker" | "time-select" | "custom-tag" | "input-tag"; +type InputComponent = "input" | "select" | "input-number" | "cascader" | "tree-select"; +type OtherComponent = "text" | "radio" | "checkbox" | "switch" | "icon-select" | "custom"; +export type ISearchComponent = DateComponent | InputComponent; +export type IComponentType = DateComponent | InputComponent | OtherComponent; + +type ToolbarLeft = "add" | "delete" | "import" | "export"; +type ToolbarRight = "refresh" | "filter" | "imports" | "exports" | "search"; +type ToolbarTable = "edit" | "view" | "delete"; +export type IToolsButton = { + name: string; // 按钮名称 + text?: string; // 按钮文本 + perm?: Array | string; // 权限标识(可以是完整权限字符串如'sys:user:add'或操作权限如'add') + attrs?: Partial & { style?: CSSProperties }; // 按钮属性 + render?: (row: IObject) => boolean; // 条件渲染 +}; +export type IToolsDefault = ToolbarLeft | ToolbarRight | ToolbarTable | IToolsButton; + +export interface IOperateData { + name: string; + row: IObject; + column: IObject; + $index: number; +} + +export interface ISearchConfig { + // 权限前缀(如sys:user,用于组成权限标识),不提供则不进行权限校验 + permPrefix?: string; + // 标签冒号(默认:false) + colon?: boolean; + // 表单项(默认:[]) + formItems?: IFormItems; + // 是否开启展开和收缩(默认:true) + isExpandable?: boolean; + // 默认展示的表单项数量(默认:3) + showNumber?: number; + // 卡片属性 + cardAttrs?: Partial & { style?: CSSProperties }; + // form组件属性 + form?: IForm; + // 自适应网格布局(使用时表单不要添加 style: { width: "200px" }) + grid?: boolean | "left" | "right"; +} + +export interface IContentConfig { + // 权限前缀(如sys:user,用于组成权限标识),不提供则不进行权限校验 + permPrefix?: string; + // table组件属性 + table?: Omit, "data">; + // 分页组件位置(默认:left) + pagePosition?: "left" | "right"; + // pagination组件属性 + pagination?: + | boolean + | Partial< + Omit< + PaginationProps, + "v-model:page-size" | "v-model:current-page" | "total" | "currentPage" + > + >; + // 列表的网络请求函数(需返回promise) + indexAction: (queryParams: T) => Promise; + // 默认的分页相关的请求参数 + request?: { + pageName: string; + limitName: string; + }; + // 数据格式解析的回调函数 + parseData?: (res: any) => { + total: number; + list: IObject[]; + [key: string]: any; + }; + // 修改属性的网络请求函数(需返回promise) + modifyAction?: (data: { + [key: string]: any; + field: string; + value: boolean | string | number; + }) => Promise; + // 删除的网络请求函数(需返回promise) + deleteAction?: (ids: string) => Promise; + // 后端导出的网络请求函数(需返回promise) + exportAction?: (queryParams: T) => Promise; + // 前端全量导出的网络请求函数(需返回promise) + exportsAction?: (queryParams: T) => Promise; + // 导入模板 + importTemplate?: string | (() => Promise); + // 后端导入的网络请求函数(需返回promise) + importAction?: (file: File) => Promise; + // 前端导入的网络请求函数(需返回promise) + importsAction?: (data: IObject[]) => Promise; + // 主键名(默认为id) + pk?: string; + // 表格工具栏(默认:add,delete,export,也可自定义) + toolbar?: Array; + // 表格工具栏右侧图标(默认:refresh,filter,imports,exports,search) + defaultToolbar?: Array; + // table组件列属性(额外的属性templet,operat,slotName) + cols: Array<{ + type?: "default" | "selection" | "index" | "expand"; + label?: string; + prop?: string; + width?: string | number; + align?: "left" | "center" | "right"; + columnKey?: string; + reserveSelection?: boolean; + // 列是否显示 + show?: boolean; + // 模板 + templet?: + | "image" + | "list" + | "url" + | "switch" + | "input" + | "price" + | "percent" + | "icon" + | "date" + | "tool" + | "custom"; + // image模板相关参数 + imageWidth?: number; + imageHeight?: number; + // list模板相关参数 + selectList?: IObject; + // switch模板相关参数 + activeValue?: boolean | string | number; + inactiveValue?: boolean | string | number; + activeText?: string; + inactiveText?: string; + // input模板相关参数 + inputType?: string; + // price模板相关参数 + priceFormat?: string; + // date模板相关参数 + dateFormat?: string; + // tool模板相关参数 + operat?: Array; + // filter值拼接符 + filterJoin?: string; + [key: string]: any; + // 初始化数据函数 + initFn?: (item: IObject) => void; + }>; +} + +export interface IModalConfig { + // 权限前缀(如sys:user,用于组成权限标识),不提供则不进行权限校验 + permPrefix?: string; + // 标签冒号(默认:false) + colon?: boolean; + // 主键名(主要用于编辑数据,默认为id) + pk?: string; + // 组件类型(默认:dialog) + component?: "dialog" | "drawer"; + // dialog组件属性 + dialog?: Partial>; + // drawer组件属性 + drawer?: Partial>; + // form组件属性 + form?: IForm; + // 表单项 + formItems: IFormItems; + // 提交之前处理 + beforeSubmit?: (data: T) => void; + // 提交的网络请求函数(需返回promise) + formAction?: (data: T) => Promise; +} + +export type IForm = Partial>; + +// 表单项 +export type IFormItems = Array<{ + // 组件类型(如input,select,radio,custom等) + type: T; + // 标签提示 + tips?: string | IObject; + // 标签文本 + label: string; + // 键名 + prop: string; + // 组件属性 + attrs?: IObject; + // 组件可选项(只适用于select,radio,checkbox组件) + options?: Array<{ label: string; value: any; [key: string]: any }> | Ref; + // 验证规则 + rules?: FormItemRule[]; + // 初始值 + initialValue?: any; + // 插槽名(适用于自定义组件,设置类型为custom) + slotName?: string; + // 是否隐藏 + hidden?: boolean; + // layout组件Col属性 + col?: Partial; + // 组件事件 + events?: Record void>; + // 初始化数据函数扩展 + initFn?: (item: IObject) => void; +}>; + +export interface IPageForm { + // 主键名(主要用于编辑数据,默认为id) + pk?: string; + // form组件属性 + form?: IForm; + // 表单项 + formItems: IFormItems; +} diff --git a/src/components/CURD/usePage.ts b/src/components/CURD/usePage.ts new file mode 100644 index 0000000..18261f2 --- /dev/null +++ b/src/components/CURD/usePage.ts @@ -0,0 +1,105 @@ +import { ref } from "vue"; +import type { IObject, PageContentInstance, PageModalInstance, PageSearchInstance } from "./types"; + +function usePage() { + const searchRef = ref(); + const contentRef = ref(); + const addModalRef = ref(); + const editModalRef = ref(); + + // 搜索 + function handleQueryClick(queryParams: IObject) { + const filterParams = contentRef.value?.getFilterParams(); + contentRef.value?.fetchPageData({ ...queryParams, ...filterParams }, true); + } + // 重置 + function handleResetClick(queryParams: IObject) { + const filterParams = contentRef.value?.getFilterParams(); + contentRef.value?.fetchPageData({ ...queryParams, ...filterParams }, true); + } + // 新增 + function handleAddClick(RefImpl?: Ref) { + if (RefImpl) { + RefImpl?.value.setModalVisible(); + RefImpl?.value.handleDisabled(false); + } else { + addModalRef.value?.setModalVisible(); + addModalRef.value?.handleDisabled(false); + } + } + // 编辑 + async function handleEditClick( + row: IObject, + callback?: (result?: IObject) => IObject, + RefImpl?: Ref + ) { + if (RefImpl) { + RefImpl.value?.setModalVisible(); + RefImpl.value?.handleDisabled(false); + const from = await (callback?.(row) ?? Promise.resolve(row)); + RefImpl.value?.setFormData(from ? from : row); + } else { + editModalRef.value?.setModalVisible(); + editModalRef.value?.handleDisabled(false); + const from = await (callback?.(row) ?? Promise.resolve(row)); + editModalRef.value?.setFormData(from ? from : row); + } + } + // 查看 + async function handleViewClick( + row: IObject, + callback?: (result?: IObject) => IObject, + RefImpl?: Ref + ) { + if (RefImpl) { + RefImpl.value?.setModalVisible(); + RefImpl.value?.handleDisabled(true); + const from = await (callback?.(row) ?? Promise.resolve(row)); + RefImpl.value?.setFormData(from ? from : row); + } else { + editModalRef.value?.setModalVisible(); + editModalRef.value?.handleDisabled(true); + const from = await (callback?.(row) ?? Promise.resolve(row)); + editModalRef.value?.setFormData(from ? from : row); + } + } + // 表单提交 + function handleSubmitClick() { + //根据检索条件刷新列表数据 + const queryParams = searchRef.value?.getQueryParams(); + contentRef.value?.fetchPageData(queryParams, true); + } + // 导出 + function handleExportClick() { + // 根据检索条件导出数据 + const queryParams = searchRef.value?.getQueryParams(); + contentRef.value?.exportPageData(queryParams); + } + // 搜索显隐 + function handleSearchClick() { + searchRef.value?.toggleVisible(); + } + // 涮选数据 + function handleFilterChange(filterParams: IObject) { + const queryParams = searchRef.value?.getQueryParams(); + contentRef.value?.fetchPageData({ ...queryParams, ...filterParams }, true); + } + + return { + searchRef, + contentRef, + addModalRef, + editModalRef, + handleQueryClick, + handleResetClick, + handleAddClick, + handleEditClick, + handleViewClick, + handleSubmitClick, + handleExportClick, + handleSearchClick, + handleFilterChange, + }; +} + +export default usePage; diff --git a/src/components/CommonWrapper/index.vue b/src/components/CommonWrapper/index.vue new file mode 100644 index 0000000..9898849 --- /dev/null +++ b/src/components/CommonWrapper/index.vue @@ -0,0 +1,21 @@ + + + diff --git a/src/components/CopyButton/index.vue b/src/components/CopyButton/index.vue new file mode 100644 index 0000000..5179633 --- /dev/null +++ b/src/components/CopyButton/index.vue @@ -0,0 +1,62 @@ + + + + diff --git a/src/components/DarkModeSwitch/index.vue b/src/components/DarkModeSwitch/index.vue new file mode 100644 index 0000000..780c1ab --- /dev/null +++ b/src/components/DarkModeSwitch/index.vue @@ -0,0 +1,39 @@ + + diff --git a/src/components/Dict/DictLabel.vue b/src/components/Dict/DictLabel.vue new file mode 100644 index 0000000..c660347 --- /dev/null +++ b/src/components/Dict/DictLabel.vue @@ -0,0 +1,66 @@ + + diff --git a/src/components/Dict/index.vue b/src/components/Dict/index.vue new file mode 100644 index 0000000..79d98e4 --- /dev/null +++ b/src/components/Dict/index.vue @@ -0,0 +1,123 @@ + + + diff --git a/src/components/ECharts/index.vue b/src/components/ECharts/index.vue new file mode 100644 index 0000000..03b8b98 --- /dev/null +++ b/src/components/ECharts/index.vue @@ -0,0 +1,81 @@ + + + + + diff --git a/src/components/Fullscreen/index.vue b/src/components/Fullscreen/index.vue new file mode 100644 index 0000000..bd888fe --- /dev/null +++ b/src/components/Fullscreen/index.vue @@ -0,0 +1,11 @@ + + + + + diff --git a/src/components/GithubCorner/index.vue b/src/components/GithubCorner/index.vue new file mode 100644 index 0000000..7f91959 --- /dev/null +++ b/src/components/GithubCorner/index.vue @@ -0,0 +1,62 @@ + + + diff --git a/src/components/Hamburger/index.vue b/src/components/Hamburger/index.vue new file mode 100644 index 0000000..1ad9db8 --- /dev/null +++ b/src/components/Hamburger/index.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/src/components/IconSelect/index.vue b/src/components/IconSelect/index.vue new file mode 100644 index 0000000..b96e93e --- /dev/null +++ b/src/components/IconSelect/index.vue @@ -0,0 +1,207 @@ + + + + + diff --git a/src/components/InputTag/index.vue b/src/components/InputTag/index.vue new file mode 100644 index 0000000..a22b993 --- /dev/null +++ b/src/components/InputTag/index.vue @@ -0,0 +1,73 @@ + + diff --git a/src/components/LangSelect/index.vue b/src/components/LangSelect/index.vue new file mode 100644 index 0000000..fab9e71 --- /dev/null +++ b/src/components/LangSelect/index.vue @@ -0,0 +1,49 @@ + + + diff --git a/src/components/MenuSearch/index.vue b/src/components/MenuSearch/index.vue new file mode 100644 index 0000000..62b99f1 --- /dev/null +++ b/src/components/MenuSearch/index.vue @@ -0,0 +1,523 @@ + + + + + diff --git a/src/components/Notification/index.vue b/src/components/Notification/index.vue new file mode 100644 index 0000000..49f636c --- /dev/null +++ b/src/components/Notification/index.vue @@ -0,0 +1,163 @@ + + + + + diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue new file mode 100644 index 0000000..7017d95 --- /dev/null +++ b/src/components/Pagination/index.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/src/components/SizeSelect/index.vue b/src/components/SizeSelect/index.vue new file mode 100644 index 0000000..de58d3c --- /dev/null +++ b/src/components/SizeSelect/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/src/components/TableSelect/index.vue b/src/components/TableSelect/index.vue new file mode 100644 index 0000000..c546f75 --- /dev/null +++ b/src/components/TableSelect/index.vue @@ -0,0 +1,357 @@ + + + + + diff --git a/src/components/TextScroll/index.vue b/src/components/TextScroll/index.vue new file mode 100644 index 0000000..d37e1e7 --- /dev/null +++ b/src/components/TextScroll/index.vue @@ -0,0 +1,412 @@ + + + + + + diff --git a/src/components/Upload/FileUpload.vue b/src/components/Upload/FileUpload.vue new file mode 100644 index 0000000..1b3466c --- /dev/null +++ b/src/components/Upload/FileUpload.vue @@ -0,0 +1,276 @@ + + + + diff --git a/src/components/Upload/MultiImageUpload.vue b/src/components/Upload/MultiImageUpload.vue new file mode 100644 index 0000000..aeb2667 --- /dev/null +++ b/src/components/Upload/MultiImageUpload.vue @@ -0,0 +1,215 @@ + + + + diff --git a/src/components/Upload/SingleImageUpload.vue b/src/components/Upload/SingleImageUpload.vue new file mode 100644 index 0000000..cda5cfd --- /dev/null +++ b/src/components/Upload/SingleImageUpload.vue @@ -0,0 +1,201 @@ + + + + + + diff --git a/src/components/WangEditor/index.vue b/src/components/WangEditor/index.vue new file mode 100644 index 0000000..8b704c1 --- /dev/null +++ b/src/components/WangEditor/index.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/src/composables/index.ts b/src/composables/index.ts new file mode 100644 index 0000000..c848f9e --- /dev/null +++ b/src/composables/index.ts @@ -0,0 +1,11 @@ +/** + * 全局组合式函数入口文件 + * 导出所有可用的组合式函数 + */ + +// 导出核心组合式函数 +export { useStomp } from "./useStomp"; + +// 导出业务服务组合式函数 +export { useDictSync } from "./useDictSync"; +export { useOnlineCount } from "./useOnlineCount"; diff --git a/src/composables/useDictSync.ts b/src/composables/useDictSync.ts new file mode 100644 index 0000000..ca9551b --- /dev/null +++ b/src/composables/useDictSync.ts @@ -0,0 +1,219 @@ +import { useDictStoreHook } from "@/store/modules/dict.store"; +import { useStomp } from "./useStomp"; +import type { IMessage } from "@stomp/stompjs"; +import { ref } from "vue"; + +// 字典消息类型 +export interface DictMessage { + dictCode: string; + timestamp: number; +} + +// 字典事件回调类型 +export type DictMessageCallback = (_message: DictMessage) => void; + +// 全局单例实例 +let instance: ReturnType | null = null; + +/** + * 创建字典同步组合式函数 + * 负责监听后端字典变更并同步到前端 + */ +function createDictSyncHook() { + const dictStore = useDictStoreHook(); + + // 使用现有的useStomp,配置适合字典场景的重连参数 + const { isConnected, connect, subscribe, unsubscribe, disconnect } = useStomp({ + reconnectDelay: 20000, // 字典更新重连时间 + connectionTimeout: 15000, // 连接超时阈值 + useExponentialBackoff: false, // 使用固定间隔重连策略 + maxReconnectAttempts: 3, // 最多重连3次 + }); + + // 存储订阅ID + const subscriptionIds = ref([]); + + // 已订阅的主题 + const subscribedTopics = ref>(new Set()); + + // 消息回调函数列表 + const messageCallbacks = ref([]); + + // 重试定时器 + let retryTimer: any = null; + + /** + * 注册字典消息回调 + * @param callback 回调函数 + */ + const onDictMessage = (callback: DictMessageCallback) => { + messageCallbacks.value.push(callback); + return () => { + // 返回取消注册的函数 + const index = messageCallbacks.value.indexOf(callback); + if (index !== -1) { + messageCallbacks.value.splice(index, 1); + } + }; + }; + + /** + * 初始化WebSocket + */ + const initWebSocket = async () => { + try { + // 检查是否配置了WebSocket端点 + const wsEndpoint = import.meta.env.VITE_APP_WS_ENDPOINT; + if (!wsEndpoint) { + console.log("[DictSync] 未配置WebSocket端点,跳过连接"); + return; + } + + // 连接WebSocket + connect(); + + // 设置字典订阅 + setupDictSubscription(); + } catch (error) { + console.error("[DictSync] 初始化失败:", error); + } + }; + + /** + * 关闭WebSocket + */ + const closeWebSocket = () => { + // 清理重试定时器 + if (retryTimer) { + clearTimeout(retryTimer); + retryTimer = null; + } + + // 取消所有订阅 + subscriptionIds.value.forEach((id) => { + unsubscribe(id); + }); + subscriptionIds.value = []; + subscribedTopics.value.clear(); + + // 断开连接 + disconnect(); + }; + + /** + * 设置字典订阅 + */ + const setupDictSubscription = () => { + const topic = "/topic/dict"; + + // 防止重复订阅 + if (subscribedTopics.value.has(topic)) { + console.log(`[DictSync] 跳过重复订阅: ${topic}`); + return; + } + + console.log(`[DictSync] 开始尝试订阅字典主题: ${topic}`); + + // 使用简化的重试逻辑,依赖useStomp的连接管理 + const attemptSubscribe = () => { + if (!isConnected.value) { + console.log("[DictSync] 等待WebSocket连接建立..."); + // 清理之前的定时器,防止重复 + if (retryTimer) { + clearTimeout(retryTimer); + } + // 10秒后再次尝试 + retryTimer = setTimeout(() => { + retryTimer = null; + attemptSubscribe(); + }, 10000); + return; + } + + // 清理重试定时器 + if (retryTimer) { + clearTimeout(retryTimer); + retryTimer = null; + } + + // 检查是否已订阅 + if (subscribedTopics.value.has(topic)) { + return; + } + + console.log(`[DictSync] 连接已建立,开始订阅: ${topic}`); + + // 订阅字典更新 + const subId = subscribe(topic, (message: IMessage) => { + handleDictEvent(message); + }); + + if (subId) { + subscriptionIds.value.push(subId); + subscribedTopics.value.add(topic); + console.log(`[DictSync] 字典主题订阅成功: ${topic}`); + } else { + console.warn(`[DictSync] 字典主题订阅失败: ${topic}`); + } + }; + + // 开始尝试订阅 + attemptSubscribe(); + }; + + /** + * 处理字典事件 + * @param message STOMP消息 + */ + const handleDictEvent = (message: IMessage) => { + if (!message.body) return; + + try { + // 记录接收到的消息 + console.log(`[DictSync] 收到字典更新消息: ${message.body}`); + + // 尝试解析消息 + const parsedData = JSON.parse(message.body) as DictMessage; + const dictCode = parsedData.dictCode; + + if (!dictCode) return; + + // 清除缓存,等待按需加载 + dictStore.removeDictItem(dictCode); + console.log(`[DictSync] 字典缓存已清除: ${dictCode}`); + + // 调用所有注册的回调函数 + messageCallbacks.value.forEach((callback) => { + try { + callback(parsedData); + } catch (callbackError) { + console.error("[DictSync] 回调执行失败:", callbackError); + } + }); + + // 显示提示消息 + console.info(`[DictSync] 字典 ${dictCode} 已变更,将在下次使用时自动加载`); + } catch (error) { + console.error("[DictSync] 解析消息失败:", error); + } + }; + + return { + isConnected, + initWebSocket, + closeWebSocket, + handleDictEvent, + onDictMessage, + }; +} + +/** + * 字典同步组合式函数 + * 用于监听后端字典变更并同步到前端 + */ +export function useDictSync() { + if (!instance) { + instance = createDictSyncHook(); + } + return instance; +} diff --git a/src/composables/useOnlineCount.ts b/src/composables/useOnlineCount.ts new file mode 100644 index 0000000..906278c --- /dev/null +++ b/src/composables/useOnlineCount.ts @@ -0,0 +1,214 @@ +import { ref, onMounted, onUnmounted, watch, getCurrentInstance } from "vue"; +import { useStomp } from "./useStomp"; +import { registerWebSocketInstance } from "@/plugins/websocket"; +import { Auth } from "@/utils/auth"; + +// 全局单例实例 +let globalInstance: ReturnType | null = null; + +/** + * 创建在线用户计数的核心逻辑 + */ +function createOnlineCountHook() { + // 在线用户数量 + const onlineUserCount = ref(0); + + // 最后更新时间戳 + const lastUpdateTime = ref(0); + + // 连接状态 + const isConnected = ref(false); + + // 连接正在尝试中 + const isConnecting = ref(false); + + // 使用Stomp客户端 - 配置使用指数退避策略 + const stompInstance = useStomp({ + reconnectDelay: 15000, // 重连基础延迟 + maxReconnectAttempts: 3, // 重连次数上限 + connectionTimeout: 10000, // 连接超时 + useExponentialBackoff: true, // 启用指数退避 + }); + + const { + connect, + subscribe, + unsubscribe, + disconnect, + isConnected: stompConnected, + } = stompInstance; + + // 注册到全局实例管理器 + registerWebSocketInstance("onlineCount", stompInstance); + + // 订阅ID + let subscriptionId = ""; + + // 连接超时计时器 + let connectionTimeoutTimer: any = null; + + // 监听Stomp连接状态 + watch(stompConnected, (connected) => { + if (connected && isConnecting.value) { + isConnected.value = true; + isConnecting.value = false; + + // 一旦连接成功,立即订阅主题 + subscribeToOnlineCount(); + console.log("[useOnlineCount] WebSocket连接成功,已订阅在线用户计数主题"); + } + }); + + /** + * 订阅在线用户计数主题 + */ + const subscribeToOnlineCount = () => { + if (!stompConnected.value) { + // 10秒后重试订阅 + setTimeout(subscribeToOnlineCount, 10000); + return; + } + + // 如果已经订阅,先取消订阅 + if (subscriptionId) { + unsubscribe(subscriptionId); + } + + // 订阅在线用户计数主题 + subscriptionId = subscribe("/topic/online-count", (message) => { + try { + const data = message.body; + + const jsonData = JSON.parse(data); + const count = typeof jsonData === "number" ? jsonData : jsonData.count; + + if (!isNaN(count)) { + onlineUserCount.value = count; + lastUpdateTime.value = Date.now(); + } + } catch (error) { + console.error("[useOnlineCount] 解析在线用户数量失败:", error); + } + }); + }; + + /** + * 初始化WebSocket连接并订阅在线用户主题 + */ + const initWebSocket = () => { + if (isConnecting.value) return; + + // 检查WebSocket端点是否配置 + const wsEndpoint = import.meta.env.VITE_APP_WS_ENDPOINT; + if (!wsEndpoint) { + console.log("[useOnlineCount] 未配置WebSocket端点(VITE_APP_WS_ENDPOINT),跳过WebSocket连接"); + return; + } + + // 使用 Auth.getAccessToken() 获取令牌,确保获取到最新的 + const accessToken = Auth.getAccessToken(); + if (!accessToken) { + console.log("[useOnlineCount] 没有检测到有效令牌,不尝试WebSocket连接"); + return; + } + + isConnecting.value = true; + console.log("[useOnlineCount] 开始建立WebSocket连接..."); + + // 连接WebSocket + connect(); + + // 设置连接超时显示UI提示 + clearTimeout(connectionTimeoutTimer); + connectionTimeoutTimer = setTimeout(() => { + if (!isConnected.value) { + console.warn("[useOnlineCount] WebSocket连接超时,将自动尝试重连"); + ElMessage.warning("正在尝试连接服务器,请稍候..."); + + // 超时后尝试重新连接 + closeWebSocket(); + setTimeout(() => { + // 再次检查令牌有效性 + if (Auth.getAccessToken()) { + initWebSocket(); + } else { + console.log("[useOnlineCount] 令牌无效,放弃重连"); + } + }, 3000); + } + }, 10000); // 较长的UI提示超时 + + // 监听连接状态变化,连接成功后清除超时计时器 + const unwatch = watch(stompConnected, (connected) => { + if (connected) { + clearTimeout(connectionTimeoutTimer); + unwatch(); + } + }); + }; + + /** + * 关闭WebSocket连接 + */ + const closeWebSocket = () => { + if (subscriptionId) { + unsubscribe(subscriptionId); + subscriptionId = ""; + } + + // 清除连接超时计时器 + if (connectionTimeoutTimer) { + clearTimeout(connectionTimeoutTimer); + connectionTimeoutTimer = null; + } + + disconnect(); + isConnected.value = false; + isConnecting.value = false; + }; + + return { + onlineUserCount, + lastUpdateTime, + isConnected, + isConnecting, + initWebSocket, + closeWebSocket, + }; +} + +/** + * 在线用户计数组合式函数 + * 使用单例模式,避免重复创建 WebSocket 连接 + * @param options 配置选项 + * @param options.autoInit 是否在组件挂载时自动初始化(默认 true) + */ +export function useOnlineCount(options: { autoInit?: boolean } = {}) { + const { autoInit = true } = options; + + if (!globalInstance) { + globalInstance = createOnlineCountHook(); + } + + // 只有在组件上下文中且 autoInit 为 true 时才使用生命周期钩子 + if (autoInit && getCurrentInstance()) { + // 组件挂载时检查是否需要初始化WebSocket + onMounted(() => { + // 只有在未连接且未连接中时才尝试初始化 + if (!globalInstance!.isConnected.value && !globalInstance!.isConnecting.value) { + console.log("[useOnlineCount] 组件挂载,尝试初始化WebSocket连接"); + globalInstance!.initWebSocket(); + } else { + console.log("[useOnlineCount] WebSocket已连接或正在连接,跳过初始化"); + } + }); + + // 组件卸载时不关闭连接,保持全局连接 + onUnmounted(() => { + // 不关闭连接,让其他组件继续使用 + console.log("[useOnlineCount] Component unmounted, keeping WebSocket connection"); + }); + } + + return globalInstance; +} diff --git a/src/composables/useStomp.ts b/src/composables/useStomp.ts new file mode 100644 index 0000000..c2b8912 --- /dev/null +++ b/src/composables/useStomp.ts @@ -0,0 +1,368 @@ +import { Client, type IMessage, type StompSubscription } from "@stomp/stompjs"; +import { Auth } from "@/utils/auth"; + +export interface UseStompOptions { + /** WebSocket 地址,不传时使用 VITE_APP_WS_ENDPOINT 环境变量 */ + brokerURL?: string; + /** 用于鉴权的 token,不传时使用 getAccessToken() 的返回值 */ + token?: string; + /** 重连延迟,单位毫秒,默认为 8000 */ + reconnectDelay?: number; + /** 连接超时时间,单位毫秒,默认为 10000 */ + connectionTimeout?: number; + /** 是否开启指数退避重连策略 */ + useExponentialBackoff?: boolean; + /** 最大重连次数,默认为 5 */ + maxReconnectAttempts?: number; + /** 最大重连延迟,单位毫秒,默认为 60000 */ + maxReconnectDelay?: number; + /** 是否开启调试日志 */ + debug?: boolean; +} + +/** + * STOMP WebSocket连接组合式函数 + * 用于管理WebSocket连接的建立、断开、重连和消息订阅 + */ +export function useStomp(options: UseStompOptions = {}) { + // 默认值:brokerURL 从环境变量中获取,token 从 getAccessToken() 获取 + const defaultBrokerURL = import.meta.env.VITE_APP_WS_ENDPOINT || ""; + + const brokerURL = ref(options.brokerURL ?? defaultBrokerURL); + // 默认配置参数 + const reconnectDelay = options.reconnectDelay ?? 15000; // 默认15秒重连间隔 + const connectionTimeout = options.connectionTimeout ?? 10000; + const useExponentialBackoff = options.useExponentialBackoff ?? false; + const maxReconnectAttempts = options.maxReconnectAttempts ?? 3; // 最多重连3次 + const maxReconnectDelay = options.maxReconnectDelay ?? 60000; + + // 连接状态标记 + const isConnected = ref(false); + // 重连尝试次数 + const reconnectCount = ref(0); + // 重连计时器 + let reconnectTimer: any = null; + // 连接超时计时器 + let connectionTimeoutTimer: any = null; + // 存储所有订阅 + const subscriptions = new Map(); + + // 用于保存 STOMP 客户端的实例 + const client = ref(null); + // 防止重复连接的标志 + let isConnecting = false; + let isManualDisconnect = false; + + /** + * 初始化 STOMP 客户端 + */ + const initializeClient = () => { + // 如果客户端已存在且正在连接或已连接,直接返回 + if (client.value && (client.value.active || client.value.connected)) { + console.log("STOMP客户端已存在且处于活动状态,跳过初始化"); + return; + } + + // 检查WebSocket端点是否配置 + if (!brokerURL.value) { + console.error("WebSocket连接失败: 未配置WebSocket端点URL"); + return; + } + + // 每次连接前重新获取最新令牌,不依赖之前的token值 + const currentToken = Auth.getAccessToken(); + + // 检查令牌是否为空,如果为空则不进行连接 + if (!currentToken) { + console.error("WebSocket连接失败:授权令牌为空,请先登录"); + return; + } + + // 如果有旧的客户端,先清理 + if (client.value) { + try { + client.value.deactivate(); + } catch (error) { + console.warn("清理旧客户端时出错:", error); + } + client.value = null; + } + + // 创建 STOMP 客户端 + client.value = new Client({ + brokerURL: brokerURL.value, + connectHeaders: { + Authorization: `Bearer ${currentToken}`, + }, + debug: options.debug ? console.log : () => {}, + reconnectDelay: 0, // 禁用内置重连机制,使用自定义重连 + heartbeatIncoming: 4000, + heartbeatOutgoing: 4000, + }); + + // 设置连接监听器 + client.value.onConnect = () => { + isConnected.value = true; + isConnecting = false; + reconnectCount.value = 0; + clearTimeout(connectionTimeoutTimer); + clearTimeout(reconnectTimer); + console.log("WebSocket连接已建立"); + }; + + // 设置断开连接监听器 + client.value.onDisconnect = () => { + isConnected.value = false; + isConnecting = false; + console.log("WebSocket连接已断开"); + + // 如果不是手动断开且未达到最大重连次数,则尝试重连 + if (!isManualDisconnect && reconnectCount.value < maxReconnectAttempts) { + handleReconnect(); + } + }; + + // 设置 Web Socket 关闭监听器 + client.value.onWebSocketClose = (event) => { + isConnected.value = false; + isConnecting = false; + console.log(`WebSocket已关闭: ${event?.code} ${event?.reason}`); + + // 如果是手动断开,不要重连 + if (isManualDisconnect) { + console.log("手动断开连接,不进行重连"); + return; + } + + // 如果是授权问题导致的关闭,尝试重连 + if ( + (event?.code === 1000 || event?.code === 1006 || event?.code === 1008) && + reconnectCount.value < maxReconnectAttempts + ) { + console.log("检测到连接异常关闭,将尝试重连"); + + // 通过 handleReconnect 统一处理重连,避免重复计数 + handleReconnect(); + } + }; + + // 设置错误监听器 + client.value.onStompError = (frame) => { + console.error("STOMP错误:", frame.headers, frame.body); + isConnecting = false; + + // 检查是否是授权错误 + if ( + frame.headers?.message?.includes("Unauthorized") || + frame.body?.includes("Unauthorized") || + frame.body?.includes("Token") + ) { + console.warn("WebSocket授权错误,请检查登录状态"); + // 授权错误不进行重连 + isManualDisconnect = true; + } + }; + }; + + /** + * 处理重连逻辑 + */ + const handleReconnect = () => { + // 如果已经在连接中或手动断开,不重连 + if (isConnecting || isManualDisconnect) { + return; + } + + if (reconnectCount.value >= maxReconnectAttempts) { + console.error(`已达到最大重连次数(${maxReconnectAttempts}),停止重连`); + return; + } + + reconnectCount.value++; + console.log(`准备重连(${reconnectCount.value}/${maxReconnectAttempts})...`); + + // 使用指数退避策略增加重连间隔 + const delay = useExponentialBackoff + ? Math.min(reconnectDelay * Math.pow(2, reconnectCount.value - 1), maxReconnectDelay) + : reconnectDelay; + + // 清除之前的计时器 + if (reconnectTimer) { + clearTimeout(reconnectTimer); + } + + // 设置重连计时器 + reconnectTimer = setTimeout(() => { + if (!isConnected.value && !isManualDisconnect && !isConnecting) { + console.log(`开始重连...`); + connect(); + } + }, delay); + }; + + // 监听 brokerURL 的变化,若地址改变则重新初始化 + watch(brokerURL, (newURL, oldURL) => { + if (newURL !== oldURL) { + console.log(`brokerURL changed from ${oldURL} to ${newURL}`); + // 断开当前连接,重新激活客户端 + if (client.value && client.value.connected) { + client.value.deactivate(); + } + brokerURL.value = newURL; + initializeClient(); // 重新初始化客户端 + } + }); + + // 初始化客户端 + initializeClient(); + + /** + * 激活连接(如果已经连接或正在激活则直接返回) + */ + const connect = () => { + // 重置手动断开标志 + isManualDisconnect = false; + + // 检查是否有配置WebSocket端点 + if (!brokerURL.value) { + console.error("WebSocket连接失败: 未配置WebSocket端点URL"); + return; + } + + // 防止重复连接 + if (isConnecting) { + console.log("WebSocket正在连接中,跳过重复连接请求"); + return; + } + + if (!client.value) { + initializeClient(); + } + + if (!client.value) { + console.error("STOMP客户端初始化失败"); + return; + } + + // 避免重复连接:检查是否已连接 + if (client.value.connected) { + console.log("WebSocket已经连接,跳过重复连接"); + isConnected.value = true; + return; + } + + // 设置连接标志 + isConnecting = true; + + // 设置连接超时 + clearTimeout(connectionTimeoutTimer); + connectionTimeoutTimer = setTimeout(() => { + if (!isConnected.value && isConnecting) { + console.warn("WebSocket连接超时"); + isConnecting = false; + if (!isManualDisconnect && reconnectCount.value < maxReconnectAttempts) { + handleReconnect(); + } + } + }, connectionTimeout); + + try { + client.value.activate(); + console.log("正在建立WebSocket连接..."); + } catch (error) { + console.error("激活WebSocket连接失败:", error); + isConnecting = false; + } + }; + + /** + * 订阅指定主题 + * @param destination 目标主题地址 + * @param callback 接收到消息时的回调函数 + * @returns 返回订阅 id,用于后续取消订阅 + */ + const subscribe = (destination: string, callback: (_message: IMessage) => void): string => { + if (!client.value || !client.value.connected) { + console.warn(`尝试订阅 ${destination} 失败: 客户端未连接`); + return ""; + } + + try { + const subscription = client.value.subscribe(destination, callback); + const subscriptionId = subscription.id; + subscriptions.set(subscriptionId, subscription); + console.log(`订阅成功: ${destination}, ID: ${subscriptionId}`); + return subscriptionId; + } catch (error) { + console.error(`订阅 ${destination} 失败:`, error); + return ""; + } + }; + + /** + * 取消订阅 + * @param subscriptionId 订阅 id + */ + const unsubscribe = (subscriptionId: string) => { + const subscription = subscriptions.get(subscriptionId); + if (subscription) { + subscription.unsubscribe(); + subscriptions.delete(subscriptionId); + console.log(`已取消订阅: ${subscriptionId}`); + } + }; + + /** + * 断开WebSocket连接 + */ + const disconnect = () => { + // 设置手动断开标志 + isManualDisconnect = true; + + // 清除所有计时器 + if (reconnectTimer) { + clearTimeout(reconnectTimer); + reconnectTimer = null; + } + + if (connectionTimeoutTimer) { + clearTimeout(connectionTimeoutTimer); + connectionTimeoutTimer = null; + } + + // 清除所有订阅 + for (const [id, subscription] of subscriptions.entries()) { + try { + subscription.unsubscribe(); + } catch (error) { + console.warn(`取消订阅 ${id} 时出错:`, error); + } + } + subscriptions.clear(); + + // 断开连接 + if (client.value) { + try { + if (client.value.connected || client.value.active) { + client.value.deactivate(); + console.log("WebSocket连接已主动断开"); + } + } catch (error) { + console.error("断开WebSocket连接时出错:", error); + } + client.value = null; + } + + isConnected.value = false; + isConnecting = false; + reconnectCount.value = 0; + }; + + return { + isConnected, + connect, + subscribe, + unsubscribe, + disconnect, + }; +} diff --git a/src/config/menu.config.ts b/src/config/menu.config.ts new file mode 100644 index 0000000..112ef0a --- /dev/null +++ b/src/config/menu.config.ts @@ -0,0 +1,224 @@ +import type { RouteRecordRaw } from "vue-router"; + +/** + * 固定菜单配置 + * 替代从后端API获取的菜单数据 + */ +export const staticMenuRoutes: RouteRecordRaw[] = [ + { + path: "/asset", + component: "Layout", + redirect: "/asset/my-asset", + name: "/asset", + meta: { + title: "资产管理", + icon: "el-icon-Folder", + hidden: false, + alwaysShow: true, + params: null, + }, + children: [ + { + path: "my-asset", + component: "asset/my-asset/index", + name: "MyAsset", + meta: { + title: "我的资产", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "asset-register", + component: "asset/asset-register/index", + name: "AssetRegister", + meta: { + title: "资产登记", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "data-catalog", + component: "asset/data-catalog/index", + name: "DataCatalog", + meta: { + title: "数据目录", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "data-upload", + component: "asset/data-upload/index", + name: "DataUpload", + meta: { + title: "数据上传", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + ], + }, + { + path: "/dataset", + component: "Layout", + redirect: "/dataset/my-dataset", + name: "/dataset", + meta: { + title: "数据集管理", + icon: "el-icon-DataBoard", + hidden: false, + alwaysShow: true, + params: null, + }, + children: [ + { + path: "my-dataset", + component: "dataset/my-dataset/index", + name: "MyDataset", + meta: { + title: "我的数据集", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "dataset-create", + component: "dataset/dataset-create/index", + name: "DatasetCreate", + meta: { + title: "数据集创建", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "dataset-market", + component: "dataset/dataset-market/index", + name: "DatasetMarket", + meta: { + title: "数据集市场", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + ], + }, + { + path: "/privacy", + component: "Layout", + redirect: "/privacy/task-list", + name: "/privacy", + meta: { + title: "隐私计算", + icon: "el-icon-Lock", + hidden: false, + alwaysShow: true, + params: null, + }, + children: [ + { + path: "task-list", + component: "privacy/task-list/index", + name: "TaskList", + meta: { + title: "任务列表", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "task-create", + component: "privacy/task-create/index", + name: "TaskCreate", + meta: { + title: "创建任务", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "algorithm-manage", + component: "privacy/algorithm-manage/index", + name: "AlgorithmManage", + meta: { + title: "算法管理", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + { + path: "result-analysis", + component: "privacy/result-analysis/index", + name: "ResultAnalysis", + meta: { + title: "结果分析", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + ], + }, + { + path: "/order", + component: "Layout", + redirect: "/order/order-list", + name: "/order", + meta: { + title: "订单管理", + icon: "el-icon-ShoppingCart", + hidden: false, + alwaysShow: true, + params: null, + }, + children: [ + { + path: "order-list", + component: "order/order-list/index", + name: "OrderList", + meta: { + title: "订单列表", + icon: "", + hidden: false, + keepAlive: true, + alwaysShow: false, + params: null, + }, + }, + ], + }, +]; diff --git a/src/constants/index.ts b/src/constants/index.ts new file mode 100644 index 0000000..f8be9d9 --- /dev/null +++ b/src/constants/index.ts @@ -0,0 +1,4 @@ +export const ROLE_ROOT = "ROOT"; + +// 🔗 导出所有存储键常量 +export * from "./storage-keys"; diff --git a/src/constants/storage-keys.ts b/src/constants/storage-keys.ts new file mode 100644 index 0000000..8f2b95d --- /dev/null +++ b/src/constants/storage-keys.ts @@ -0,0 +1,53 @@ +/** + * 存储键常量统一管理 + * 包括 localStorage、sessionStorage 等各种存储的键名 + */ + +// 🔐 用户认证相关 +export const ACCESS_TOKEN_KEY = "access_token"; +export const REFRESH_TOKEN_KEY = "refresh_token"; +export const REMEMBER_ME_KEY = "remember_me"; + +// 📊 数据缓存相关 +export const DICT_CACHE_KEY = "dict_cache"; + +// 🎨 系统设置相关 +export const SHOW_TAGS_VIEW_KEY = "showTagsView"; +export const SHOW_APP_LOGO_KEY = "showAppLogo"; +export const SHOW_WATERMARK_KEY = "showWatermark"; +export const LAYOUT_KEY = "layout"; +export const SIDEBAR_COLOR_SCHEME_KEY = "sidebarColorScheme"; +export const THEME_KEY = "theme"; +export const THEME_COLOR_KEY = "themeColor"; + +// 🎯 功能分组的键映射对象 + +// 认证相关键集合 +export const AUTH_KEYS = { + ACCESS_TOKEN: ACCESS_TOKEN_KEY, + REFRESH_TOKEN: REFRESH_TOKEN_KEY, + REMEMBER_ME: REMEMBER_ME_KEY, +} as const; + +// 缓存相关键集合 +export const CACHE_KEYS = { + DICT_CACHE: DICT_CACHE_KEY, +} as const; + +// 设置相关键集合 +export const SETTINGS_KEYS = { + SHOW_TAGS_VIEW: SHOW_TAGS_VIEW_KEY, + SHOW_APP_LOGO: SHOW_APP_LOGO_KEY, + SHOW_WATERMARK: SHOW_WATERMARK_KEY, + SIDEBAR_COLOR_SCHEME: SIDEBAR_COLOR_SCHEME_KEY, + LAYOUT: LAYOUT_KEY, + THEME_COLOR: THEME_COLOR_KEY, + THEME: THEME_KEY, +} as const; + +// 📦 所有存储键的统一集合 +export const ALL_STORAGE_KEYS = { + ...AUTH_KEYS, + ...CACHE_KEYS, + ...SETTINGS_KEYS, +} as const; diff --git a/src/directive/index.ts b/src/directive/index.ts new file mode 100644 index 0000000..9c22eb6 --- /dev/null +++ b/src/directive/index.ts @@ -0,0 +1,9 @@ +import type { App } from "vue"; + +import { hasPerm } from "./permission"; + +// 全局注册 directive +export function setupDirective(app: App) { + // 使 v-hasPerm 在所有组件中都可用 + app.directive("hasPerm", hasPerm); +} diff --git a/src/directive/permission/index.ts b/src/directive/permission/index.ts new file mode 100644 index 0000000..b2d856a --- /dev/null +++ b/src/directive/permission/index.ts @@ -0,0 +1,65 @@ +import type { Directive, DirectiveBinding } from "vue"; + +import { useUserStore } from "@/store"; +import { ROLE_ROOT } from "@/constants"; + +/** + * 按钮权限 + */ +export const hasPerm: Directive = { + mounted(el: HTMLElement, binding: DirectiveBinding) { + const requiredPerms = binding.value; + + // 校验传入的权限值是否合法 + if (!requiredPerms || (typeof requiredPerms !== "string" && !Array.isArray(requiredPerms))) { + throw new Error( + "需要提供权限标识!例如:v-has-perm=\"'sys:user:add'\" 或 v-has-perm=\"['sys:user:add', 'sys:user:edit']\"" + ); + } + + const { roles, perms } = useUserStore().userInfo; + + // 超级管理员拥有所有权限,如果是"*:*:*"权限标识,则不需要进行权限校验 + if (roles.includes(ROLE_ROOT) || requiredPerms.includes("*:*:*")) { + return; + } + + // 检查权限 + const hasAuth = Array.isArray(requiredPerms) + ? requiredPerms.some((perm) => perms.includes(perm)) + : perms.includes(requiredPerms); + + // 如果没有权限,移除该元素 + if (!hasAuth && el.parentNode) { + el.parentNode.removeChild(el); + } + }, +}; + +/** + * 角色权限指令 + */ +export const hasRole: Directive = { + mounted(el: HTMLElement, binding: DirectiveBinding) { + const requiredRoles = binding.value; + + // 校验传入的角色值是否合法 + if (!requiredRoles || (typeof requiredRoles !== "string" && !Array.isArray(requiredRoles))) { + throw new Error( + "需要提供角色标识!例如:v-has-role=\"'ADMIN'\" 或 v-has-role=\"['ADMIN', 'TEST']\"" + ); + } + + const { roles } = useUserStore().userInfo; + + // 检查是否有对应角色权限 + const hasAuth = Array.isArray(requiredRoles) + ? requiredRoles.some((role) => roles.includes(role)) + : roles.includes(requiredRoles); + + // 如果没有权限,移除元素 + if (!hasAuth && el.parentNode) { + el.parentNode.removeChild(el); + } + }, +}; diff --git a/src/enums/api/result.enum.ts b/src/enums/api/result.enum.ts new file mode 100644 index 0000000..349a628 --- /dev/null +++ b/src/enums/api/result.enum.ts @@ -0,0 +1,23 @@ +/** + * 响应码枚举 + */ +export const enum ResultEnum { + /** + * 成功 + */ + SUCCESS = "00000", + /** + * 错误 + */ + ERROR = "B0001", + + /** + * 访问令牌无效或过期 + */ + ACCESS_TOKEN_INVALID = "A0230", + + /** + * 刷新令牌无效或过期 + */ + REFRESH_TOKEN_INVALID = "A0231", +} diff --git a/src/enums/codegen/form.enum.ts b/src/enums/codegen/form.enum.ts new file mode 100644 index 0000000..96c5462 --- /dev/null +++ b/src/enums/codegen/form.enum.ts @@ -0,0 +1,15 @@ +/** + * 表单类型枚举 + */ +export const FormTypeEnum: Record = { + INPUT: { value: 1, label: "输入框" }, + SELECT: { value: 2, label: "下拉框" }, + RADIO: { value: 3, label: "单选框" }, + CHECK_BOX: { value: 4, label: "复选框" }, + INPUT_NUMBER: { value: 5, label: "数字输入框" }, + SWITCH: { value: 6, label: "开关" }, + TEXT_AREA: { value: 7, label: "文本域" }, + DATE: { value: 8, label: "日期框" }, + DATE_TIME: { value: 9, label: "日期时间框" }, + HIDDEN: { value: 10, label: "隐藏域" }, +}; diff --git a/src/enums/codegen/query.enum.ts b/src/enums/codegen/query.enum.ts new file mode 100644 index 0000000..253efc0 --- /dev/null +++ b/src/enums/codegen/query.enum.ts @@ -0,0 +1,37 @@ +/** + * 查询类型枚举 + */ +export const QueryTypeEnum: Record = { + /** 等于 */ + EQ: { value: 1, label: "=" }, + + /** 模糊匹配 */ + LIKE: { value: 2, label: "LIKE '%s%'" }, + + /** 包含 */ + IN: { value: 3, label: "IN" }, + + /** 范围 */ + BETWEEN: { value: 4, label: "BETWEEN" }, + + /** 大于 */ + GT: { value: 5, label: ">" }, + + /** 大于等于 */ + GE: { value: 6, label: ">=" }, + + /** 小于 */ + LT: { value: 7, label: "<" }, + + /** 小于等于 */ + LE: { value: 8, label: "<=" }, + + /** 不等于 */ + NE: { value: 9, label: "!=" }, + + /** 左模糊匹配 */ + LIKE_LEFT: { value: 10, label: "LIKE '%s'" }, + + /** 右模糊匹配 */ + LIKE_RIGHT: { value: 11, label: "LIKE 's%'" }, +}; diff --git a/src/enums/index.ts b/src/enums/index.ts new file mode 100644 index 0000000..d56b6ad --- /dev/null +++ b/src/enums/index.ts @@ -0,0 +1,11 @@ +export * from "./api/result.enum"; + +export * from "./codegen/form.enum"; +export * from "./codegen/query.enum"; + +export * from "./settings/layout.enum"; +export * from "./settings/theme.enum"; +export * from "./settings/locale.enum"; +export * from "./settings/device.enum"; + +export * from "./system/menu.enum"; diff --git a/src/enums/settings/device.enum.ts b/src/enums/settings/device.enum.ts new file mode 100644 index 0000000..709bcb3 --- /dev/null +++ b/src/enums/settings/device.enum.ts @@ -0,0 +1,14 @@ +/** + * 设备枚举 + */ +export const enum DeviceEnum { + /** + * 宽屏设备 + */ + DESKTOP = "desktop", + + /** + * 窄屏设备 + */ + MOBILE = "mobile", +} diff --git a/src/enums/settings/layout.enum.ts b/src/enums/settings/layout.enum.ts new file mode 100644 index 0000000..e1e4406 --- /dev/null +++ b/src/enums/settings/layout.enum.ts @@ -0,0 +1,53 @@ +/** + * 菜单布局枚举 + */ +export const enum LayoutMode { + /** + * 左侧菜单布局 + */ + LEFT = "left", + /** + * 顶部菜单布局 + */ + TOP = "top", + + /** + * 混合菜单布局 + */ + MIX = "mix", +} + +/** + * 侧边栏状态枚举 + */ +export const enum SidebarStatus { + /** + * 展开 + */ + OPENED = "opened", + + /** + * 关闭 + */ + CLOSED = "closed", +} + +/** + * 组件尺寸枚举 + */ +export const enum ComponentSize { + /** + * 默认 + */ + DEFAULT = "default", + + /** + * 大型 + */ + LARGE = "large", + + /** + * 小型 + */ + SMALL = "small", +} diff --git a/src/enums/settings/locale.enum.ts b/src/enums/settings/locale.enum.ts new file mode 100644 index 0000000..a50b655 --- /dev/null +++ b/src/enums/settings/locale.enum.ts @@ -0,0 +1,14 @@ +/** + * 语言枚举 + */ +export const enum LanguageEnum { + /** + * 中文 + */ + ZH_CN = "zh-cn", + + /** + * 英文 + */ + EN = "en", +} diff --git a/src/enums/settings/theme.enum.ts b/src/enums/settings/theme.enum.ts new file mode 100644 index 0000000..21799c3 --- /dev/null +++ b/src/enums/settings/theme.enum.ts @@ -0,0 +1,32 @@ +/** + * 主题枚举 + */ +export const enum ThemeMode { + /** + * 明亮主题 + */ + LIGHT = "light", + /** + * 暗黑主题 + */ + DARK = "dark", + + /** + * 系统自动 + */ + AUTO = "auto", +} + +/** + * 侧边栏配色方案枚举 + */ +export const enum SidebarColor { + /** + * 经典蓝 + */ + CLASSIC_BLUE = "classic-blue", + /** + * 极简白 + */ + MINIMAL_WHITE = "minimal-white", +} diff --git a/src/enums/system/menu.enum.ts b/src/enums/system/menu.enum.ts new file mode 100644 index 0000000..3ed2f37 --- /dev/null +++ b/src/enums/system/menu.enum.ts @@ -0,0 +1,7 @@ +// 核心枚举定义 +export enum MenuTypeEnum { + CATALOG = 2, // 目录 + MENU = 1, // 菜单 + BUTTON = 4, // 按钮 + EXTLINK = 3, // 外链 +} diff --git a/src/lang/index.ts b/src/lang/index.ts new file mode 100644 index 0000000..c16f4c8 --- /dev/null +++ b/src/lang/index.ts @@ -0,0 +1,31 @@ +import type { App } from "vue"; +import { createI18n } from "vue-i18n"; +import { useAppStoreHook } from "@/store/modules/app.store"; +// 本地语言包 +import enLocale from "./package/en"; +import zhCnLocale from "./package/zh-cn"; + +const appStore = useAppStoreHook(); + +const messages = { + "zh-cn": { + ...zhCnLocale, + }, + en: { + ...enLocale, + }, +}; + +const i18n = createI18n({ + legacy: false, + locale: appStore.language, + messages, + globalInjection: true, +}); + +// 全局注册 i18n +export function setupI18n(app: App) { + app.use(i18n); +} + +export default i18n; diff --git a/src/lang/package/en.ts b/src/lang/package/en.ts new file mode 100644 index 0000000..2a863c7 --- /dev/null +++ b/src/lang/package/en.ts @@ -0,0 +1,96 @@ +export default { + // 菜单国际化 + route: { + dashboard: "Dashboard", + document: "Document", + }, + // 登录页面国际化 + login: { + themeToggle: "Theme Switch", + languageToggle: "Language Switch", + dark: "Dark", + light: "Light", + username: "Username", + password: "Password", + login: "Login", + captchaCode: "Verify Code", + capsLock: "Caps Lock is On", + rememberMe: "Remember Me", + forgetPassword: "Forget Password?", + message: { + username: { + required: "Please enter Username", + }, + password: { + required: "Please enter Password", + min: "The password can not be less than 6 digits", + confirm: "Please confirm the password again", + inconformity: "The two password entries are inconsistent", + }, + captchaCode: { + required: "Please enter Verify Code", + }, + }, + otherLoginMethods: "Other", + resetPassword: "Reset password", + thinkOfPasswd: "Remember your password?", + register: "Register account", + agree: "I have read and agree to the", + userAgreement: "User Agreement", + haveAccount: "Already have an account?", + noAccount: "Don't have an account?", + quickFill: "Quick fill", + reg: "Register", + }, + // 导航栏国际化 + navbar: { + dashboard: "Dashboard", + logout: "Logout", + document: "Document", + gitee: "Gitee", + profile: "User Profile", + }, + sizeSelect: { + tooltip: "Layout Size", + default: "Default", + large: "Large", + small: "Small", + message: { + success: "Switch Layout Size Successful!", + }, + }, + langSelect: { + message: { + success: "Switch Language Successful!", + }, + }, + settings: { + project: "Project Settings", + theme: "Theme", + interface: "Interface", + navigation: "Navigation", + themeColor: "Theme Color", + showTagsView: "Show Tags View", + showAppLogo: "Show App Logo", + sidebarColorScheme: "Sidebar Color Scheme", + showWatermark: "Show Watermark", + classicBlue: "Classic Blue", + minimalWhite: "Minimal White", + copyConfig: "Copy Config", + resetConfig: "Reset Default", + copySuccess: "Configuration copied to clipboard", + resetSuccess: "Reset to default configuration", + copyDescription: + "Copy config will generate current settings code, reset will restore all settings to default", + confirmReset: "Are you sure to reset all settings to default? This operation cannot be undone.", + applyToFile: "Apply to File", + onlyCopy: "Only Copy", + leftLayout: "Left Mode", + topLayout: "Top Mode", + mixLayout: "Mix Mode", + configManagement: "Config Management", + copyConfigDescription: + "Generate current settings code and copy to clipboard, then overwrite src/settings.ts file", + resetConfigDescription: "Restore all settings to system default values", + }, +}; diff --git a/src/lang/package/zh-cn.ts b/src/lang/package/zh-cn.ts new file mode 100644 index 0000000..f1f9cb2 --- /dev/null +++ b/src/lang/package/zh-cn.ts @@ -0,0 +1,97 @@ +export default { + // 菜单国际化 + route: { + dashboard: "首页", + document: "项目文档", + }, + // 登录页面国际化 + login: { + themeToggle: "主题切换", + languageToggle: "语言切换", + dark: "暗黑", + light: "明亮", + username: "用户名", + password: "密码", + login: "登 录", + captchaCode: "验证码", + capsLock: "大写锁定已打开", + rememberMe: "记住我", + forgetPassword: "忘记密码?", + message: { + username: { + required: "请输入用户名", + }, + password: { + required: "请输入密码", + min: "密码不能少于6位", + confirm: "请再次确认密码", + inconformity: "两次密码输入不一致", + }, + captchaCode: { + required: "请输入验证码", + }, + }, + otherLoginMethods: "其他", + resetPassword: "重置密码", + thinkOfPasswd: "想起密码?", + register: "注册账号", + agree: "我已同意并阅读", + userAgreement: "用户协议", + haveAccount: "已有账号?", + noAccount: "您没有账号?", + quickFill: "快速填写", + reg: "注 册", + }, + // 导航栏国际化 + navbar: { + dashboard: "首页", + logout: "退出登录", + document: "项目文档", + gitee: "项目地址", + profile: "个人中心", + }, + sizeSelect: { + tooltip: "布局大小", + default: "默认", + large: "大型", + small: "小型", + message: { + success: "切换布局大小成功!", + }, + }, + langSelect: { + message: { + success: "切换语言成功!", + }, + }, + settings: { + project: "项目配置", + theme: "主题设置", + interface: "界面设置", + navigation: "导航设置", + themeColor: "主题颜色", + themeColorTip: "主题颜色", + darkMode: "暗黑模式", + layoutSetting: "布局设置", + sidebarColorScheme: "侧边栏配色", + showTagsView: "显示页签", + showAppLogo: "显示Logo", + showWatermark: "显示水印", + classicBlue: "经典蓝", + minimalWhite: "极简白", + copyConfig: "复制配置", + resetConfig: "重置默认", + copySuccess: "配置已复制到剪贴板", + resetSuccess: "已重置为默认配置", + copyDescription: "复制配置将生成当前设置的代码,重置将恢复所有设置为默认值", + confirmReset: "确定要重置所有设置为默认值吗?此操作不可恢复。", + applyToFile: "应用到文件", + onlyCopy: "仅复制", + leftLayout: "左侧模式", + topLayout: "顶部模式", + mixLayout: "混合模式", + configManagement: "配置管理", + copyConfigDescription: "生成当前设置的代码并复制到剪贴板,然后覆盖 src/settings.ts 文件", + resetConfigDescription: "恢复所有设置为系统默认值", + }, +}; diff --git a/src/layouts/PortalLayout.vue b/src/layouts/PortalLayout.vue new file mode 100644 index 0000000..83ce7cf --- /dev/null +++ b/src/layouts/PortalLayout.vue @@ -0,0 +1,255 @@ + + + + + \ No newline at end of file diff --git a/src/layouts/components/AppLogo/index.vue b/src/layouts/components/AppLogo/index.vue new file mode 100644 index 0000000..1180965 --- /dev/null +++ b/src/layouts/components/AppLogo/index.vue @@ -0,0 +1,75 @@ + + + + + + + diff --git a/src/layouts/components/AppMain/index.vue b/src/layouts/components/AppMain/index.vue new file mode 100644 index 0000000..8510dc6 --- /dev/null +++ b/src/layouts/components/AppMain/index.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/src/layouts/components/Menu/BasicMenu.vue b/src/layouts/components/Menu/BasicMenu.vue new file mode 100644 index 0000000..494ee95 --- /dev/null +++ b/src/layouts/components/Menu/BasicMenu.vue @@ -0,0 +1,261 @@ + + + + diff --git a/src/layouts/components/Menu/MixTopMenu.vue b/src/layouts/components/Menu/MixTopMenu.vue new file mode 100644 index 0000000..96b9eb0 --- /dev/null +++ b/src/layouts/components/Menu/MixTopMenu.vue @@ -0,0 +1,197 @@ + + + + + + diff --git a/src/layouts/components/Menu/components/MenuItem.vue b/src/layouts/components/Menu/components/MenuItem.vue new file mode 100644 index 0000000..8734383 --- /dev/null +++ b/src/layouts/components/Menu/components/MenuItem.vue @@ -0,0 +1,230 @@ + + + + + diff --git a/src/layouts/components/Menu/components/MenuItemContent.vue b/src/layouts/components/Menu/components/MenuItemContent.vue new file mode 100644 index 0000000..d3cdb7c --- /dev/null +++ b/src/layouts/components/Menu/components/MenuItemContent.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/src/layouts/components/NavBar/components/NavbarActions.vue b/src/layouts/components/NavBar/components/NavbarActions.vue new file mode 100644 index 0000000..72ec1f8 --- /dev/null +++ b/src/layouts/components/NavBar/components/NavbarActions.vue @@ -0,0 +1,274 @@ + + + + + diff --git a/src/layouts/components/NavBar/index.vue b/src/layouts/components/NavBar/index.vue new file mode 100644 index 0000000..fd917b1 --- /dev/null +++ b/src/layouts/components/NavBar/index.vue @@ -0,0 +1,49 @@ + + + + + diff --git a/src/layouts/components/Settings/index.vue b/src/layouts/components/Settings/index.vue new file mode 100644 index 0000000..121ac8a --- /dev/null +++ b/src/layouts/components/Settings/index.vue @@ -0,0 +1,654 @@ + + + + + diff --git a/src/layouts/components/TagsView/index.vue b/src/layouts/components/TagsView/index.vue new file mode 100644 index 0000000..7aca352 --- /dev/null +++ b/src/layouts/components/TagsView/index.vue @@ -0,0 +1,559 @@ + + + + + diff --git a/src/layouts/composables/useLayout.ts b/src/layouts/composables/useLayout.ts new file mode 100644 index 0000000..ba2f618 --- /dev/null +++ b/src/layouts/composables/useLayout.ts @@ -0,0 +1,62 @@ +import { useAppStore, useSettingsStore } from "@/store"; +import { defaultSettings } from "@/settings"; + +/** + * 布局相关的通用逻辑 + */ +export function useLayout() { + const appStore = useAppStore(); + const settingsStore = useSettingsStore(); + + // 计算当前布局模式 + const currentLayout = computed(() => settingsStore.layout); + + // 侧边栏展开状态 + const isSidebarOpen = computed(() => appStore.sidebar.opened); + + // 是否显示标签视图 + const isShowTagsView = computed(() => settingsStore.showTagsView); + + // 是否显示设置面板 + const isShowSettings = computed(() => defaultSettings.showSettings); + + // 是否显示Logo + const isShowLogo = computed(() => settingsStore.showAppLogo); + + // 是否移动设备 + const isMobile = computed(() => appStore.device === "mobile"); + + // 布局CSS类 + const layoutClass = computed(() => ({ + hideSidebar: !appStore.sidebar.opened, + openSidebar: appStore.sidebar.opened, + mobile: appStore.device === "mobile", + [`layout-${settingsStore.layout}`]: true, + })); + + /** + * 处理切换侧边栏的展开/收起状态 + */ + function toggleSidebar() { + appStore.toggleSidebar(); + } + + /** + * 关闭侧边栏(移动端) + */ + function closeSidebar() { + appStore.closeSideBar(); + } + + return { + currentLayout, + isSidebarOpen, + isShowTagsView, + isShowSettings, + isShowLogo, + isMobile, + layoutClass, + toggleSidebar, + closeSidebar, + }; +} diff --git a/src/layouts/composables/useLayoutMenu.ts b/src/layouts/composables/useLayoutMenu.ts new file mode 100644 index 0000000..68d35e9 --- /dev/null +++ b/src/layouts/composables/useLayoutMenu.ts @@ -0,0 +1,58 @@ +import { computed, watch } from "vue"; +import { useRoute } from "vue-router"; +import { useAppStore, usePermissionStore } from "@/store"; + +/** + * 布局菜单处理逻辑 + */ +export function useLayoutMenu() { + const route = useRoute(); + const appStore = useAppStore(); + const permissionStore = usePermissionStore(); + + // 顶部菜单激活路径 + const activeTopMenuPath = computed(() => appStore.activeTopMenuPath); + + // 常规路由(左侧菜单或顶部菜单) + const routes = computed(() => permissionStore.routes); + + // 混合布局左侧菜单路由 + const sideMenuRoutes = computed(() => permissionStore.sideMenuRoutes); + + // 当前激活的菜单 + const activeMenu = computed(() => { + const { meta, path } = route; + + // 如果设置了activeMenu,则使用 + if (meta?.activeMenu) { + return meta.activeMenu; + } + + return path; + }); + + // 监听顶部菜单路径变化,更新侧边菜单 + watch( + () => activeTopMenuPath.value, + (newPath) => { + permissionStore.updateSideMenu(newPath); + }, + { immediate: true } + ); + + /** + * 处理顶部菜单点击 + * @param path 菜单路径 + */ + function handleTopMenuClick(path: string) { + appStore.activeTopMenu(path); + } + + return { + routes, + sideMenuRoutes, + activeMenu, + activeTopMenuPath, + handleTopMenuClick, + }; +} diff --git a/src/layouts/composables/useLayoutResponsive.ts b/src/layouts/composables/useLayoutResponsive.ts new file mode 100644 index 0000000..b8dd9ad --- /dev/null +++ b/src/layouts/composables/useLayoutResponsive.ts @@ -0,0 +1,36 @@ +import { watchEffect, computed } from "vue"; +import { useWindowSize } from "@vueuse/core"; +import { useAppStore } from "@/store"; +import { DeviceEnum } from "@/enums/settings/device.enum"; + +/** + * 布局响应式处理逻辑 + */ +export function useLayoutResponsive() { + const appStore = useAppStore(); + const { width } = useWindowSize(); + + // 定义响应式断点 + const WIDTH_DESKTOP = 992; // 桌面设备断点 (>=992px) + + // 设置当前设备类型并调整侧边栏状态 + watchEffect(() => { + const isDesktop = width.value >= WIDTH_DESKTOP; + const deviceType = isDesktop ? DeviceEnum.DESKTOP : DeviceEnum.MOBILE; + + // 更新设备类型 + appStore.toggleDevice(deviceType); + + // 根据设备类型调整侧边栏状态 + if (isDesktop) { + appStore.openSideBar(); + } else { + appStore.closeSideBar(); + } + }); + + return { + isDesktop: computed(() => width.value >= WIDTH_DESKTOP), + isMobile: computed(() => appStore.device === DeviceEnum.MOBILE), + }; +} diff --git a/src/layouts/index.vue b/src/layouts/index.vue new file mode 100644 index 0000000..9b9a070 --- /dev/null +++ b/src/layouts/index.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/src/layouts/views/BaseLayout.vue b/src/layouts/views/BaseLayout.vue new file mode 100644 index 0000000..3e30501 --- /dev/null +++ b/src/layouts/views/BaseLayout.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/src/layouts/views/LeftLayout.vue b/src/layouts/views/LeftLayout.vue new file mode 100644 index 0000000..b4ada9c --- /dev/null +++ b/src/layouts/views/LeftLayout.vue @@ -0,0 +1,136 @@ + + + + + diff --git a/src/layouts/views/MixLayout.vue b/src/layouts/views/MixLayout.vue new file mode 100644 index 0000000..04d85bc --- /dev/null +++ b/src/layouts/views/MixLayout.vue @@ -0,0 +1,257 @@ + + + + + diff --git a/src/layouts/views/TopLayout.vue b/src/layouts/views/TopLayout.vue new file mode 100644 index 0000000..6e6497b --- /dev/null +++ b/src/layouts/views/TopLayout.vue @@ -0,0 +1,126 @@ + + + + + diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..38b6440 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,21 @@ +import { createApp } from "vue"; +import App from "./App.vue"; +import setupPlugins from "@/plugins"; + +// 暗黑主题样式 +import "element-plus/theme-chalk/dark/css-vars.css"; +// 暗黑模式自定义变量 +import "@/styles/dark/css-vars.css"; +import "@/styles/index.scss"; +import "uno.css"; + +// 过渡动画 +import "animate.css"; + +// 自动为某些默认事件(如 touchstart、wheel 等)添加 { passive: true },提升滚动性能并消除控制台的非被动事件监听警告 +import "default-passive-events"; + +const app = createApp(App); +// 注册插件 +app.use(setupPlugins); +app.mount("#app"); diff --git a/src/plugins/icons.ts b/src/plugins/icons.ts new file mode 100644 index 0000000..fa85ba1 --- /dev/null +++ b/src/plugins/icons.ts @@ -0,0 +1,9 @@ +import type { App } from "vue"; +import * as ElementPlusIconsVue from "@element-plus/icons-vue"; + +// 注册所有图标 +export function setupElIcons(app: App) { + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component); + } +} diff --git a/src/plugins/index.ts b/src/plugins/index.ts new file mode 100644 index 0000000..98d2620 --- /dev/null +++ b/src/plugins/index.ts @@ -0,0 +1,31 @@ +import type { App } from "vue"; + +import { setupDirective } from "@/directive"; +import { setupI18n } from "@/lang"; +import { setupRouter } from "@/router"; +import { setupStore } from "@/store"; +import { setupElIcons } from "./icons"; +import { setupPermission } from "./permission"; +import { setupWebSocket } from "./websocket"; +import { InstallCodeMirror } from "codemirror-editor-vue3"; + +export default { + install(app: App) { + // 自定义指令(directive) + setupDirective(app); + // 路由(router) + setupRouter(app); + // 状态管理(store) + setupStore(app); + // 国际化 + setupI18n(app); + // Element-plus图标 + setupElIcons(app); + // 路由守卫 + setupPermission(); + // WebSocket服务 + setupWebSocket(); + // 注册 CodeMirror + app.use(InstallCodeMirror); + }, +}; diff --git a/src/plugins/permission.ts b/src/plugins/permission.ts new file mode 100644 index 0000000..843b5ee --- /dev/null +++ b/src/plugins/permission.ts @@ -0,0 +1,204 @@ +import type { NavigationGuardNext, RouteLocationNormalized, RouteRecordRaw } from "vue-router"; +import NProgress from "@/utils/nprogress"; +import { Auth } from "@/utils/auth"; +import router from "@/router"; +import { usePermissionStore, useUserStore } from "@/store"; +import { ROLE_ROOT } from "@/constants"; + +// 路由生成锁,防止重复生成 +let isGeneratingRoutes = false; + +export function setupPermission() { + // 白名单路由 - 添加门户网站页面 + const whiteList = [ + "/login", + "/portal", + "/portal/about", + "/portal/solutions", + "/portal/products", + "/portal/news", + "/portal/contact" + ]; + + router.beforeEach(async (to, from, next) => { + NProgress.start(); + console.log("🚀 Route guard triggered:", { to: to.path, from: from.path }); + + const isLoggedIn = Auth.isLoggedIn(); + + if (isLoggedIn) { + console.log("✅ User is logged in"); + + // 如果已登录但访问登录页,重定向到首页 + if (to.path === "/login") { + console.log("🔄 Redirecting from login to home"); + next({ path: "/" }); + return; + } + + // 处理已登录用户的路由访问 + await handleAuthenticatedUser(to, from, next); + } else { + console.log("❌ User not logged in"); + + // 未登录用户的处理 + if (whiteList.includes(to.path)) { + next(); + } else { + redirectToLogin(to, next); + NProgress.done(); + } + } + }); + + // 后置守卫,确保进度条关闭 + router.afterEach((to, from) => { + console.log("✅ Route navigation completed:", { to: to.path, from: from.path }); + NProgress.done(); + }); +} + +/** + * 处理已登录用户的路由访问 + */ +async function handleAuthenticatedUser( + to: RouteLocationNormalized, + from: RouteLocationNormalized, + next: NavigationGuardNext +) { + const permissionStore = usePermissionStore(); + const userStore = useUserStore(); + + try { + // 检查用户信息是否存在 + if (!userStore.userInfo.username) { + console.log("🔄 User info not found, fetching..."); + await userStore.getUserInfo(); + } + + // 检查路由是否已生成 + if (!permissionStore.routesLoaded) { + console.log("🔄 Routes not loaded, generating..."); + + // 防止重复生成路由 + if (isGeneratingRoutes) { + console.log("⏳ Routes already generating, waiting..."); + // 等待当前路由生成完成 + await waitForRoutesGeneration(permissionStore); + } else { + await generateAndAddRoutes(permissionStore); + } + + // 路由生成完成后,重新导航到目标路由 + console.log("🔄 Routes generated, redirecting to:", to.path); + next({ ...to, replace: true }); + return; + } + + // 路由已加载,检查路由是否存在 + if (to.matched.length === 0) { + console.log("❌ Route not found, redirecting to 404"); + next("/404"); + return; + } + + // 动态设置页面标题 + const title = (to.params.title as string) || (to.query.title as string); + if (title) { + to.meta.title = title; + } + + console.log("✅ Route access granted:", to.path); + next(); + } catch (error) { + console.error("❌ Route guard error:", error); + + // 出错时重置状态并重定向到登录页 + await resetUserStateAndRedirect(to, next); + } +} + +/** + * 生成并添加动态路由 + */ +async function generateAndAddRoutes(permissionStore: any) { + isGeneratingRoutes = true; + + try { + console.log("🔧 Generating dynamic routes..."); + const dynamicRoutes = await permissionStore.generateRoutes(); + + // 添加路由到路由器 + dynamicRoutes.forEach((route: RouteRecordRaw) => { + router.addRoute(route); + }); + + console.log("✅ All dynamic routes generated and added"); + } finally { + isGeneratingRoutes = false; + } +} + +/** + * 等待路由生成完成 + */ +async function waitForRoutesGeneration(permissionStore: any): Promise { + return new Promise((resolve) => { + const checkInterval = setInterval(() => { + if (!isGeneratingRoutes && permissionStore.routesLoaded) { + clearInterval(checkInterval); + resolve(); + } + }, 50); // 每50ms检查一次 + + // 超时保护,最多等待5秒 + setTimeout(() => { + clearInterval(checkInterval); + console.warn("⚠️ Routes generation timeout"); + resolve(); + }, 5000); + }); +} + +/** + * 重置用户状态并重定向到登录页 + */ +async function resetUserStateAndRedirect(to: RouteLocationNormalized, next: NavigationGuardNext) { + try { + await useUserStore().resetAllState(); + redirectToLogin(to, next); + } catch (resetError) { + console.error("❌ Failed to reset user state:", resetError); + // 强制跳转到登录页 + next("/login"); + } finally { + NProgress.done(); + } +} + +/** + * 重定向到登录页 + */ +function redirectToLogin(to: RouteLocationNormalized, next: NavigationGuardNext) { + const params = new URLSearchParams(to.query as Record); + const queryString = params.toString(); + const redirect = queryString ? `${to.path}?${queryString}` : to.path; + + console.log("🔄 Redirecting to login with redirect:", redirect); + next(`/login?redirect=${encodeURIComponent(redirect)}`); +} + +/** 判断是否有权限 */ +export function hasAuth(value: string | string[], type: "button" | "role" = "button") { + const { roles, perms } = useUserStore().userInfo; + + // 超级管理员 拥有所有权限 + if (type === "button" && roles.includes(ROLE_ROOT)) { + return true; + } + + const auths = type === "button" ? perms : roles; + return typeof value === "string" + ? auths.includes(value) + : value.some((perm) => auths.includes(perm)); +} diff --git a/src/plugins/websocket.ts b/src/plugins/websocket.ts new file mode 100644 index 0000000..b843aa1 --- /dev/null +++ b/src/plugins/websocket.ts @@ -0,0 +1,166 @@ +import { useDictSync } from "@/composables/useDictSync"; +import { Auth } from "@/utils/auth"; +import { useUserStore } from "@/store"; +import { watch } from "vue"; + +// 全局 WebSocket 实例管理 +const websocketInstances = new Map(); + +// 用于防止重复初始化的状态标记 +let isInitialized = false; +let dictWebSocketInstance: ReturnType | null = null; + +/** + * 注册 WebSocket 实例 + */ +export function registerWebSocketInstance(key: string, instance: any) { + websocketInstances.set(key, instance); + console.log(`[WebSocketPlugin] Registered WebSocket instance: ${key}`); +} + +/** + * 获取 WebSocket 实例 + */ +export function getWebSocketInstance(key: string) { + return websocketInstances.get(key); +} + +/** + * 初始化WebSocket服务 + */ +export function setupWebSocket() { + console.log("[WebSocketPlugin] 开始初始化WebSocket服务..."); + + // 检查是否已经初始化 + if (isInitialized) { + console.log("[WebSocketPlugin] WebSocket服务已经初始化,跳过重复初始化"); + return; + } + + // 检查环境变量是否配置 + const wsEndpoint = import.meta.env.VITE_APP_WS_ENDPOINT; + if (!wsEndpoint) { + console.log("[WebSocketPlugin] 未配置WebSocket端点,跳过WebSocket初始化"); + return; + } + + // 检查是否已登录 + if (!Auth.isLoggedIn()) { + console.warn( + "[WebSocketPlugin] 未找到访问令牌,WebSocket初始化已跳过。用户登录后将自动重新连接。" + ); + return; + } + + try { + // 延迟初始化,确保应用完全启动 + setTimeout(() => { + // 保存实例引用 + dictWebSocketInstance = useDictSync(); + registerWebSocketInstance("dictSync", dictWebSocketInstance); + + // 初始化字典WebSocket服务 + dictWebSocketInstance.initWebSocket(); + console.log("[WebSocketPlugin] 字典WebSocket初始化完成"); + + // 初始化在线用户计数WebSocket + import("@/composables/useOnlineCount").then(({ useOnlineCount }) => { + const onlineCountInstance = useOnlineCount({ autoInit: false }); + onlineCountInstance.initWebSocket(); + console.log("[WebSocketPlugin] 在线用户计数WebSocket初始化完成"); + }); + + // 在窗口关闭前断开WebSocket连接 + window.addEventListener("beforeunload", handleWindowClose); + + // 监听用户注销事件 + watchUserLogout(); + + console.log("[WebSocketPlugin] WebSocket服务初始化完成"); + isInitialized = true; + }, 1000); // 延迟1秒初始化 + } catch (error) { + console.error("[WebSocketPlugin] 初始化WebSocket服务失败:", error); + } +} + +/** + * 处理窗口关闭 + */ +function handleWindowClose() { + console.log("[WebSocketPlugin] 窗口即将关闭,断开WebSocket连接"); + cleanupWebSocket(); +} + +/** + * 监听用户注销 + */ +function watchUserLogout() { + const userStore = useUserStore(); + + // 监听用户信息变化,当用户信息被清空时断开连接 + watch( + () => userStore.userInfo, + (newUserInfo, oldUserInfo) => { + // 从有用户信息变为无用户信息,说明用户注销了 + if (oldUserInfo?.username && !newUserInfo?.username) { + console.log("[WebSocketPlugin] 检测到用户注销,断开WebSocket连接"); + cleanupWebSocket(); + } + }, + { deep: true } + ); +} + +/** + * 清理WebSocket连接 + */ +export function cleanupWebSocket() { + // 清理字典 WebSocket + if (dictWebSocketInstance) { + try { + dictWebSocketInstance.closeWebSocket(); + console.log("[WebSocketPlugin] 字典WebSocket连接已断开"); + } catch (error) { + console.error("[WebSocketPlugin] 断开字典WebSocket连接失败:", error); + } + } + + // 清理所有注册的 WebSocket 实例 + websocketInstances.forEach((instance, key) => { + try { + if (instance && typeof instance.disconnect === "function") { + instance.disconnect(); + console.log(`[WebSocketPlugin] ${key} WebSocket连接已断开`); + } else if (instance && typeof instance.closeWebSocket === "function") { + instance.closeWebSocket(); + console.log(`[WebSocketPlugin] ${key} WebSocket连接已断开`); + } + } catch (error) { + console.error(`[WebSocketPlugin] 断开 ${key} WebSocket连接失败:`, error); + } + }); + + // 清空实例映射 + websocketInstances.clear(); + + // 移除事件监听器 + window.removeEventListener("beforeunload", handleWindowClose); + + // 重置状态 + dictWebSocketInstance = null; + isInitialized = false; +} + +/** + * 重新初始化WebSocket(用于登录后重连) + */ +export function reinitializeWebSocket() { + // 先清理现有连接 + cleanupWebSocket(); + + // 延迟后重新初始化 + setTimeout(() => { + setupWebSocket(); + }, 500); +} diff --git a/src/router/index.ts b/src/router/index.ts new file mode 100644 index 0000000..0335d9d --- /dev/null +++ b/src/router/index.ts @@ -0,0 +1,132 @@ +import type { App } from "vue"; +import { createRouter, createWebHashHistory, type RouteRecordRaw } from "vue-router"; + +export const Layout = () => import("@/layouts/index.vue"); +export const PortalLayout = () => import("@/layouts/PortalLayout.vue"); + +// 静态路由 +export const constantRoutes: RouteRecordRaw[] = [ + { + path: "/redirect", + component: Layout, + meta: { hidden: true }, + children: [ + { + path: "/redirect/:path(.*)", + component: () => import("@/views/redirect/index.vue"), + }, + ], + }, + + { + path: "/login", + component: () => import("@/views/login/index.vue"), + meta: { hidden: true }, + }, + + // 门户网站路由 + { + path: "/portal", + component: PortalLayout, + meta: { hidden: true }, + children: [ + { + path: "", + name: "PortalHome", + component: () => import("@/views/portal/index.vue"), + meta: { title: "首页" }, + }, + { + path: "about", + name: "PortalAbout", + component: () => import("@/views/portal/about.vue"), + meta: { title: "关于我们" }, + }, + { + path: "solutions", + name: "PortalSolutions", + component: () => import("@/views/portal/solutions.vue"), + meta: { title: "解决方案" }, + }, + { + path: "products", + name: "PortalProducts", + component: () => import("@/views/portal/products.vue"), + meta: { title: "产品服务" }, + }, + { + path: "news", + name: "PortalNews", + component: () => import("@/views/portal/news.vue"), + meta: { title: "新闻动态" }, + }, + { + path: "contact", + name: "PortalContact", + component: () => import("@/views/portal/contact.vue"), + meta: { title: "联系我们" }, + }, + ], + }, + + { + path: "/", + name: "/", + component: Layout, + redirect: "/portal", + children: [ + { + path: "dashboard", + component: () => import("@/views/dashboard/index.vue"), + // 用于 keep-alive 功能,需要与 SFC 中自动推导或显式声明的组件名称一致 + // 参考文档: https://cn.vuejs.org/guide/built-ins/keep-alive.html#include-exclude + name: "Dashboard", + meta: { + title: "dashboard", + icon: "homepage", + affix: true, + keepAlive: true, + }, + }, + { + path: "401", + component: () => import("@/views/error/401.vue"), + meta: { hidden: true }, + }, + { + path: "404", + component: () => import("@/views/error/404.vue"), + meta: { hidden: true }, + }, + { + path: "profile", + name: "Profile", + component: () => import("@/views/profile/index.vue"), + meta: { title: "个人中心", icon: "user", hidden: true }, + }, + { + path: "my-notice", + name: "MyNotice", + component: () => import("@/views/system/notice/components/MyNotice.vue"), + meta: { title: "我的通知", icon: "user", hidden: true }, + }, + ], + }, +]; + +/** + * 创建路由 + */ +const router = createRouter({ + history: createWebHashHistory(), + routes: constantRoutes, + // 刷新时,滚动条位置还原 + scrollBehavior: () => ({ left: 0, top: 0 }), +}); + +// 全局注册 router +export function setupRouter(app: App) { + app.use(router); +} + +export default router; diff --git a/src/settings.ts b/src/settings.ts new file mode 100644 index 0000000..9641874 --- /dev/null +++ b/src/settings.ts @@ -0,0 +1,50 @@ +import { LayoutMode, ComponentSize, SidebarColor, ThemeMode, LanguageEnum } from "./enums"; + +const { pkg } = __APP_INFO__; + +// 检查用户的操作系统是否使用深色模式 +const mediaQueryList = window.matchMedia("(prefers-color-scheme: dark)"); + +export const defaultSettings: AppSettings = { + // 系统Title + title: pkg.name, + // 系统版本 + version: pkg.version, + // 是否显示设置 + showSettings: true, + // 是否显示标签视图 + showTagsView: true, + // 是否显示应用Logo + showAppLogo: true, + // 布局方式,默认为左侧布局 + layout: LayoutMode.LEFT, + // 主题,根据操作系统的色彩方案自动选择 + theme: mediaQueryList.matches ? ThemeMode.DARK : ThemeMode.LIGHT, + // 组件大小 default | medium | small | large + size: ComponentSize.DEFAULT, + // 语言 + language: LanguageEnum.ZH_CN, + // 主题颜色 - 修改此值时需同步修改 src/styles/variables.scss + themeColor: "#4080FF", + // 是否显示水印 + showWatermark: false, + // 水印内容 + watermarkContent: pkg.name, + // 侧边栏配色方案 + sidebarColorScheme: SidebarColor.CLASSIC_BLUE, +}; + +// 主题色预设 - 经典配色方案 +// 注意:修改默认主题色时,需要同步修改 src/styles/variables.scss 中的 primary.base 值 +export const themeColorPresets = [ + "#4080FF", // Arco Design 蓝 - 现代感强 + "#1890FF", // Ant Design 蓝 - 经典商务 + "#409EFF", // Element Plus 蓝 - 清新自然 + "#FA8C16", // 活力橙 - 温暖友好 + "#722ED1", // 优雅紫 - 高端大气 + "#13C2C2", // 青色 - 科技感 + "#52C41A", // 成功绿 - 活力清新 + "#F5222D", // 警示红 - 醒目强烈 + "#2F54EB", // 深蓝 - 稳重专业 + "#EB2F96", // 品红 - 时尚个性 +]; diff --git a/src/store/index.ts b/src/store/index.ts new file mode 100644 index 0000000..9236155 --- /dev/null +++ b/src/store/index.ts @@ -0,0 +1,17 @@ +import type { App } from "vue"; +import { createPinia } from "pinia"; + +const store = createPinia(); + +// 全局注册 store +export function setupStore(app: App) { + app.use(store); +} + +export * from "./modules/app.store"; +export * from "./modules/permission.store"; +export * from "./modules/settings.store"; +export * from "./modules/tags-view.store"; +export * from "./modules/user.store"; +export * from "./modules/dict.store"; +export { store }; diff --git a/src/store/modules/app.store.ts b/src/store/modules/app.store.ts new file mode 100644 index 0000000..4ddec18 --- /dev/null +++ b/src/store/modules/app.store.ts @@ -0,0 +1,107 @@ +import { defaultSettings } from "@/settings"; + +// 导入 Element Plus 中英文语言包 +import zhCn from "element-plus/es/locale/lang/zh-cn"; +import en from "element-plus/es/locale/lang/en"; +import { store } from "@/store"; +import { DeviceEnum } from "@/enums/settings/device.enum"; +import { SidebarStatus } from "@/enums/settings/layout.enum"; + +export const useAppStore = defineStore("app", () => { + // 设备类型 + const device = useStorage("device", DeviceEnum.DESKTOP); + // 布局大小 + const size = useStorage("size", defaultSettings.size); + // 语言 + const language = useStorage("language", defaultSettings.language); + // 侧边栏状态 + const sidebarStatus = useStorage("sidebarStatus", SidebarStatus.CLOSED); + const sidebar = reactive({ + opened: sidebarStatus.value === SidebarStatus.OPENED, + withoutAnimation: false, + }); + + // 顶部菜单激活路径 + const activeTopMenuPath = useStorage("activeTopMenuPath", ""); + + /** + * 根据语言标识读取对应的语言包 + */ + const locale = computed(() => { + if (language?.value == "en") { + return en; + } else { + return zhCn; + } + }); + + // 切换侧边栏 + function toggleSidebar() { + sidebar.opened = !sidebar.opened; + sidebarStatus.value = sidebar.opened ? SidebarStatus.OPENED : SidebarStatus.CLOSED; + } + + // 关闭侧边栏 + function closeSideBar() { + sidebar.opened = false; + sidebarStatus.value = SidebarStatus.CLOSED; + } + + // 打开侧边栏 + function openSideBar() { + sidebar.opened = true; + sidebarStatus.value = SidebarStatus.OPENED; + } + + // 切换设备 + function toggleDevice(val: string) { + device.value = val; + } + + /** + * 改变布局大小 + * + * @param val 布局大小 default | small | large + */ + function changeSize(val: string) { + size.value = val; + } + /** + * 切换语言 + * + * @param val + */ + function changeLanguage(val: string) { + language.value = val; + } + /** + * 混合模式顶部切换 + */ + function activeTopMenu(val: string) { + activeTopMenuPath.value = val; + } + return { + device, + sidebar, + language, + locale, + size, + activeTopMenu, + toggleDevice, + changeSize, + changeLanguage, + toggleSidebar, + closeSideBar, + openSideBar, + activeTopMenuPath, + }; +}); + +/** + * 用于在组件外部(如在Pinia Store 中)使用 Pinia 提供的 store 实例。 + * 官方文档解释了如何在组件外部使用 Pinia Store: + * https://pinia.vuejs.org/core-concepts/outside-component-usage.html#using-a-store-outside-of-a-component + */ +export function useAppStoreHook() { + return useAppStore(store); +} diff --git a/src/store/modules/dict.store.ts b/src/store/modules/dict.store.ts new file mode 100644 index 0000000..84f7ff5 --- /dev/null +++ b/src/store/modules/dict.store.ts @@ -0,0 +1,72 @@ +import { store } from "@/store"; +import DictAPI, { type DictItemOption } from "@/api/system/dict.api"; + +export const useDictStore = defineStore("dict", () => { + // 字典数据缓存 + const dictCache = useStorage>("dict_cache", {}); + + // 请求队列(防止重复请求) + const requestQueue: Record> = {}; + + /** + * 缓存字典数据 + * @param dictCode 字典编码 + * @param data 字典项列表 + */ + const cacheDictItems = (dictCode: string, data: DictItemOption[]) => { + dictCache.value[dictCode] = data; + }; + + /** + * 加载字典数据(如果缓存中没有则请求) + * @param dictCode 字典编码 + */ + const loadDictItems = async (dictCode: string) => { + if (dictCache.value[dictCode]) return; + // 防止重复请求 + if (!requestQueue[dictCode]) { + requestQueue[dictCode] = DictAPI.getDictItems(dictCode).then((data) => { + cacheDictItems(dictCode, data); + Reflect.deleteProperty(requestQueue, dictCode); + }); + } + await requestQueue[dictCode]; + }; + + /** + * 获取字典项列表 + * @param dictCode 字典编码 + * @returns 字典项列表 + */ + const getDictItems = (dictCode: string): DictItemOption[] => { + return dictCache.value[dictCode] || []; + }; + + /** + * 移除指定字典项 + * @param dictCode 字典编码 + */ + const removeDictItem = (dictCode: string) => { + if (dictCache.value[dictCode]) { + Reflect.deleteProperty(dictCache.value, dictCode); + } + }; + + /** + * 清空字典缓存 + */ + const clearDictCache = () => { + dictCache.value = {}; + }; + + return { + loadDictItems, + getDictItems, + removeDictItem, + clearDictCache, + }; +}); + +export function useDictStoreHook() { + return useDictStore(store); +} diff --git a/src/store/modules/permission.store.ts b/src/store/modules/permission.store.ts new file mode 100644 index 0000000..8c2d57c --- /dev/null +++ b/src/store/modules/permission.store.ts @@ -0,0 +1,127 @@ +import type { RouteRecordRaw } from "vue-router"; +import { defineStore } from "pinia"; +import { constantRoutes } from "@/router"; +import { store } from "@/store"; +import router from "@/router"; + +// 导入固定菜单配置 +import { staticMenuRoutes } from "@/config/menu.config"; + +const modules = import.meta.glob("../../views/**/**.vue"); +const Layout = () => import("@/layouts/index.vue"); + +export const usePermissionStore = defineStore("permission", () => { + // 存储所有路由,包括静态路由和动态路由 + const routes = ref([]); + // 混合模式左侧菜单路由 + const sideMenuRoutes = ref([]); + // 路由是否加载完成 + const routesLoaded = ref(false); + + /** + * 生成路由(使用固定菜单配置) + * + * @returns Promise 解析后的动态路由列表 + */ + function generateRoutes() { + return new Promise((resolve, reject) => { + console.log("🔧 Starting to generate routes from static config..."); + + try { + // 使用固定菜单配置替代API请求 + const dynamicRoutes = parseDynamicRoutes(staticMenuRoutes); + + routes.value = [...constantRoutes, ...dynamicRoutes]; + routesLoaded.value = true; + + console.log("✅ Routes generation completed successfully from static config"); + resolve(dynamicRoutes); + } catch (error) { + console.error("❌ Failed to generate routes from static config:", error); + routesLoaded.value = false; + reject(error); + } + }); + } + + /** + * 根据父菜单路径设置侧边菜单 + * + * @param parentPath 父菜单的路径,用于查找对应的菜单项 + */ + const updateSideMenu = (parentPath: string) => { + const matchedItem = routes.value.find((item) => item.path === parentPath); + if (matchedItem && matchedItem.children) { + sideMenuRoutes.value = matchedItem.children; + } + }; + + /** + * 重置路由 + */ + const resetRouter = () => { + // 创建常量路由名称集合,用于O(1)时间复杂度的查找 + const constantRouteNames = new Set(constantRoutes.map((route) => route.name).filter(Boolean)); + + // 从 router 实例中移除动态路由 + routes.value.forEach((route) => { + if (route.name && !constantRouteNames.has(route.name)) { + router.removeRoute(route.name); + } + }); + + // 重置为仅包含常量路由 + routes.value = [...constantRoutes]; + sideMenuRoutes.value = []; + routesLoaded.value = false; + }; + + return { + routes, + sideMenuRoutes, + routesLoaded, + generateRoutes, + updateSideMenu, + resetRouter, + }; +}); + +/** + * 解析路由数据并转换为 Vue Router 兼容的路由配置 + * + * @param rawRoutes 原始路由数据 + * @returns 解析后的路由集合 + */ +const parseDynamicRoutes = (rawRoutes: any[]): RouteRecordRaw[] => { + const parsedRoutes: RouteRecordRaw[] = []; + + rawRoutes.forEach((route) => { + const normalizedRoute = { ...route } as RouteRecordRaw; + + // 处理组件路径 + normalizedRoute.component = + normalizedRoute.component?.toString() === "Layout" + ? Layout + : modules[`../../views/${normalizedRoute.component}.vue`] || + modules["../../views/error-page/404.vue"]; + + // 递归解析子路由 + if (normalizedRoute.children) { + normalizedRoute.children = parseDynamicRoutes(route.children); + } + + parsedRoutes.push(normalizedRoute); + }); + + return parsedRoutes; +}; + +/** + * 导出此hook函数用于在非组件环境(如其他store、工具函数等)中获取权限store实例 + * + * 在组件中可直接使用usePermissionStore(),但在组件外部需要传入store实例 + * 此函数简化了这个过程,避免每次都手动传入store参数 + */ +export function usePermissionStoreHook() { + return usePermissionStore(store); +} diff --git a/src/store/modules/settings.store.ts b/src/store/modules/settings.store.ts new file mode 100644 index 0000000..4263eaf --- /dev/null +++ b/src/store/modules/settings.store.ts @@ -0,0 +1,160 @@ +import { defaultSettings } from "@/settings"; +import { SidebarColor, ThemeMode } from "@/enums/settings/theme.enum"; +import type { LayoutMode } from "@/enums/settings/layout.enum"; +import { applyTheme, generateThemeColors, toggleDarkMode, toggleSidebarColor } from "@/utils/theme"; +import { SETTINGS_KEYS } from "@/constants"; + +// 🎯 设置项类型定义 +interface SettingsState { + // 界面显示设置 + settingsVisible: boolean; + showTagsView: boolean; + showAppLogo: boolean; + showWatermark: boolean; + + // 布局设置 + layout: LayoutMode; + sidebarColorScheme: string; + + // 主题设置 + theme: ThemeMode; + themeColor: string; +} + +// 🎯 可变更的设置项类型 +type MutableSetting = Exclude; +type SettingValue = SettingsState[K]; + +export const useSettingsStore = defineStore("setting", () => { + // 🎯 基础设置 - 非持久化 + const settingsVisible = ref(false); + + // 🎯 持久化设置 - 使用分组常量 + const showTagsView = useStorage( + SETTINGS_KEYS.SHOW_TAGS_VIEW, + defaultSettings.showTagsView + ); + + const showAppLogo = useStorage(SETTINGS_KEYS.SHOW_APP_LOGO, defaultSettings.showAppLogo); + + const showWatermark = useStorage( + SETTINGS_KEYS.SHOW_WATERMARK, + defaultSettings.showWatermark + ); + + const sidebarColorScheme = useStorage( + SETTINGS_KEYS.SIDEBAR_COLOR_SCHEME, + defaultSettings.sidebarColorScheme + ); + + const layout = useStorage(SETTINGS_KEYS.LAYOUT, defaultSettings.layout as LayoutMode); + + const themeColor = useStorage(SETTINGS_KEYS.THEME_COLOR, defaultSettings.themeColor); + + const theme = useStorage(SETTINGS_KEYS.THEME, defaultSettings.theme); + + // 🎯 设置项映射 + const settingsMap = { + showTagsView, + showAppLogo, + showWatermark, + sidebarColorScheme, + layout, + } as const; + + // 🎯 监听器 - 主题变化 + watch( + [theme, themeColor], + ([newTheme, newThemeColor]) => { + toggleDarkMode(newTheme === ThemeMode.DARK); + const colors = generateThemeColors(newThemeColor, newTheme); + applyTheme(colors); + }, + { immediate: true } + ); + + // 🎯 监听器 - 侧边栏配色方案变化 + watch( + [sidebarColorScheme], + ([newSidebarColorScheme]) => { + toggleSidebarColor(newSidebarColorScheme === SidebarColor.CLASSIC_BLUE); + }, + { immediate: true } + ); + + // 🎯 统一的设置更新方法 - 类型安全 + function updateSetting(key: K, value: SettingValue): void { + const setting = settingsMap[key]; + if (setting) { + (setting as Ref).value = value; + } + } + + // 🎯 主题相关的专用更新方法 + function updateTheme(newTheme: ThemeMode): void { + theme.value = newTheme; + } + + function updateThemeColor(newColor: string): void { + themeColor.value = newColor; + } + + function updateSidebarColorScheme(newScheme: string): void { + sidebarColorScheme.value = newScheme; + } + + function updateLayout(newLayout: LayoutMode): void { + layout.value = newLayout; + } + + // 🎯 设置面板显示控制 + function toggleSettingsPanel(): void { + settingsVisible.value = !settingsVisible.value; + } + + function showSettingsPanel(): void { + settingsVisible.value = true; + } + + function hideSettingsPanel(): void { + settingsVisible.value = false; + } + + // 🎯 批量重置设置 + function resetSettings(): void { + showTagsView.value = defaultSettings.showTagsView; + showAppLogo.value = defaultSettings.showAppLogo; + showWatermark.value = defaultSettings.showWatermark; + sidebarColorScheme.value = defaultSettings.sidebarColorScheme; + layout.value = defaultSettings.layout as LayoutMode; + themeColor.value = defaultSettings.themeColor; + theme.value = defaultSettings.theme; + } + + return { + // 状态 + settingsVisible, + showTagsView, + showAppLogo, + showWatermark, + sidebarColorScheme, + layout, + themeColor, + theme, + + // 更新方法 + updateSetting, + updateTheme, + updateThemeColor, + updateSidebarColorScheme, + updateLayout, + + // 面板控制 + toggleSettingsPanel, + showSettingsPanel, + hideSettingsPanel, + + // 重置功能 + resetSettings, + }; +}); diff --git a/src/store/modules/tags-view.store.ts b/src/store/modules/tags-view.store.ts new file mode 100644 index 0000000..7a39ffb --- /dev/null +++ b/src/store/modules/tags-view.store.ts @@ -0,0 +1,257 @@ +export const useTagsViewStore = defineStore("tagsView", () => { + const visitedViews = ref([]); + const cachedViews = ref([]); + const router = useRouter(); + const route = useRoute(); + + /** + * 添加已访问视图到已访问视图列表中 + */ + function addVisitedView(view: TagView) { + // 如果已经存在于已访问的视图列表中或者是重定向地址,则不再添加 + if (view.path.startsWith("/redirect")) { + return; + } + if (visitedViews.value.some((v) => v.name === view.name)) { + return; + } + // 如果视图是固定的(affix),则在已访问的视图列表的开头添加 + if (view.affix) { + visitedViews.value.unshift(view); + } else { + // 如果视图不是固定的,则在已访问的视图列表的末尾添加 + visitedViews.value.push(view); + } + } + + /** + * 添加缓存视图到缓存视图列表中 + */ + function addCachedView(view: TagView) { + const viewName = view.name; + // 如果缓存视图名称已经存在于缓存视图列表中,则不再添加 + if (cachedViews.value.includes(viewName)) { + return; + } + + // 如果视图需要缓存(keepAlive),则将其路由名称添加到缓存视图列表中 + if (view.keepAlive) { + cachedViews.value.push(viewName); + } + } + + /** + * 从已访问视图列表中删除指定的视图 + */ + function delVisitedView(view: TagView) { + return new Promise((resolve) => { + for (const [i, v] of visitedViews.value.entries()) { + // 找到与指定视图路径匹配的视图,在已访问视图列表中删除该视图 + if (v.path === view.path) { + visitedViews.value.splice(i, 1); + break; + } + } + resolve([...visitedViews.value]); + }); + } + + function delCachedView(view: TagView) { + const viewName = view.name; + return new Promise((resolve) => { + const index = cachedViews.value.indexOf(viewName); + if (index > -1) { + cachedViews.value.splice(index, 1); + } + resolve([...cachedViews.value]); + }); + } + function delOtherVisitedViews(view: TagView) { + return new Promise((resolve) => { + visitedViews.value = visitedViews.value.filter((v) => { + return v?.affix || v.path === view.path; + }); + resolve([...visitedViews.value]); + }); + } + + function delOtherCachedViews(view: TagView) { + const viewName = view.name as string; + return new Promise((resolve) => { + const index = cachedViews.value.indexOf(viewName); + if (index > -1) { + cachedViews.value = cachedViews.value.slice(index, index + 1); + } else { + // if index = -1, there is no cached tags + cachedViews.value = []; + } + resolve([...cachedViews.value]); + }); + } + + function updateVisitedView(view: TagView) { + for (let v of visitedViews.value) { + if (v.path === view.path) { + v = Object.assign(v, view); + break; + } + } + } + + function addView(view: TagView) { + addVisitedView(view); + addCachedView(view); + } + + function delView(view: TagView) { + return new Promise((resolve) => { + delVisitedView(view); + delCachedView(view); + resolve({ + visitedViews: [...visitedViews.value], + cachedViews: [...cachedViews.value], + }); + }); + } + + function delOtherViews(view: TagView) { + return new Promise((resolve) => { + delOtherVisitedViews(view); + delOtherCachedViews(view); + resolve({ + visitedViews: [...visitedViews.value], + cachedViews: [...cachedViews.value], + }); + }); + } + + function delLeftViews(view: TagView) { + return new Promise((resolve) => { + const currIndex = visitedViews.value.findIndex((v) => v.path === view.path); + if (currIndex === -1) { + return; + } + visitedViews.value = visitedViews.value.filter((item, index) => { + if (index >= currIndex || item?.affix) { + return true; + } + + const cacheIndex = cachedViews.value.indexOf(item.name); + if (cacheIndex > -1) { + cachedViews.value.splice(cacheIndex, 1); + } + return false; + }); + resolve({ + visitedViews: [...visitedViews.value], + }); + }); + } + + function delRightViews(view: TagView) { + return new Promise((resolve) => { + const currIndex = visitedViews.value.findIndex((v) => v.path === view.path); + if (currIndex === -1) { + return; + } + visitedViews.value = visitedViews.value.filter((item, index) => { + if (index <= currIndex || item?.affix) { + return true; + } + }); + resolve({ + visitedViews: [...visitedViews.value], + }); + }); + } + + function delAllViews() { + return new Promise((resolve) => { + const affixTags = visitedViews.value.filter((tag) => tag?.affix); + visitedViews.value = affixTags; + cachedViews.value = []; + resolve({ + visitedViews: [...visitedViews.value], + cachedViews: [...cachedViews.value], + }); + }); + } + + function delAllVisitedViews() { + return new Promise((resolve) => { + const affixTags = visitedViews.value.filter((tag) => tag?.affix); + visitedViews.value = affixTags; + resolve([...visitedViews.value]); + }); + } + + function delAllCachedViews() { + return new Promise((resolve) => { + cachedViews.value = []; + resolve([...cachedViews.value]); + }); + } + + /** + * 关闭当前tagView + */ + function closeCurrentView() { + const tags: TagView = { + name: route.name as string, + title: route.meta.title as string, + path: route.path, + fullPath: route.fullPath, + affix: route.meta?.affix, + keepAlive: route.meta?.keepAlive, + query: route.query, + }; + delView(tags).then((res: any) => { + if (isActive(tags)) { + toLastView(res.visitedViews, tags); + } + }); + } + + function isActive(tag: TagView) { + return tag.path === route.path; + } + + function toLastView(visitedViews: TagView[], view?: TagView) { + const latestView = visitedViews.slice(-1)[0]; + if (latestView && latestView.fullPath) { + router.push(latestView.fullPath); + } else { + // now the default is to redirect to the home page if there is no tags-view, + // you can adjust it according to your needs. + if (view?.name === "Dashboard") { + // to reload home page + router.replace("/redirect" + view.fullPath); + } else { + router.push("/"); + } + } + } + + return { + visitedViews, + cachedViews, + addVisitedView, + addCachedView, + delVisitedView, + delCachedView, + delOtherVisitedViews, + delOtherCachedViews, + updateVisitedView, + addView, + delView, + delOtherViews, + delLeftViews, + delRightViews, + delAllViews, + delAllVisitedViews, + delAllCachedViews, + closeCurrentView, + isActive, + toLastView, + }; +}); diff --git a/src/store/modules/user.store.ts b/src/store/modules/user.store.ts new file mode 100644 index 0000000..8a0b123 --- /dev/null +++ b/src/store/modules/user.store.ts @@ -0,0 +1,161 @@ +import { store } from "@/store"; + +import AuthAPI, { type LoginFormData } from "@/api/auth.api"; +import UserAPI, { type UserInfo } from "@/api/system/user.api"; + +import { Auth } from "@/utils/auth"; +import { usePermissionStoreHook } from "@/store/modules/permission.store"; +import { useDictStoreHook } from "@/store/modules/dict.store"; +import { useTagsViewStore } from "@/store"; + +export const useUserStore = defineStore("user", () => { + const userInfo = useStorage("userInfo", {} as UserInfo); + // 记住我状态 + const rememberMe = ref(Auth.getRememberMe()); + + /** + * 登录 + * + * @param {LoginFormData} + * @returns + */ + function login(LoginFormData: LoginFormData) { + return new Promise((resolve, reject) => { + AuthAPI.login(LoginFormData) + .then((data) => { + const { accessToken, refreshToken } = data; + // 保存记住我状态和token + rememberMe.value = LoginFormData.rememberMe; + Auth.setTokens(accessToken, refreshToken, rememberMe.value); + resolve(); + }) + .catch((error) => { + reject(error); + }); + }); + } + + /** + * 获取用户信息 + * + * @returns {UserInfo} 用户信息 + */ + function getUserInfo() { + return new Promise((resolve, reject) => { + UserAPI.getInfo() + .then((data) => { + if (!data) { + reject("Verification failed, please Login again."); + return; + } + Object.assign(userInfo.value, { ...data }); + resolve(data); + }) + .catch((error) => { + reject(error); + }); + }); + } + + /** + * 登出 + */ + function logout() { + return new Promise((resolve, reject) => { + AuthAPI.logout() + .then(() => { + // 重置所有系统状态 + resetAllState(); + resolve(); + }) + .catch((error) => { + reject(error); + }); + }); + } + + /** + * 重置所有系统状态 + * 统一处理所有清理工作,包括用户凭证、路由、缓存等 + */ + function resetAllState() { + // 1. 重置用户状态 + resetUserState(); + + // 2. 重置其他模块状态 + // 重置路由 + usePermissionStoreHook().resetRouter(); + // 清除字典缓存 + useDictStoreHook().clearDictCache(); + // 清除标签视图 + useTagsViewStore().delAllViews(); + + // 3. 清理 WebSocket 连接 + // 动态导入避免循环依赖 + import("@/plugins/websocket") + .then(({ cleanupWebSocket }) => { + cleanupWebSocket(); + console.log("[UserStore] WebSocket connections cleaned up"); + }) + .catch((error) => { + console.error("[UserStore] Failed to cleanup WebSocket:", error); + }); + + return Promise.resolve(); + } + + /** + * 重置用户状态 + * 仅处理用户模块内的状态 + */ + function resetUserState() { + // 清除用户凭证 + Auth.clearAuth(); + // 重置用户信息 + userInfo.value = {} as UserInfo; + } + + /** + * 刷新 token + */ + function refreshToken() { + const refreshToken = Auth.getRefreshToken(); + + if (!refreshToken) { + return Promise.reject(new Error("没有有效的刷新令牌")); + } + + return new Promise((resolve, reject) => { + AuthAPI.refreshToken(refreshToken) + .then((data) => { + const { accessToken, refreshToken: newRefreshToken } = data; + // 更新令牌,保持当前记住我状态 + Auth.setTokens(accessToken, newRefreshToken, Auth.getRememberMe()); + resolve(); + }) + .catch((error) => { + console.log(" refreshToken 刷新失败", error); + reject(error); + }); + }); + } + + return { + userInfo, + rememberMe, + getUserInfo, + login, + logout, + resetAllState, + resetUserState, + refreshToken, + }; +}); + +/** + * 在组件外部使用UserStore的钩子函数 + * @see https://pinia.vuejs.org/core-concepts/outside-component-usage.html + */ +export function useUserStoreHook() { + return useUserStore(store); +} diff --git a/src/styles/dark/css-vars.css b/src/styles/dark/css-vars.css new file mode 100644 index 0000000..823aabf --- /dev/null +++ b/src/styles/dark/css-vars.css @@ -0,0 +1,7 @@ +/* 暗黑模式通过 CSS 自定义变量,官方链接:https://element-plus.org/zh-CN/guide/dark-mode.html#%E9%80%9A%E8%BF%87-css */ +html.dark { + .el-table { + /* 自定义表格选中高亮时当前行的背景颜色 */ + --el-table-current-row-bg-color: var(--el-fill-color-light); + } +} diff --git a/src/styles/element-plus.scss b/src/styles/element-plus.scss new file mode 100644 index 0000000..fc5b729 --- /dev/null +++ b/src/styles/element-plus.scss @@ -0,0 +1,45 @@ +$border: 1px solid var(--el-border-color-light); + +/* el-dialog */ +.el-dialog { + .el-dialog__header { + padding: 15px 20px; + margin: 0; + border-bottom: $border; + } + + .el-dialog__body { + padding: 20px; + } + + .el-dialog__footer { + padding: 15px; + border-top: $border; + } +} + +/** el-drawer */ +.el-drawer { + .el-drawer__header { + padding: 15px 20px; + margin: 0; + color: inherit; + border-bottom: $border; + } + + .el-drawer__body { + padding: 20px; + } + + .el-drawer__footer { + padding: 15px; + border-top: $border; + } +} + +// 抽屉和对话框底部按钮区域 +.dialog-footer { + display: flex; + gap: 8px; + justify-content: flex-end; +} diff --git a/src/styles/index.scss b/src/styles/index.scss new file mode 100644 index 0000000..9533568 --- /dev/null +++ b/src/styles/index.scss @@ -0,0 +1,118 @@ +@use "./reset"; +@use "./element-plus"; + +.app-container { + padding: 15px; +} + +// 进度条颜色 +#nprogress .bar { + background-color: var(--el-color-primary); +} + +// 混合布局左侧菜单的hover样式 +.layout-mix .layout__sidebar--left .el-menu { + .el-menu-item { + &:hover { + // 极简白主题:使用浅灰色背景 + background-color: var(--el-fill-color-light) !important; + } + } + + .el-sub-menu__title { + &:hover { + // 极简白主题:使用浅灰色背景 + background-color: var(--el-fill-color-light) !important; + } + } +} + +// 深色主题或深蓝色侧边栏配色下的左侧菜单hover样式 +html.dark .layout-mix .layout__sidebar--left .el-menu, +html.sidebar-color-blue .layout-mix .layout__sidebar--left .el-menu { + .el-menu-item { + &:hover { + // 深色背景:使用CSS变量 + background-color: var(--menu-hover) !important; + } + } + + .el-sub-menu__title { + &:hover { + // 深色背景:使用CSS变量 + background-color: var(--menu-hover) !important; + } + } +} + +// 窄屏时隐藏菜单文字,只显示图标 +.hideSidebar { + // Top布局和Mix布局的水平菜单 + &.layout-top .layout__header .el-menu--horizontal, + &.layout-mix .layout__header .el-menu--horizontal { + .el-menu-item, + .el-sub-menu__title { + .menu-title, + span:not([class*="i-svg"]):not(.el-icon) { + display: none !important; + } + } + } + + // Mix布局的左侧菜单 + &.layout-mix .layout__sidebar--left .el-menu { + .el-menu-item, + .el-sub-menu__title { + .menu-title, + span:not([class*="i-svg"]):not(.el-icon) { + display: none !important; + } + } + } +} + +// 全局搜索区域样式 +.search-container { + padding: 18px 16px 0; + margin-bottom: 16px; + background-color: var(--el-bg-color-overlay); + border: 1px solid var(--el-border-color-light); + border-radius: 4px; + + .search-buttons { + margin-right: 0; + } + + .el-form-item { + margin-bottom: 18px; + } +} + +// 表格区域样式 +.data-table { + margin-bottom: 16px; + + // 表格工具栏区域 + &__toolbar { + display: flex; + justify-content: space-between; + margin-bottom: 16px; + + &--actions, + &--tools { + display: flex; + gap: 8px; + } + } + + // 表格内容区域 + &__content { + margin: 8px 0; + } + + // 分页区域 + .el-pagination { + justify-content: flex-end; + margin-top: 16px; + } +} diff --git a/src/styles/reset.scss b/src/styles/reset.scss new file mode 100644 index 0000000..b3b43c7 --- /dev/null +++ b/src/styles/reset.scss @@ -0,0 +1,77 @@ +*, +::before, +::after { + box-sizing: border-box; + border-color: currentcolor; + border-style: solid; + border-width: 0; +} + +#app { + width: 100%; + height: 100%; +} + +html { + box-sizing: border-box; + width: 100%; + height: 100%; + line-height: 1.5; + tab-size: 4; + text-size-adjust: 100%; +} + +body { + width: 100%; + height: 100%; + margin: 0; + font-family: + "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", + Arial, sans-serif; + line-height: inherit; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + text-rendering: optimizelegibility; +} + +a { + color: inherit; + text-decoration: inherit; +} + +img, +svg { + display: inline-block; +} + +svg { + // 因icon大小被设置为和字体大小一致,而span等标签的下边缘会和字体的基线对齐,故需设置一个往下的偏移比例,来纠正视觉上的未对齐效果 + vertical-align: -0.15em; +} + +ul, +li { + padding: 0; + margin: 0; + list-style: none; +} + +*, +*::before, +*::after { + box-sizing: inherit; +} + +a, +a:focus, +a:hover { + color: inherit; + text-decoration: none; + cursor: pointer; +} + +a:focus, +a:active, +div:focus { + outline: none; +} diff --git a/src/styles/variables.module.scss b/src/styles/variables.module.scss new file mode 100644 index 0000000..20a624d --- /dev/null +++ b/src/styles/variables.module.scss @@ -0,0 +1,11 @@ +/* stylelint-disable property-no-unknown */ +:export { + sidebar-width: $sidebar-width; + navbar-height: $navbar-height; + tags-view-height: $tags-view-height; + menu-background: $menu-background; + menu-text: $menu-text; + menu-active-text: $menu-active-text; + menu-hover: $menu-hover; +} +/* stylelint-enable property-no-unknown */ diff --git a/src/styles/variables.scss b/src/styles/variables.scss new file mode 100644 index 0000000..c907f33 --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,93 @@ +@forward "element-plus/theme-chalk/src/common/var.scss" with ( + $colors: ( + "primary": ( + // 默认主题色 - 修改此值时需同步修改 src/settings.ts 中的 themeColor + "base": #4080ff, + ), + "success": ( + "base": #23c343, + ), + "warning": ( + "base": #ff9a2e, + ), + "danger": ( + "base": #f76560, + ), + "info": ( + "base": #a9aeb8, + ), + ), + + $bg-color: ( + "page": #f5f8fd, + ) +); + +/** 全局SCSS变量 */ + +:root { + --menu-background: #fff; // 菜单背景色 + --menu-text: #212121; // 菜单文字颜色 浅色主题-白色侧边栏配色下仅占位,实际颜色由 el-menu-item 组件决定 + --menu-active-text: var( + --el-menu-active-color + ); // 菜单激活文字颜色 浅色主题-白色侧边栏配色下仅占位,实际颜色由 el-menu-item 组件决定 + + --menu-hover: #e6f4ff; // 菜单悬停背景色 浅色主题-白色侧边栏配色下仅占位,实际颜色由 el-menu-item 组件决定 + --sidebar-logo-background: #f5f5f5; // 侧边栏 Logo 背景色 + --sidebar-logo-text-color: #333; // 侧边栏 Logo 文字颜色 +} + +/** 浅色主题-深蓝色侧边栏配色 */ +html.sidebar-color-blue { + --menu-background: #304156; // 菜单背景色 + --menu-text: #bfcbd9; // 菜单文字颜色 + --menu-active-text: var(--el-menu-active-color); // 菜单激活文字颜色 + --menu-hover: #263445; // 菜单悬停背景色 + --sidebar-logo-background: #2d3748; // 侧边栏 Logo 背景色 + --sidebar-logo-text-color: #fff; // 侧边栏 Logo 文字颜色 +} + +/** 暗黑主题 */ +html.dark { + --menu-background: var(--el-bg-color-overlay); + --menu-text: #fff; + --menu-active-text: var(--el-menu-active-color); + --menu-hover: rgb(0 0 0 / 20%); + --sidebar-logo-background: rgb(0 0 0 / 20%); + --sidebar-logo-text-color: #fff; + + /** WangEditor Dark */ + /* Textarea - css vars */ + --w-e-textarea-bg-color: var(--el-bg-color); /* 深色背景 */ + --w-e-textarea-color: var(--el-text-color-primary); /* 浅色文字 */ + --w-e-textarea-border-color: var(--el-border-color); /* 较深的边框颜色 */ + --w-e-textarea-slight-border-color: var(--el-border-color-lighter); /* 更淡一些的边框颜色 */ + --w-e-textarea-slight-color: var(--el-text-color-secondary); /* 浅灰色,用于不那么重要的元素 */ + --w-e-textarea-slight-bg-color: var(--el-bg-color-overlay); /* 稍微亮一点的背景色 */ + --w-e-textarea-selected-border-color: var(--el-color-info-light-5); /* 选中元素时的高亮边框 */ + --w-e-textarea-handler-bg-color: var(--el-color-primary); /* 工具按钮或交互元素的背景色 */ + + /* Toolbar - css vars */ + --w-e-toolbar-color: var(--el-text-color-regular); /* 工具栏文字颜色 */ + --w-e-toolbar-bg-color: var(--el-bg-color); /* 工具栏背景颜色 */ + --w-e-toolbar-active-color: var(--el-text-color-primary); /* 当前激活项的文字颜色 */ + --w-e-toolbar-active-bg-color: var(--el-fill-color-light); /* 当前激活项的背景颜色 */ + --w-e-toolbar-disabled-color: var(--el-text-color-secondary); /* 禁用项的颜色 */ + --w-e-toolbar-border-color: var(--el-border-color-base); /* 工具栏边框颜色 */ + + /* Modal - css vars */ + --w-e-modal-button-bg-color: var(--el-bg-color-light-3); /* 弹出框按钮背景色 */ + --w-e-modal-button-border-color: var(--el-border-color-light); /* 弹出框按钮边框颜色 */ +} + +$menu-background: var(--menu-background); // 菜单背景色 +$menu-text: var(--menu-text); // 菜单文字颜色 +$menu-active-text: var(--menu-active-text); // 菜单激活文字颜色 +$menu-hover: var(--menu-hover); // 菜单悬停背景色 +$sidebar-logo-background: var(--sidebar-logo-background); // 侧边栏 Logo 背景色 +$sidebar-logo-text-color: var(--sidebar-logo-text-color); // 侧边栏 Logo 文字颜色 + +$sidebar-width: 210px; // 侧边栏宽度 +$sidebar-width-collapsed: 54px; // 侧边栏收缩宽度 +$navbar-height: 50px; // 导航栏高度 +$tags-view-height: 34px; // TagsView 高度 diff --git a/src/types/auto-imports.d.ts b/src/types/auto-imports.d.ts new file mode 100644 index 0000000..20b192e --- /dev/null +++ b/src/types/auto-imports.d.ts @@ -0,0 +1,991 @@ +/* prettier-ignore */ +// @ts-nocheck +// noinspection JSUnusedGlobalSymbols +// Generated by unplugin-auto-import +export {} +declare global { + const EffectScope: (typeof import("vue"))["EffectScope"]; + const ElForm: (typeof import("element-plus/es"))["ElForm"]; + const ElMessage: (typeof import("element-plus/es"))["ElMessage"]; + const ElMessageBox: (typeof import("element-plus/es"))["ElMessageBox"]; + const ElNotification: (typeof import("element-plus/es"))["ElNotification"]; + const ElTree: (typeof import("element-plus/es"))["ElTree"]; + const acceptHMRUpdate: (typeof import("pinia"))["acceptHMRUpdate"]; + const asyncComputed: (typeof import("@vueuse/core"))["asyncComputed"]; + const autoResetRef: (typeof import("@vueuse/core"))["autoResetRef"]; + const computed: (typeof import("vue"))["computed"]; + const computedAsync: (typeof import("@vueuse/core"))["computedAsync"]; + const computedEager: (typeof import("@vueuse/core"))["computedEager"]; + const computedInject: (typeof import("@vueuse/core"))["computedInject"]; + const computedWithControl: (typeof import("@vueuse/core"))["computedWithControl"]; + const controlledComputed: (typeof import("@vueuse/core"))["controlledComputed"]; + const controlledRef: (typeof import("@vueuse/core"))["controlledRef"]; + const createApp: (typeof import("vue"))["createApp"]; + const createEventHook: (typeof import("@vueuse/core"))["createEventHook"]; + const createGlobalState: (typeof import("@vueuse/core"))["createGlobalState"]; + const createInjectionState: (typeof import("@vueuse/core"))["createInjectionState"]; + const createPinia: (typeof import("pinia"))["createPinia"]; + const createReactiveFn: (typeof import("@vueuse/core"))["createReactiveFn"]; + const createReusableTemplate: (typeof import("@vueuse/core"))["createReusableTemplate"]; + const createSharedComposable: (typeof import("@vueuse/core"))["createSharedComposable"]; + const createTemplatePromise: (typeof import("@vueuse/core"))["createTemplatePromise"]; + const createUnrefFn: (typeof import("@vueuse/core"))["createUnrefFn"]; + const customRef: (typeof import("vue"))["customRef"]; + const debouncedRef: (typeof import("@vueuse/core"))["debouncedRef"]; + const debouncedWatch: (typeof import("@vueuse/core"))["debouncedWatch"]; + const defineAsyncComponent: (typeof import("vue"))["defineAsyncComponent"]; + const defineComponent: (typeof import("vue"))["defineComponent"]; + const defineStore: (typeof import("pinia"))["defineStore"]; + const eagerComputed: (typeof import("@vueuse/core"))["eagerComputed"]; + const effectScope: (typeof import("vue"))["effectScope"]; + const extendRef: (typeof import("@vueuse/core"))["extendRef"]; + const getActivePinia: (typeof import("pinia"))["getActivePinia"]; + const getCurrentInstance: (typeof import("vue"))["getCurrentInstance"]; + const getCurrentScope: (typeof import("vue"))["getCurrentScope"]; + const h: (typeof import("vue"))["h"]; + const ignorableWatch: (typeof import("@vueuse/core"))["ignorableWatch"]; + const inject: (typeof import("vue"))["inject"]; + const injectLocal: (typeof import("@vueuse/core"))["injectLocal"]; + const isDefined: (typeof import("@vueuse/core"))["isDefined"]; + const isProxy: (typeof import("vue"))["isProxy"]; + const isReactive: (typeof import("vue"))["isReactive"]; + const isReadonly: (typeof import("vue"))["isReadonly"]; + const isRef: (typeof import("vue"))["isRef"]; + const makeDestructurable: (typeof import("@vueuse/core"))["makeDestructurable"]; + const mapActions: (typeof import("pinia"))["mapActions"]; + const mapGetters: (typeof import("pinia"))["mapGetters"]; + const mapState: (typeof import("pinia"))["mapState"]; + const mapStores: (typeof import("pinia"))["mapStores"]; + const mapWritableState: (typeof import("pinia"))["mapWritableState"]; + const markRaw: (typeof import("vue"))["markRaw"]; + const nextTick: (typeof import("vue"))["nextTick"]; + const onActivated: (typeof import("vue"))["onActivated"]; + const onBeforeMount: (typeof import("vue"))["onBeforeMount"]; + const onBeforeRouteLeave: (typeof import("vue-router"))["onBeforeRouteLeave"]; + const onBeforeRouteUpdate: (typeof import("vue-router"))["onBeforeRouteUpdate"]; + const onBeforeUnmount: (typeof import("vue"))["onBeforeUnmount"]; + const onBeforeUpdate: (typeof import("vue"))["onBeforeUpdate"]; + const onClickOutside: (typeof import("@vueuse/core"))["onClickOutside"]; + const onDeactivated: (typeof import("vue"))["onDeactivated"]; + const onErrorCaptured: (typeof import("vue"))["onErrorCaptured"]; + const onKeyStroke: (typeof import("@vueuse/core"))["onKeyStroke"]; + const onLongPress: (typeof import("@vueuse/core"))["onLongPress"]; + const onMounted: (typeof import("vue"))["onMounted"]; + const onRenderTracked: (typeof import("vue"))["onRenderTracked"]; + const onRenderTriggered: (typeof import("vue"))["onRenderTriggered"]; + const onScopeDispose: (typeof import("vue"))["onScopeDispose"]; + const onServerPrefetch: (typeof import("vue"))["onServerPrefetch"]; + const onStartTyping: (typeof import("@vueuse/core"))["onStartTyping"]; + const onUnmounted: (typeof import("vue"))["onUnmounted"]; + const onUpdated: (typeof import("vue"))["onUpdated"]; + const pausableWatch: (typeof import("@vueuse/core"))["pausableWatch"]; + const provide: (typeof import("vue"))["provide"]; + const provideLocal: (typeof import("@vueuse/core"))["provideLocal"]; + const reactify: (typeof import("@vueuse/core"))["reactify"]; + const reactifyObject: (typeof import("@vueuse/core"))["reactifyObject"]; + const reactive: (typeof import("vue"))["reactive"]; + const reactiveComputed: (typeof import("@vueuse/core"))["reactiveComputed"]; + const reactiveOmit: (typeof import("@vueuse/core"))["reactiveOmit"]; + const reactivePick: (typeof import("@vueuse/core"))["reactivePick"]; + const readonly: (typeof import("vue"))["readonly"]; + const ref: (typeof import("vue"))["ref"]; + const refAutoReset: (typeof import("@vueuse/core"))["refAutoReset"]; + const refDebounced: (typeof import("@vueuse/core"))["refDebounced"]; + const refDefault: (typeof import("@vueuse/core"))["refDefault"]; + const refThrottled: (typeof import("@vueuse/core"))["refThrottled"]; + const refWithControl: (typeof import("@vueuse/core"))["refWithControl"]; + const resolveComponent: (typeof import("vue"))["resolveComponent"]; + const resolveRef: (typeof import("@vueuse/core"))["resolveRef"]; + const resolveUnref: (typeof import("@vueuse/core"))["resolveUnref"]; + const setActivePinia: (typeof import("pinia"))["setActivePinia"]; + const setMapStoreSuffix: (typeof import("pinia"))["setMapStoreSuffix"]; + const shallowReactive: (typeof import("vue"))["shallowReactive"]; + const shallowReadonly: (typeof import("vue"))["shallowReadonly"]; + const shallowRef: (typeof import("vue"))["shallowRef"]; + const storeToRefs: (typeof import("pinia"))["storeToRefs"]; + const syncRef: (typeof import("@vueuse/core"))["syncRef"]; + const syncRefs: (typeof import("@vueuse/core"))["syncRefs"]; + const templateRef: (typeof import("@vueuse/core"))["templateRef"]; + const throttledRef: (typeof import("@vueuse/core"))["throttledRef"]; + const throttledWatch: (typeof import("@vueuse/core"))["throttledWatch"]; + const toRaw: (typeof import("vue"))["toRaw"]; + const toReactive: (typeof import("@vueuse/core"))["toReactive"]; + const toRef: (typeof import("vue"))["toRef"]; + const toRefs: (typeof import("vue"))["toRefs"]; + const toValue: (typeof import("vue"))["toValue"]; + const triggerRef: (typeof import("vue"))["triggerRef"]; + const tryOnBeforeMount: (typeof import("@vueuse/core"))["tryOnBeforeMount"]; + const tryOnBeforeUnmount: (typeof import("@vueuse/core"))["tryOnBeforeUnmount"]; + const tryOnMounted: (typeof import("@vueuse/core"))["tryOnMounted"]; + const tryOnScopeDispose: (typeof import("@vueuse/core"))["tryOnScopeDispose"]; + const tryOnUnmounted: (typeof import("@vueuse/core"))["tryOnUnmounted"]; + const unref: (typeof import("vue"))["unref"]; + const unrefElement: (typeof import("@vueuse/core"))["unrefElement"]; + const until: (typeof import("@vueuse/core"))["until"]; + const useActiveElement: (typeof import("@vueuse/core"))["useActiveElement"]; + const useAnimate: (typeof import("@vueuse/core"))["useAnimate"]; + const useArrayDifference: (typeof import("@vueuse/core"))["useArrayDifference"]; + const useArrayEvery: (typeof import("@vueuse/core"))["useArrayEvery"]; + const useArrayFilter: (typeof import("@vueuse/core"))["useArrayFilter"]; + const useArrayFind: (typeof import("@vueuse/core"))["useArrayFind"]; + const useArrayFindIndex: (typeof import("@vueuse/core"))["useArrayFindIndex"]; + const useArrayFindLast: (typeof import("@vueuse/core"))["useArrayFindLast"]; + const useArrayIncludes: (typeof import("@vueuse/core"))["useArrayIncludes"]; + const useArrayJoin: (typeof import("@vueuse/core"))["useArrayJoin"]; + const useArrayMap: (typeof import("@vueuse/core"))["useArrayMap"]; + const useArrayReduce: (typeof import("@vueuse/core"))["useArrayReduce"]; + const useArraySome: (typeof import("@vueuse/core"))["useArraySome"]; + const useArrayUnique: (typeof import("@vueuse/core"))["useArrayUnique"]; + const useAsyncQueue: (typeof import("@vueuse/core"))["useAsyncQueue"]; + const useAsyncState: (typeof import("@vueuse/core"))["useAsyncState"]; + const useAttrs: (typeof import("vue"))["useAttrs"]; + const useBase64: (typeof import("@vueuse/core"))["useBase64"]; + const useBattery: (typeof import("@vueuse/core"))["useBattery"]; + const useBluetooth: (typeof import("@vueuse/core"))["useBluetooth"]; + const useBreakpoints: (typeof import("@vueuse/core"))["useBreakpoints"]; + const useBroadcastChannel: (typeof import("@vueuse/core"))["useBroadcastChannel"]; + const useBrowserLocation: (typeof import("@vueuse/core"))["useBrowserLocation"]; + const useCached: (typeof import("@vueuse/core"))["useCached"]; + const useClipboard: (typeof import("@vueuse/core"))["useClipboard"]; + const useClipboardItems: (typeof import("@vueuse/core"))["useClipboardItems"]; + const useCloned: (typeof import("@vueuse/core"))["useCloned"]; + const useColorMode: (typeof import("@vueuse/core"))["useColorMode"]; + const useConfirmDialog: (typeof import("@vueuse/core"))["useConfirmDialog"]; + const useCounter: (typeof import("@vueuse/core"))["useCounter"]; + const useCssModule: (typeof import("vue"))["useCssModule"]; + const useCssVar: (typeof import("@vueuse/core"))["useCssVar"]; + const useCssVars: (typeof import("vue"))["useCssVars"]; + const useCurrentElement: (typeof import("@vueuse/core"))["useCurrentElement"]; + const useCycleList: (typeof import("@vueuse/core"))["useCycleList"]; + const useDark: (typeof import("@vueuse/core"))["useDark"]; + const useDateFormat: (typeof import("@vueuse/core"))["useDateFormat"]; + const useDebounce: (typeof import("@vueuse/core"))["useDebounce"]; + const useDebounceFn: (typeof import("@vueuse/core"))["useDebounceFn"]; + const useDebouncedRefHistory: (typeof import("@vueuse/core"))["useDebouncedRefHistory"]; + const useDeviceMotion: (typeof import("@vueuse/core"))["useDeviceMotion"]; + const useDeviceOrientation: (typeof import("@vueuse/core"))["useDeviceOrientation"]; + const useDevicePixelRatio: (typeof import("@vueuse/core"))["useDevicePixelRatio"]; + const useDevicesList: (typeof import("@vueuse/core"))["useDevicesList"]; + const useDisplayMedia: (typeof import("@vueuse/core"))["useDisplayMedia"]; + const useDocumentVisibility: (typeof import("@vueuse/core"))["useDocumentVisibility"]; + const useDraggable: (typeof import("@vueuse/core"))["useDraggable"]; + const useDropZone: (typeof import("@vueuse/core"))["useDropZone"]; + const useElementBounding: (typeof import("@vueuse/core"))["useElementBounding"]; + const useElementByPoint: (typeof import("@vueuse/core"))["useElementByPoint"]; + const useElementHover: (typeof import("@vueuse/core"))["useElementHover"]; + const useElementSize: (typeof import("@vueuse/core"))["useElementSize"]; + const useElementVisibility: (typeof import("@vueuse/core"))["useElementVisibility"]; + const useEventBus: (typeof import("@vueuse/core"))["useEventBus"]; + const useEventListener: (typeof import("@vueuse/core"))["useEventListener"]; + const useEventSource: (typeof import("@vueuse/core"))["useEventSource"]; + const useEyeDropper: (typeof import("@vueuse/core"))["useEyeDropper"]; + const useFavicon: (typeof import("@vueuse/core"))["useFavicon"]; + const useFetch: (typeof import("@vueuse/core"))["useFetch"]; + const useFileDialog: (typeof import("@vueuse/core"))["useFileDialog"]; + const useFileSystemAccess: (typeof import("@vueuse/core"))["useFileSystemAccess"]; + const useFocus: (typeof import("@vueuse/core"))["useFocus"]; + const useFocusWithin: (typeof import("@vueuse/core"))["useFocusWithin"]; + const useFps: (typeof import("@vueuse/core"))["useFps"]; + const useFullscreen: (typeof import("@vueuse/core"))["useFullscreen"]; + const useGamepad: (typeof import("@vueuse/core"))["useGamepad"]; + const useGeolocation: (typeof import("@vueuse/core"))["useGeolocation"]; + const useI18n: (typeof import("vue-i18n"))["useI18n"]; + const useIdle: (typeof import("@vueuse/core"))["useIdle"]; + const useImage: (typeof import("@vueuse/core"))["useImage"]; + const useInfiniteScroll: (typeof import("@vueuse/core"))["useInfiniteScroll"]; + const useIntersectionObserver: (typeof import("@vueuse/core"))["useIntersectionObserver"]; + const useInterval: (typeof import("@vueuse/core"))["useInterval"]; + const useIntervalFn: (typeof import("@vueuse/core"))["useIntervalFn"]; + const useKeyModifier: (typeof import("@vueuse/core"))["useKeyModifier"]; + const useLastChanged: (typeof import("@vueuse/core"))["useLastChanged"]; + const useLink: (typeof import("vue-router"))["useLink"]; + const useLocalStorage: (typeof import("@vueuse/core"))["useLocalStorage"]; + const useMagicKeys: (typeof import("@vueuse/core"))["useMagicKeys"]; + const useManualRefHistory: (typeof import("@vueuse/core"))["useManualRefHistory"]; + const useMediaControls: (typeof import("@vueuse/core"))["useMediaControls"]; + const useMediaQuery: (typeof import("@vueuse/core"))["useMediaQuery"]; + const useMemoize: (typeof import("@vueuse/core"))["useMemoize"]; + const useMemory: (typeof import("@vueuse/core"))["useMemory"]; + const useMounted: (typeof import("@vueuse/core"))["useMounted"]; + const useMouse: (typeof import("@vueuse/core"))["useMouse"]; + const useMouseInElement: (typeof import("@vueuse/core"))["useMouseInElement"]; + const useMousePressed: (typeof import("@vueuse/core"))["useMousePressed"]; + const useMutationObserver: (typeof import("@vueuse/core"))["useMutationObserver"]; + const useNavigatorLanguage: (typeof import("@vueuse/core"))["useNavigatorLanguage"]; + const useNetwork: (typeof import("@vueuse/core"))["useNetwork"]; + const useNow: (typeof import("@vueuse/core"))["useNow"]; + const useObjectUrl: (typeof import("@vueuse/core"))["useObjectUrl"]; + const useOffsetPagination: (typeof import("@vueuse/core"))["useOffsetPagination"]; + const useOnline: (typeof import("@vueuse/core"))["useOnline"]; + const usePageLeave: (typeof import("@vueuse/core"))["usePageLeave"]; + const useParallax: (typeof import("@vueuse/core"))["useParallax"]; + const useParentElement: (typeof import("@vueuse/core"))["useParentElement"]; + const usePerformanceObserver: (typeof import("@vueuse/core"))["usePerformanceObserver"]; + const usePermission: (typeof import("@vueuse/core"))["usePermission"]; + const usePointer: (typeof import("@vueuse/core"))["usePointer"]; + const usePointerLock: (typeof import("@vueuse/core"))["usePointerLock"]; + const usePointerSwipe: (typeof import("@vueuse/core"))["usePointerSwipe"]; + const usePreferredColorScheme: (typeof import("@vueuse/core"))["usePreferredColorScheme"]; + const usePreferredContrast: (typeof import("@vueuse/core"))["usePreferredContrast"]; + const usePreferredDark: (typeof import("@vueuse/core"))["usePreferredDark"]; + const usePreferredLanguages: (typeof import("@vueuse/core"))["usePreferredLanguages"]; + const usePreferredReducedMotion: (typeof import("@vueuse/core"))["usePreferredReducedMotion"]; + const usePrevious: (typeof import("@vueuse/core"))["usePrevious"]; + const useRafFn: (typeof import("@vueuse/core"))["useRafFn"]; + const useRefHistory: (typeof import("@vueuse/core"))["useRefHistory"]; + const useResizeObserver: (typeof import("@vueuse/core"))["useResizeObserver"]; + const useRoute: (typeof import("vue-router"))["useRoute"]; + const useRouter: (typeof import("vue-router"))["useRouter"]; + const useScreenOrientation: (typeof import("@vueuse/core"))["useScreenOrientation"]; + const useScreenSafeArea: (typeof import("@vueuse/core"))["useScreenSafeArea"]; + const useScriptTag: (typeof import("@vueuse/core"))["useScriptTag"]; + const useScroll: (typeof import("@vueuse/core"))["useScroll"]; + const useScrollLock: (typeof import("@vueuse/core"))["useScrollLock"]; + const useSessionStorage: (typeof import("@vueuse/core"))["useSessionStorage"]; + const useShare: (typeof import("@vueuse/core"))["useShare"]; + const useSlots: (typeof import("vue"))["useSlots"]; + const useSorted: (typeof import("@vueuse/core"))["useSorted"]; + const useSpeechRecognition: (typeof import("@vueuse/core"))["useSpeechRecognition"]; + const useSpeechSynthesis: (typeof import("@vueuse/core"))["useSpeechSynthesis"]; + const useStepper: (typeof import("@vueuse/core"))["useStepper"]; + const useStorage: (typeof import("@vueuse/core"))["useStorage"]; + const useStorageAsync: (typeof import("@vueuse/core"))["useStorageAsync"]; + const useStyleTag: (typeof import("@vueuse/core"))["useStyleTag"]; + const useSupported: (typeof import("@vueuse/core"))["useSupported"]; + const useSwipe: (typeof import("@vueuse/core"))["useSwipe"]; + const useTemplateRefsList: (typeof import("@vueuse/core"))["useTemplateRefsList"]; + const useTextDirection: (typeof import("@vueuse/core"))["useTextDirection"]; + const useTextSelection: (typeof import("@vueuse/core"))["useTextSelection"]; + const useTextareaAutosize: (typeof import("@vueuse/core"))["useTextareaAutosize"]; + const useThrottle: (typeof import("@vueuse/core"))["useThrottle"]; + const useThrottleFn: (typeof import("@vueuse/core"))["useThrottleFn"]; + const useThrottledRefHistory: (typeof import("@vueuse/core"))["useThrottledRefHistory"]; + const useTimeAgo: (typeof import("@vueuse/core"))["useTimeAgo"]; + const useTimeout: (typeof import("@vueuse/core"))["useTimeout"]; + const useTimeoutFn: (typeof import("@vueuse/core"))["useTimeoutFn"]; + const useTimeoutPoll: (typeof import("@vueuse/core"))["useTimeoutPoll"]; + const useTimestamp: (typeof import("@vueuse/core"))["useTimestamp"]; + const useTitle: (typeof import("@vueuse/core"))["useTitle"]; + const useToNumber: (typeof import("@vueuse/core"))["useToNumber"]; + const useToString: (typeof import("@vueuse/core"))["useToString"]; + const useToggle: (typeof import("@vueuse/core"))["useToggle"]; + const useTransition: (typeof import("@vueuse/core"))["useTransition"]; + const useUrlSearchParams: (typeof import("@vueuse/core"))["useUrlSearchParams"]; + const useUserMedia: (typeof import("@vueuse/core"))["useUserMedia"]; + const useVModel: (typeof import("@vueuse/core"))["useVModel"]; + const useVModels: (typeof import("@vueuse/core"))["useVModels"]; + const useVibrate: (typeof import("@vueuse/core"))["useVibrate"]; + const useVirtualList: (typeof import("@vueuse/core"))["useVirtualList"]; + const useWakeLock: (typeof import("@vueuse/core"))["useWakeLock"]; + const useWebNotification: (typeof import("@vueuse/core"))["useWebNotification"]; + const useWebSocket: (typeof import("@vueuse/core"))["useWebSocket"]; + const useWebWorker: (typeof import("@vueuse/core"))["useWebWorker"]; + const useWebWorkerFn: (typeof import("@vueuse/core"))["useWebWorkerFn"]; + const useWindowFocus: (typeof import("@vueuse/core"))["useWindowFocus"]; + const useWindowScroll: (typeof import("@vueuse/core"))["useWindowScroll"]; + const useWindowSize: (typeof import("@vueuse/core"))["useWindowSize"]; + const watch: (typeof import("vue"))["watch"]; + const watchArray: (typeof import("@vueuse/core"))["watchArray"]; + const watchAtMost: (typeof import("@vueuse/core"))["watchAtMost"]; + const watchDebounced: (typeof import("@vueuse/core"))["watchDebounced"]; + const watchDeep: (typeof import("@vueuse/core"))["watchDeep"]; + const watchEffect: (typeof import("vue"))["watchEffect"]; + const watchIgnorable: (typeof import("@vueuse/core"))["watchIgnorable"]; + const watchImmediate: (typeof import("@vueuse/core"))["watchImmediate"]; + const watchOnce: (typeof import("@vueuse/core"))["watchOnce"]; + const watchPausable: (typeof import("@vueuse/core"))["watchPausable"]; + const watchPostEffect: (typeof import("vue"))["watchPostEffect"]; + const watchSyncEffect: (typeof import("vue"))["watchSyncEffect"]; + const watchThrottled: (typeof import("@vueuse/core"))["watchThrottled"]; + const watchTriggerable: (typeof import("@vueuse/core"))["watchTriggerable"]; + const watchWithFilter: (typeof import("@vueuse/core"))["watchWithFilter"]; + const whenever: (typeof import("@vueuse/core"))["whenever"]; +} +// for type re-export +declare global { + // @ts-ignore + export type { + Component, + ComponentPublicInstance, + ComputedRef, + ExtractDefaultPropTypes, + ExtractPropTypes, + ExtractPublicPropTypes, + InjectionKey, + PropType, + Ref, + VNode, + WritableComputedRef, + } from "vue"; + import("vue"); +} +// for vue template auto import +import { UnwrapRef } from "vue"; +declare module "vue" { + interface GlobalComponents {} + interface ComponentCustomProperties { + readonly EffectScope: UnwrapRef<(typeof import("vue"))["EffectScope"]>; + readonly ElMessage: UnwrapRef<(typeof import("element-plus/es"))["ElMessage"]>; + readonly ElMessageBox: UnwrapRef<(typeof import("element-plus/es"))["ElMessageBox"]>; + readonly acceptHMRUpdate: UnwrapRef<(typeof import("pinia"))["acceptHMRUpdate"]>; + readonly asyncComputed: UnwrapRef<(typeof import("@vueuse/core"))["asyncComputed"]>; + readonly autoResetRef: UnwrapRef<(typeof import("@vueuse/core"))["autoResetRef"]>; + readonly computed: UnwrapRef<(typeof import("vue"))["computed"]>; + readonly computedAsync: UnwrapRef<(typeof import("@vueuse/core"))["computedAsync"]>; + readonly computedEager: UnwrapRef<(typeof import("@vueuse/core"))["computedEager"]>; + readonly computedInject: UnwrapRef<(typeof import("@vueuse/core"))["computedInject"]>; + readonly computedWithControl: UnwrapRef<(typeof import("@vueuse/core"))["computedWithControl"]>; + readonly controlledComputed: UnwrapRef<(typeof import("@vueuse/core"))["controlledComputed"]>; + readonly controlledRef: UnwrapRef<(typeof import("@vueuse/core"))["controlledRef"]>; + readonly createApp: UnwrapRef<(typeof import("vue"))["createApp"]>; + readonly createEventHook: UnwrapRef<(typeof import("@vueuse/core"))["createEventHook"]>; + readonly createGlobalState: UnwrapRef<(typeof import("@vueuse/core"))["createGlobalState"]>; + readonly createInjectionState: UnwrapRef< + (typeof import("@vueuse/core"))["createInjectionState"] + >; + readonly createPinia: UnwrapRef<(typeof import("pinia"))["createPinia"]>; + readonly createReactiveFn: UnwrapRef<(typeof import("@vueuse/core"))["createReactiveFn"]>; + readonly createReusableTemplate: UnwrapRef< + (typeof import("@vueuse/core"))["createReusableTemplate"] + >; + readonly createSharedComposable: UnwrapRef< + (typeof import("@vueuse/core"))["createSharedComposable"] + >; + readonly createTemplatePromise: UnwrapRef< + (typeof import("@vueuse/core"))["createTemplatePromise"] + >; + readonly createUnrefFn: UnwrapRef<(typeof import("@vueuse/core"))["createUnrefFn"]>; + readonly customRef: UnwrapRef<(typeof import("vue"))["customRef"]>; + readonly debouncedRef: UnwrapRef<(typeof import("@vueuse/core"))["debouncedRef"]>; + readonly debouncedWatch: UnwrapRef<(typeof import("@vueuse/core"))["debouncedWatch"]>; + readonly defineAsyncComponent: UnwrapRef<(typeof import("vue"))["defineAsyncComponent"]>; + readonly defineComponent: UnwrapRef<(typeof import("vue"))["defineComponent"]>; + readonly defineStore: UnwrapRef<(typeof import("pinia"))["defineStore"]>; + readonly eagerComputed: UnwrapRef<(typeof import("@vueuse/core"))["eagerComputed"]>; + readonly effectScope: UnwrapRef<(typeof import("vue"))["effectScope"]>; + readonly extendRef: UnwrapRef<(typeof import("@vueuse/core"))["extendRef"]>; + readonly getActivePinia: UnwrapRef<(typeof import("pinia"))["getActivePinia"]>; + readonly getCurrentInstance: UnwrapRef<(typeof import("vue"))["getCurrentInstance"]>; + readonly getCurrentScope: UnwrapRef<(typeof import("vue"))["getCurrentScope"]>; + readonly h: UnwrapRef<(typeof import("vue"))["h"]>; + readonly ignorableWatch: UnwrapRef<(typeof import("@vueuse/core"))["ignorableWatch"]>; + readonly inject: UnwrapRef<(typeof import("vue"))["inject"]>; + readonly injectLocal: UnwrapRef<(typeof import("@vueuse/core"))["injectLocal"]>; + readonly isDefined: UnwrapRef<(typeof import("@vueuse/core"))["isDefined"]>; + readonly isProxy: UnwrapRef<(typeof import("vue"))["isProxy"]>; + readonly isReactive: UnwrapRef<(typeof import("vue"))["isReactive"]>; + readonly isReadonly: UnwrapRef<(typeof import("vue"))["isReadonly"]>; + readonly isRef: UnwrapRef<(typeof import("vue"))["isRef"]>; + readonly makeDestructurable: UnwrapRef<(typeof import("@vueuse/core"))["makeDestructurable"]>; + readonly mapActions: UnwrapRef<(typeof import("pinia"))["mapActions"]>; + readonly mapGetters: UnwrapRef<(typeof import("pinia"))["mapGetters"]>; + readonly mapState: UnwrapRef<(typeof import("pinia"))["mapState"]>; + readonly mapStores: UnwrapRef<(typeof import("pinia"))["mapStores"]>; + readonly mapWritableState: UnwrapRef<(typeof import("pinia"))["mapWritableState"]>; + readonly markRaw: UnwrapRef<(typeof import("vue"))["markRaw"]>; + readonly nextTick: UnwrapRef<(typeof import("vue"))["nextTick"]>; + readonly onActivated: UnwrapRef<(typeof import("vue"))["onActivated"]>; + readonly onBeforeMount: UnwrapRef<(typeof import("vue"))["onBeforeMount"]>; + readonly onBeforeRouteLeave: UnwrapRef<(typeof import("vue-router"))["onBeforeRouteLeave"]>; + readonly onBeforeRouteUpdate: UnwrapRef<(typeof import("vue-router"))["onBeforeRouteUpdate"]>; + readonly onBeforeUnmount: UnwrapRef<(typeof import("vue"))["onBeforeUnmount"]>; + readonly onBeforeUpdate: UnwrapRef<(typeof import("vue"))["onBeforeUpdate"]>; + readonly onClickOutside: UnwrapRef<(typeof import("@vueuse/core"))["onClickOutside"]>; + readonly onDeactivated: UnwrapRef<(typeof import("vue"))["onDeactivated"]>; + readonly onErrorCaptured: UnwrapRef<(typeof import("vue"))["onErrorCaptured"]>; + readonly onKeyStroke: UnwrapRef<(typeof import("@vueuse/core"))["onKeyStroke"]>; + readonly onLongPress: UnwrapRef<(typeof import("@vueuse/core"))["onLongPress"]>; + readonly onMounted: UnwrapRef<(typeof import("vue"))["onMounted"]>; + readonly onRenderTracked: UnwrapRef<(typeof import("vue"))["onRenderTracked"]>; + readonly onRenderTriggered: UnwrapRef<(typeof import("vue"))["onRenderTriggered"]>; + readonly onScopeDispose: UnwrapRef<(typeof import("vue"))["onScopeDispose"]>; + readonly onServerPrefetch: UnwrapRef<(typeof import("vue"))["onServerPrefetch"]>; + readonly onStartTyping: UnwrapRef<(typeof import("@vueuse/core"))["onStartTyping"]>; + readonly onUnmounted: UnwrapRef<(typeof import("vue"))["onUnmounted"]>; + readonly onUpdated: UnwrapRef<(typeof import("vue"))["onUpdated"]>; + readonly pausableWatch: UnwrapRef<(typeof import("@vueuse/core"))["pausableWatch"]>; + readonly provide: UnwrapRef<(typeof import("vue"))["provide"]>; + readonly provideLocal: UnwrapRef<(typeof import("@vueuse/core"))["provideLocal"]>; + readonly reactify: UnwrapRef<(typeof import("@vueuse/core"))["reactify"]>; + readonly reactifyObject: UnwrapRef<(typeof import("@vueuse/core"))["reactifyObject"]>; + readonly reactive: UnwrapRef<(typeof import("vue"))["reactive"]>; + readonly reactiveComputed: UnwrapRef<(typeof import("@vueuse/core"))["reactiveComputed"]>; + readonly reactiveOmit: UnwrapRef<(typeof import("@vueuse/core"))["reactiveOmit"]>; + readonly reactivePick: UnwrapRef<(typeof import("@vueuse/core"))["reactivePick"]>; + readonly readonly: UnwrapRef<(typeof import("vue"))["readonly"]>; + readonly ref: UnwrapRef<(typeof import("vue"))["ref"]>; + readonly refAutoReset: UnwrapRef<(typeof import("@vueuse/core"))["refAutoReset"]>; + readonly refDebounced: UnwrapRef<(typeof import("@vueuse/core"))["refDebounced"]>; + readonly refDefault: UnwrapRef<(typeof import("@vueuse/core"))["refDefault"]>; + readonly refThrottled: UnwrapRef<(typeof import("@vueuse/core"))["refThrottled"]>; + readonly refWithControl: UnwrapRef<(typeof import("@vueuse/core"))["refWithControl"]>; + readonly resolveComponent: UnwrapRef<(typeof import("vue"))["resolveComponent"]>; + readonly resolveRef: UnwrapRef<(typeof import("@vueuse/core"))["resolveRef"]>; + readonly resolveUnref: UnwrapRef<(typeof import("@vueuse/core"))["resolveUnref"]>; + readonly setActivePinia: UnwrapRef<(typeof import("pinia"))["setActivePinia"]>; + readonly setMapStoreSuffix: UnwrapRef<(typeof import("pinia"))["setMapStoreSuffix"]>; + readonly shallowReactive: UnwrapRef<(typeof import("vue"))["shallowReactive"]>; + readonly shallowReadonly: UnwrapRef<(typeof import("vue"))["shallowReadonly"]>; + readonly shallowRef: UnwrapRef<(typeof import("vue"))["shallowRef"]>; + readonly storeToRefs: UnwrapRef<(typeof import("pinia"))["storeToRefs"]>; + readonly syncRef: UnwrapRef<(typeof import("@vueuse/core"))["syncRef"]>; + readonly syncRefs: UnwrapRef<(typeof import("@vueuse/core"))["syncRefs"]>; + readonly templateRef: UnwrapRef<(typeof import("@vueuse/core"))["templateRef"]>; + readonly throttledRef: UnwrapRef<(typeof import("@vueuse/core"))["throttledRef"]>; + readonly throttledWatch: UnwrapRef<(typeof import("@vueuse/core"))["throttledWatch"]>; + readonly toRaw: UnwrapRef<(typeof import("vue"))["toRaw"]>; + readonly toReactive: UnwrapRef<(typeof import("@vueuse/core"))["toReactive"]>; + readonly toRef: UnwrapRef<(typeof import("vue"))["toRef"]>; + readonly toRefs: UnwrapRef<(typeof import("vue"))["toRefs"]>; + readonly toValue: UnwrapRef<(typeof import("vue"))["toValue"]>; + readonly triggerRef: UnwrapRef<(typeof import("vue"))["triggerRef"]>; + readonly tryOnBeforeMount: UnwrapRef<(typeof import("@vueuse/core"))["tryOnBeforeMount"]>; + readonly tryOnBeforeUnmount: UnwrapRef<(typeof import("@vueuse/core"))["tryOnBeforeUnmount"]>; + readonly tryOnMounted: UnwrapRef<(typeof import("@vueuse/core"))["tryOnMounted"]>; + readonly tryOnScopeDispose: UnwrapRef<(typeof import("@vueuse/core"))["tryOnScopeDispose"]>; + readonly tryOnUnmounted: UnwrapRef<(typeof import("@vueuse/core"))["tryOnUnmounted"]>; + readonly unref: UnwrapRef<(typeof import("vue"))["unref"]>; + readonly unrefElement: UnwrapRef<(typeof import("@vueuse/core"))["unrefElement"]>; + readonly until: UnwrapRef<(typeof import("@vueuse/core"))["until"]>; + readonly useActiveElement: UnwrapRef<(typeof import("@vueuse/core"))["useActiveElement"]>; + readonly useAnimate: UnwrapRef<(typeof import("@vueuse/core"))["useAnimate"]>; + readonly useArrayDifference: UnwrapRef<(typeof import("@vueuse/core"))["useArrayDifference"]>; + readonly useArrayEvery: UnwrapRef<(typeof import("@vueuse/core"))["useArrayEvery"]>; + readonly useArrayFilter: UnwrapRef<(typeof import("@vueuse/core"))["useArrayFilter"]>; + readonly useArrayFind: UnwrapRef<(typeof import("@vueuse/core"))["useArrayFind"]>; + readonly useArrayFindIndex: UnwrapRef<(typeof import("@vueuse/core"))["useArrayFindIndex"]>; + readonly useArrayFindLast: UnwrapRef<(typeof import("@vueuse/core"))["useArrayFindLast"]>; + readonly useArrayIncludes: UnwrapRef<(typeof import("@vueuse/core"))["useArrayIncludes"]>; + readonly useArrayJoin: UnwrapRef<(typeof import("@vueuse/core"))["useArrayJoin"]>; + readonly useArrayMap: UnwrapRef<(typeof import("@vueuse/core"))["useArrayMap"]>; + readonly useArrayReduce: UnwrapRef<(typeof import("@vueuse/core"))["useArrayReduce"]>; + readonly useArraySome: UnwrapRef<(typeof import("@vueuse/core"))["useArraySome"]>; + readonly useArrayUnique: UnwrapRef<(typeof import("@vueuse/core"))["useArrayUnique"]>; + readonly useAsyncQueue: UnwrapRef<(typeof import("@vueuse/core"))["useAsyncQueue"]>; + readonly useAsyncState: UnwrapRef<(typeof import("@vueuse/core"))["useAsyncState"]>; + readonly useAttrs: UnwrapRef<(typeof import("vue"))["useAttrs"]>; + readonly useBase64: UnwrapRef<(typeof import("@vueuse/core"))["useBase64"]>; + readonly useBattery: UnwrapRef<(typeof import("@vueuse/core"))["useBattery"]>; + readonly useBluetooth: UnwrapRef<(typeof import("@vueuse/core"))["useBluetooth"]>; + readonly useBreakpoints: UnwrapRef<(typeof import("@vueuse/core"))["useBreakpoints"]>; + readonly useBroadcastChannel: UnwrapRef<(typeof import("@vueuse/core"))["useBroadcastChannel"]>; + readonly useBrowserLocation: UnwrapRef<(typeof import("@vueuse/core"))["useBrowserLocation"]>; + readonly useCached: UnwrapRef<(typeof import("@vueuse/core"))["useCached"]>; + readonly useClipboard: UnwrapRef<(typeof import("@vueuse/core"))["useClipboard"]>; + readonly useClipboardItems: UnwrapRef<(typeof import("@vueuse/core"))["useClipboardItems"]>; + readonly useCloned: UnwrapRef<(typeof import("@vueuse/core"))["useCloned"]>; + readonly useColorMode: UnwrapRef<(typeof import("@vueuse/core"))["useColorMode"]>; + readonly useConfirmDialog: UnwrapRef<(typeof import("@vueuse/core"))["useConfirmDialog"]>; + readonly useCounter: UnwrapRef<(typeof import("@vueuse/core"))["useCounter"]>; + readonly useCssModule: UnwrapRef<(typeof import("vue"))["useCssModule"]>; + readonly useCssVar: UnwrapRef<(typeof import("@vueuse/core"))["useCssVar"]>; + readonly useCssVars: UnwrapRef<(typeof import("vue"))["useCssVars"]>; + readonly useCurrentElement: UnwrapRef<(typeof import("@vueuse/core"))["useCurrentElement"]>; + readonly useCycleList: UnwrapRef<(typeof import("@vueuse/core"))["useCycleList"]>; + readonly useDark: UnwrapRef<(typeof import("@vueuse/core"))["useDark"]>; + readonly useDateFormat: UnwrapRef<(typeof import("@vueuse/core"))["useDateFormat"]>; + readonly useDebounce: UnwrapRef<(typeof import("@vueuse/core"))["useDebounce"]>; + readonly useDebounceFn: UnwrapRef<(typeof import("@vueuse/core"))["useDebounceFn"]>; + readonly useDebouncedRefHistory: UnwrapRef< + (typeof import("@vueuse/core"))["useDebouncedRefHistory"] + >; + readonly useDeviceMotion: UnwrapRef<(typeof import("@vueuse/core"))["useDeviceMotion"]>; + readonly useDeviceOrientation: UnwrapRef< + (typeof import("@vueuse/core"))["useDeviceOrientation"] + >; + readonly useDevicePixelRatio: UnwrapRef<(typeof import("@vueuse/core"))["useDevicePixelRatio"]>; + readonly useDevicesList: UnwrapRef<(typeof import("@vueuse/core"))["useDevicesList"]>; + readonly useDisplayMedia: UnwrapRef<(typeof import("@vueuse/core"))["useDisplayMedia"]>; + readonly useDocumentVisibility: UnwrapRef< + (typeof import("@vueuse/core"))["useDocumentVisibility"] + >; + readonly useDraggable: UnwrapRef<(typeof import("@vueuse/core"))["useDraggable"]>; + readonly useDropZone: UnwrapRef<(typeof import("@vueuse/core"))["useDropZone"]>; + readonly useElementBounding: UnwrapRef<(typeof import("@vueuse/core"))["useElementBounding"]>; + readonly useElementByPoint: UnwrapRef<(typeof import("@vueuse/core"))["useElementByPoint"]>; + readonly useElementHover: UnwrapRef<(typeof import("@vueuse/core"))["useElementHover"]>; + readonly useElementSize: UnwrapRef<(typeof import("@vueuse/core"))["useElementSize"]>; + readonly useElementVisibility: UnwrapRef< + (typeof import("@vueuse/core"))["useElementVisibility"] + >; + readonly useEventBus: UnwrapRef<(typeof import("@vueuse/core"))["useEventBus"]>; + readonly useEventListener: UnwrapRef<(typeof import("@vueuse/core"))["useEventListener"]>; + readonly useEventSource: UnwrapRef<(typeof import("@vueuse/core"))["useEventSource"]>; + readonly useEyeDropper: UnwrapRef<(typeof import("@vueuse/core"))["useEyeDropper"]>; + readonly useFavicon: UnwrapRef<(typeof import("@vueuse/core"))["useFavicon"]>; + readonly useFetch: UnwrapRef<(typeof import("@vueuse/core"))["useFetch"]>; + readonly useFileDialog: UnwrapRef<(typeof import("@vueuse/core"))["useFileDialog"]>; + readonly useFileSystemAccess: UnwrapRef<(typeof import("@vueuse/core"))["useFileSystemAccess"]>; + readonly useFocus: UnwrapRef<(typeof import("@vueuse/core"))["useFocus"]>; + readonly useFocusWithin: UnwrapRef<(typeof import("@vueuse/core"))["useFocusWithin"]>; + readonly useFps: UnwrapRef<(typeof import("@vueuse/core"))["useFps"]>; + readonly useFullscreen: UnwrapRef<(typeof import("@vueuse/core"))["useFullscreen"]>; + readonly useGamepad: UnwrapRef<(typeof import("@vueuse/core"))["useGamepad"]>; + readonly useGeolocation: UnwrapRef<(typeof import("@vueuse/core"))["useGeolocation"]>; + readonly useI18n: UnwrapRef<(typeof import("vue-i18n"))["useI18n"]>; + readonly useIdle: UnwrapRef<(typeof import("@vueuse/core"))["useIdle"]>; + readonly useImage: UnwrapRef<(typeof import("@vueuse/core"))["useImage"]>; + readonly useInfiniteScroll: UnwrapRef<(typeof import("@vueuse/core"))["useInfiniteScroll"]>; + readonly useIntersectionObserver: UnwrapRef< + (typeof import("@vueuse/core"))["useIntersectionObserver"] + >; + readonly useInterval: UnwrapRef<(typeof import("@vueuse/core"))["useInterval"]>; + readonly useIntervalFn: UnwrapRef<(typeof import("@vueuse/core"))["useIntervalFn"]>; + readonly useKeyModifier: UnwrapRef<(typeof import("@vueuse/core"))["useKeyModifier"]>; + readonly useLastChanged: UnwrapRef<(typeof import("@vueuse/core"))["useLastChanged"]>; + readonly useLink: UnwrapRef<(typeof import("vue-router"))["useLink"]>; + readonly useLocalStorage: UnwrapRef<(typeof import("@vueuse/core"))["useLocalStorage"]>; + readonly useMagicKeys: UnwrapRef<(typeof import("@vueuse/core"))["useMagicKeys"]>; + readonly useManualRefHistory: UnwrapRef<(typeof import("@vueuse/core"))["useManualRefHistory"]>; + readonly useMediaControls: UnwrapRef<(typeof import("@vueuse/core"))["useMediaControls"]>; + readonly useMediaQuery: UnwrapRef<(typeof import("@vueuse/core"))["useMediaQuery"]>; + readonly useMemoize: UnwrapRef<(typeof import("@vueuse/core"))["useMemoize"]>; + readonly useMemory: UnwrapRef<(typeof import("@vueuse/core"))["useMemory"]>; + readonly useMounted: UnwrapRef<(typeof import("@vueuse/core"))["useMounted"]>; + readonly useMouse: UnwrapRef<(typeof import("@vueuse/core"))["useMouse"]>; + readonly useMouseInElement: UnwrapRef<(typeof import("@vueuse/core"))["useMouseInElement"]>; + readonly useMousePressed: UnwrapRef<(typeof import("@vueuse/core"))["useMousePressed"]>; + readonly useMutationObserver: UnwrapRef<(typeof import("@vueuse/core"))["useMutationObserver"]>; + readonly useNavigatorLanguage: UnwrapRef< + (typeof import("@vueuse/core"))["useNavigatorLanguage"] + >; + readonly useNetwork: UnwrapRef<(typeof import("@vueuse/core"))["useNetwork"]>; + readonly useNow: UnwrapRef<(typeof import("@vueuse/core"))["useNow"]>; + readonly useObjectUrl: UnwrapRef<(typeof import("@vueuse/core"))["useObjectUrl"]>; + readonly useOffsetPagination: UnwrapRef<(typeof import("@vueuse/core"))["useOffsetPagination"]>; + readonly useOnline: UnwrapRef<(typeof import("@vueuse/core"))["useOnline"]>; + readonly usePageLeave: UnwrapRef<(typeof import("@vueuse/core"))["usePageLeave"]>; + readonly useParallax: UnwrapRef<(typeof import("@vueuse/core"))["useParallax"]>; + readonly useParentElement: UnwrapRef<(typeof import("@vueuse/core"))["useParentElement"]>; + readonly usePerformanceObserver: UnwrapRef< + (typeof import("@vueuse/core"))["usePerformanceObserver"] + >; + readonly usePermission: UnwrapRef<(typeof import("@vueuse/core"))["usePermission"]>; + readonly usePointer: UnwrapRef<(typeof import("@vueuse/core"))["usePointer"]>; + readonly usePointerLock: UnwrapRef<(typeof import("@vueuse/core"))["usePointerLock"]>; + readonly usePointerSwipe: UnwrapRef<(typeof import("@vueuse/core"))["usePointerSwipe"]>; + readonly usePreferredColorScheme: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredColorScheme"] + >; + readonly usePreferredContrast: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredContrast"] + >; + readonly usePreferredDark: UnwrapRef<(typeof import("@vueuse/core"))["usePreferredDark"]>; + readonly usePreferredLanguages: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredLanguages"] + >; + readonly usePreferredReducedMotion: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredReducedMotion"] + >; + readonly usePrevious: UnwrapRef<(typeof import("@vueuse/core"))["usePrevious"]>; + readonly useRafFn: UnwrapRef<(typeof import("@vueuse/core"))["useRafFn"]>; + readonly useRefHistory: UnwrapRef<(typeof import("@vueuse/core"))["useRefHistory"]>; + readonly useResizeObserver: UnwrapRef<(typeof import("@vueuse/core"))["useResizeObserver"]>; + readonly useRoute: UnwrapRef<(typeof import("vue-router"))["useRoute"]>; + readonly useRouter: UnwrapRef<(typeof import("vue-router"))["useRouter"]>; + readonly useScreenOrientation: UnwrapRef< + (typeof import("@vueuse/core"))["useScreenOrientation"] + >; + readonly useScreenSafeArea: UnwrapRef<(typeof import("@vueuse/core"))["useScreenSafeArea"]>; + readonly useScriptTag: UnwrapRef<(typeof import("@vueuse/core"))["useScriptTag"]>; + readonly useScroll: UnwrapRef<(typeof import("@vueuse/core"))["useScroll"]>; + readonly useScrollLock: UnwrapRef<(typeof import("@vueuse/core"))["useScrollLock"]>; + readonly useSessionStorage: UnwrapRef<(typeof import("@vueuse/core"))["useSessionStorage"]>; + readonly useShare: UnwrapRef<(typeof import("@vueuse/core"))["useShare"]>; + readonly useSlots: UnwrapRef<(typeof import("vue"))["useSlots"]>; + readonly useSorted: UnwrapRef<(typeof import("@vueuse/core"))["useSorted"]>; + readonly useSpeechRecognition: UnwrapRef< + (typeof import("@vueuse/core"))["useSpeechRecognition"] + >; + readonly useSpeechSynthesis: UnwrapRef<(typeof import("@vueuse/core"))["useSpeechSynthesis"]>; + readonly useStepper: UnwrapRef<(typeof import("@vueuse/core"))["useStepper"]>; + readonly useStorage: UnwrapRef<(typeof import("@vueuse/core"))["useStorage"]>; + readonly useStorageAsync: UnwrapRef<(typeof import("@vueuse/core"))["useStorageAsync"]>; + readonly useStyleTag: UnwrapRef<(typeof import("@vueuse/core"))["useStyleTag"]>; + readonly useSupported: UnwrapRef<(typeof import("@vueuse/core"))["useSupported"]>; + readonly useSwipe: UnwrapRef<(typeof import("@vueuse/core"))["useSwipe"]>; + readonly useTemplateRefsList: UnwrapRef<(typeof import("@vueuse/core"))["useTemplateRefsList"]>; + readonly useTextDirection: UnwrapRef<(typeof import("@vueuse/core"))["useTextDirection"]>; + readonly useTextSelection: UnwrapRef<(typeof import("@vueuse/core"))["useTextSelection"]>; + readonly useTextareaAutosize: UnwrapRef<(typeof import("@vueuse/core"))["useTextareaAutosize"]>; + readonly useThrottle: UnwrapRef<(typeof import("@vueuse/core"))["useThrottle"]>; + readonly useThrottleFn: UnwrapRef<(typeof import("@vueuse/core"))["useThrottleFn"]>; + readonly useThrottledRefHistory: UnwrapRef< + (typeof import("@vueuse/core"))["useThrottledRefHistory"] + >; + readonly useTimeAgo: UnwrapRef<(typeof import("@vueuse/core"))["useTimeAgo"]>; + readonly useTimeout: UnwrapRef<(typeof import("@vueuse/core"))["useTimeout"]>; + readonly useTimeoutFn: UnwrapRef<(typeof import("@vueuse/core"))["useTimeoutFn"]>; + readonly useTimeoutPoll: UnwrapRef<(typeof import("@vueuse/core"))["useTimeoutPoll"]>; + readonly useTimestamp: UnwrapRef<(typeof import("@vueuse/core"))["useTimestamp"]>; + readonly useTitle: UnwrapRef<(typeof import("@vueuse/core"))["useTitle"]>; + readonly useToNumber: UnwrapRef<(typeof import("@vueuse/core"))["useToNumber"]>; + readonly useToString: UnwrapRef<(typeof import("@vueuse/core"))["useToString"]>; + readonly useToggle: UnwrapRef<(typeof import("@vueuse/core"))["useToggle"]>; + readonly useTransition: UnwrapRef<(typeof import("@vueuse/core"))["useTransition"]>; + readonly useUrlSearchParams: UnwrapRef<(typeof import("@vueuse/core"))["useUrlSearchParams"]>; + readonly useUserMedia: UnwrapRef<(typeof import("@vueuse/core"))["useUserMedia"]>; + readonly useVModel: UnwrapRef<(typeof import("@vueuse/core"))["useVModel"]>; + readonly useVModels: UnwrapRef<(typeof import("@vueuse/core"))["useVModels"]>; + readonly useVibrate: UnwrapRef<(typeof import("@vueuse/core"))["useVibrate"]>; + readonly useVirtualList: UnwrapRef<(typeof import("@vueuse/core"))["useVirtualList"]>; + readonly useWakeLock: UnwrapRef<(typeof import("@vueuse/core"))["useWakeLock"]>; + readonly useWebNotification: UnwrapRef<(typeof import("@vueuse/core"))["useWebNotification"]>; + readonly useWebSocket: UnwrapRef<(typeof import("@vueuse/core"))["useWebSocket"]>; + readonly useWebWorker: UnwrapRef<(typeof import("@vueuse/core"))["useWebWorker"]>; + readonly useWebWorkerFn: UnwrapRef<(typeof import("@vueuse/core"))["useWebWorkerFn"]>; + readonly useWindowFocus: UnwrapRef<(typeof import("@vueuse/core"))["useWindowFocus"]>; + readonly useWindowScroll: UnwrapRef<(typeof import("@vueuse/core"))["useWindowScroll"]>; + readonly useWindowSize: UnwrapRef<(typeof import("@vueuse/core"))["useWindowSize"]>; + readonly watch: UnwrapRef<(typeof import("vue"))["watch"]>; + readonly watchArray: UnwrapRef<(typeof import("@vueuse/core"))["watchArray"]>; + readonly watchAtMost: UnwrapRef<(typeof import("@vueuse/core"))["watchAtMost"]>; + readonly watchDebounced: UnwrapRef<(typeof import("@vueuse/core"))["watchDebounced"]>; + readonly watchDeep: UnwrapRef<(typeof import("@vueuse/core"))["watchDeep"]>; + readonly watchEffect: UnwrapRef<(typeof import("vue"))["watchEffect"]>; + readonly watchIgnorable: UnwrapRef<(typeof import("@vueuse/core"))["watchIgnorable"]>; + readonly watchImmediate: UnwrapRef<(typeof import("@vueuse/core"))["watchImmediate"]>; + readonly watchOnce: UnwrapRef<(typeof import("@vueuse/core"))["watchOnce"]>; + readonly watchPausable: UnwrapRef<(typeof import("@vueuse/core"))["watchPausable"]>; + readonly watchPostEffect: UnwrapRef<(typeof import("vue"))["watchPostEffect"]>; + readonly watchSyncEffect: UnwrapRef<(typeof import("vue"))["watchSyncEffect"]>; + readonly watchThrottled: UnwrapRef<(typeof import("@vueuse/core"))["watchThrottled"]>; + readonly watchTriggerable: UnwrapRef<(typeof import("@vueuse/core"))["watchTriggerable"]>; + readonly watchWithFilter: UnwrapRef<(typeof import("@vueuse/core"))["watchWithFilter"]>; + readonly whenever: UnwrapRef<(typeof import("@vueuse/core"))["whenever"]>; + } +} +declare module "@vue/runtime-core" { + interface GlobalComponents {} + interface ComponentCustomProperties { + readonly EffectScope: UnwrapRef<(typeof import("vue"))["EffectScope"]>; + readonly ElMessage: UnwrapRef<(typeof import("element-plus/es"))["ElMessage"]>; + readonly ElMessageBox: UnwrapRef<(typeof import("element-plus/es"))["ElMessageBox"]>; + readonly acceptHMRUpdate: UnwrapRef<(typeof import("pinia"))["acceptHMRUpdate"]>; + readonly asyncComputed: UnwrapRef<(typeof import("@vueuse/core"))["asyncComputed"]>; + readonly autoResetRef: UnwrapRef<(typeof import("@vueuse/core"))["autoResetRef"]>; + readonly computed: UnwrapRef<(typeof import("vue"))["computed"]>; + readonly computedAsync: UnwrapRef<(typeof import("@vueuse/core"))["computedAsync"]>; + readonly computedEager: UnwrapRef<(typeof import("@vueuse/core"))["computedEager"]>; + readonly computedInject: UnwrapRef<(typeof import("@vueuse/core"))["computedInject"]>; + readonly computedWithControl: UnwrapRef<(typeof import("@vueuse/core"))["computedWithControl"]>; + readonly controlledComputed: UnwrapRef<(typeof import("@vueuse/core"))["controlledComputed"]>; + readonly controlledRef: UnwrapRef<(typeof import("@vueuse/core"))["controlledRef"]>; + readonly createApp: UnwrapRef<(typeof import("vue"))["createApp"]>; + readonly createEventHook: UnwrapRef<(typeof import("@vueuse/core"))["createEventHook"]>; + readonly createGlobalState: UnwrapRef<(typeof import("@vueuse/core"))["createGlobalState"]>; + readonly createInjectionState: UnwrapRef< + (typeof import("@vueuse/core"))["createInjectionState"] + >; + readonly createPinia: UnwrapRef<(typeof import("pinia"))["createPinia"]>; + readonly createReactiveFn: UnwrapRef<(typeof import("@vueuse/core"))["createReactiveFn"]>; + readonly createReusableTemplate: UnwrapRef< + (typeof import("@vueuse/core"))["createReusableTemplate"] + >; + readonly createSharedComposable: UnwrapRef< + (typeof import("@vueuse/core"))["createSharedComposable"] + >; + readonly createTemplatePromise: UnwrapRef< + (typeof import("@vueuse/core"))["createTemplatePromise"] + >; + readonly createUnrefFn: UnwrapRef<(typeof import("@vueuse/core"))["createUnrefFn"]>; + readonly customRef: UnwrapRef<(typeof import("vue"))["customRef"]>; + readonly debouncedRef: UnwrapRef<(typeof import("@vueuse/core"))["debouncedRef"]>; + readonly debouncedWatch: UnwrapRef<(typeof import("@vueuse/core"))["debouncedWatch"]>; + readonly defineAsyncComponent: UnwrapRef<(typeof import("vue"))["defineAsyncComponent"]>; + readonly defineComponent: UnwrapRef<(typeof import("vue"))["defineComponent"]>; + readonly defineStore: UnwrapRef<(typeof import("pinia"))["defineStore"]>; + readonly eagerComputed: UnwrapRef<(typeof import("@vueuse/core"))["eagerComputed"]>; + readonly effectScope: UnwrapRef<(typeof import("vue"))["effectScope"]>; + readonly extendRef: UnwrapRef<(typeof import("@vueuse/core"))["extendRef"]>; + readonly getActivePinia: UnwrapRef<(typeof import("pinia"))["getActivePinia"]>; + readonly getCurrentInstance: UnwrapRef<(typeof import("vue"))["getCurrentInstance"]>; + readonly getCurrentScope: UnwrapRef<(typeof import("vue"))["getCurrentScope"]>; + readonly h: UnwrapRef<(typeof import("vue"))["h"]>; + readonly ignorableWatch: UnwrapRef<(typeof import("@vueuse/core"))["ignorableWatch"]>; + readonly inject: UnwrapRef<(typeof import("vue"))["inject"]>; + readonly injectLocal: UnwrapRef<(typeof import("@vueuse/core"))["injectLocal"]>; + readonly isDefined: UnwrapRef<(typeof import("@vueuse/core"))["isDefined"]>; + readonly isProxy: UnwrapRef<(typeof import("vue"))["isProxy"]>; + readonly isReactive: UnwrapRef<(typeof import("vue"))["isReactive"]>; + readonly isReadonly: UnwrapRef<(typeof import("vue"))["isReadonly"]>; + readonly isRef: UnwrapRef<(typeof import("vue"))["isRef"]>; + readonly makeDestructurable: UnwrapRef<(typeof import("@vueuse/core"))["makeDestructurable"]>; + readonly mapActions: UnwrapRef<(typeof import("pinia"))["mapActions"]>; + readonly mapGetters: UnwrapRef<(typeof import("pinia"))["mapGetters"]>; + readonly mapState: UnwrapRef<(typeof import("pinia"))["mapState"]>; + readonly mapStores: UnwrapRef<(typeof import("pinia"))["mapStores"]>; + readonly mapWritableState: UnwrapRef<(typeof import("pinia"))["mapWritableState"]>; + readonly markRaw: UnwrapRef<(typeof import("vue"))["markRaw"]>; + readonly nextTick: UnwrapRef<(typeof import("vue"))["nextTick"]>; + readonly onActivated: UnwrapRef<(typeof import("vue"))["onActivated"]>; + readonly onBeforeMount: UnwrapRef<(typeof import("vue"))["onBeforeMount"]>; + readonly onBeforeRouteLeave: UnwrapRef<(typeof import("vue-router"))["onBeforeRouteLeave"]>; + readonly onBeforeRouteUpdate: UnwrapRef<(typeof import("vue-router"))["onBeforeRouteUpdate"]>; + readonly onBeforeUnmount: UnwrapRef<(typeof import("vue"))["onBeforeUnmount"]>; + readonly onBeforeUpdate: UnwrapRef<(typeof import("vue"))["onBeforeUpdate"]>; + readonly onClickOutside: UnwrapRef<(typeof import("@vueuse/core"))["onClickOutside"]>; + readonly onDeactivated: UnwrapRef<(typeof import("vue"))["onDeactivated"]>; + readonly onErrorCaptured: UnwrapRef<(typeof import("vue"))["onErrorCaptured"]>; + readonly onKeyStroke: UnwrapRef<(typeof import("@vueuse/core"))["onKeyStroke"]>; + readonly onLongPress: UnwrapRef<(typeof import("@vueuse/core"))["onLongPress"]>; + readonly onMounted: UnwrapRef<(typeof import("vue"))["onMounted"]>; + readonly onRenderTracked: UnwrapRef<(typeof import("vue"))["onRenderTracked"]>; + readonly onRenderTriggered: UnwrapRef<(typeof import("vue"))["onRenderTriggered"]>; + readonly onScopeDispose: UnwrapRef<(typeof import("vue"))["onScopeDispose"]>; + readonly onServerPrefetch: UnwrapRef<(typeof import("vue"))["onServerPrefetch"]>; + readonly onStartTyping: UnwrapRef<(typeof import("@vueuse/core"))["onStartTyping"]>; + readonly onUnmounted: UnwrapRef<(typeof import("vue"))["onUnmounted"]>; + readonly onUpdated: UnwrapRef<(typeof import("vue"))["onUpdated"]>; + readonly pausableWatch: UnwrapRef<(typeof import("@vueuse/core"))["pausableWatch"]>; + readonly provide: UnwrapRef<(typeof import("vue"))["provide"]>; + readonly provideLocal: UnwrapRef<(typeof import("@vueuse/core"))["provideLocal"]>; + readonly reactify: UnwrapRef<(typeof import("@vueuse/core"))["reactify"]>; + readonly reactifyObject: UnwrapRef<(typeof import("@vueuse/core"))["reactifyObject"]>; + readonly reactive: UnwrapRef<(typeof import("vue"))["reactive"]>; + readonly reactiveComputed: UnwrapRef<(typeof import("@vueuse/core"))["reactiveComputed"]>; + readonly reactiveOmit: UnwrapRef<(typeof import("@vueuse/core"))["reactiveOmit"]>; + readonly reactivePick: UnwrapRef<(typeof import("@vueuse/core"))["reactivePick"]>; + readonly readonly: UnwrapRef<(typeof import("vue"))["readonly"]>; + readonly ref: UnwrapRef<(typeof import("vue"))["ref"]>; + readonly refAutoReset: UnwrapRef<(typeof import("@vueuse/core"))["refAutoReset"]>; + readonly refDebounced: UnwrapRef<(typeof import("@vueuse/core"))["refDebounced"]>; + readonly refDefault: UnwrapRef<(typeof import("@vueuse/core"))["refDefault"]>; + readonly refThrottled: UnwrapRef<(typeof import("@vueuse/core"))["refThrottled"]>; + readonly refWithControl: UnwrapRef<(typeof import("@vueuse/core"))["refWithControl"]>; + readonly resolveComponent: UnwrapRef<(typeof import("vue"))["resolveComponent"]>; + readonly resolveRef: UnwrapRef<(typeof import("@vueuse/core"))["resolveRef"]>; + readonly resolveUnref: UnwrapRef<(typeof import("@vueuse/core"))["resolveUnref"]>; + readonly setActivePinia: UnwrapRef<(typeof import("pinia"))["setActivePinia"]>; + readonly setMapStoreSuffix: UnwrapRef<(typeof import("pinia"))["setMapStoreSuffix"]>; + readonly shallowReactive: UnwrapRef<(typeof import("vue"))["shallowReactive"]>; + readonly shallowReadonly: UnwrapRef<(typeof import("vue"))["shallowReadonly"]>; + readonly shallowRef: UnwrapRef<(typeof import("vue"))["shallowRef"]>; + readonly storeToRefs: UnwrapRef<(typeof import("pinia"))["storeToRefs"]>; + readonly syncRef: UnwrapRef<(typeof import("@vueuse/core"))["syncRef"]>; + readonly syncRefs: UnwrapRef<(typeof import("@vueuse/core"))["syncRefs"]>; + readonly templateRef: UnwrapRef<(typeof import("@vueuse/core"))["templateRef"]>; + readonly throttledRef: UnwrapRef<(typeof import("@vueuse/core"))["throttledRef"]>; + readonly throttledWatch: UnwrapRef<(typeof import("@vueuse/core"))["throttledWatch"]>; + readonly toRaw: UnwrapRef<(typeof import("vue"))["toRaw"]>; + readonly toReactive: UnwrapRef<(typeof import("@vueuse/core"))["toReactive"]>; + readonly toRef: UnwrapRef<(typeof import("vue"))["toRef"]>; + readonly toRefs: UnwrapRef<(typeof import("vue"))["toRefs"]>; + readonly toValue: UnwrapRef<(typeof import("vue"))["toValue"]>; + readonly triggerRef: UnwrapRef<(typeof import("vue"))["triggerRef"]>; + readonly tryOnBeforeMount: UnwrapRef<(typeof import("@vueuse/core"))["tryOnBeforeMount"]>; + readonly tryOnBeforeUnmount: UnwrapRef<(typeof import("@vueuse/core"))["tryOnBeforeUnmount"]>; + readonly tryOnMounted: UnwrapRef<(typeof import("@vueuse/core"))["tryOnMounted"]>; + readonly tryOnScopeDispose: UnwrapRef<(typeof import("@vueuse/core"))["tryOnScopeDispose"]>; + readonly tryOnUnmounted: UnwrapRef<(typeof import("@vueuse/core"))["tryOnUnmounted"]>; + readonly unref: UnwrapRef<(typeof import("vue"))["unref"]>; + readonly unrefElement: UnwrapRef<(typeof import("@vueuse/core"))["unrefElement"]>; + readonly until: UnwrapRef<(typeof import("@vueuse/core"))["until"]>; + readonly useActiveElement: UnwrapRef<(typeof import("@vueuse/core"))["useActiveElement"]>; + readonly useAnimate: UnwrapRef<(typeof import("@vueuse/core"))["useAnimate"]>; + readonly useArrayDifference: UnwrapRef<(typeof import("@vueuse/core"))["useArrayDifference"]>; + readonly useArrayEvery: UnwrapRef<(typeof import("@vueuse/core"))["useArrayEvery"]>; + readonly useArrayFilter: UnwrapRef<(typeof import("@vueuse/core"))["useArrayFilter"]>; + readonly useArrayFind: UnwrapRef<(typeof import("@vueuse/core"))["useArrayFind"]>; + readonly useArrayFindIndex: UnwrapRef<(typeof import("@vueuse/core"))["useArrayFindIndex"]>; + readonly useArrayFindLast: UnwrapRef<(typeof import("@vueuse/core"))["useArrayFindLast"]>; + readonly useArrayIncludes: UnwrapRef<(typeof import("@vueuse/core"))["useArrayIncludes"]>; + readonly useArrayJoin: UnwrapRef<(typeof import("@vueuse/core"))["useArrayJoin"]>; + readonly useArrayMap: UnwrapRef<(typeof import("@vueuse/core"))["useArrayMap"]>; + readonly useArrayReduce: UnwrapRef<(typeof import("@vueuse/core"))["useArrayReduce"]>; + readonly useArraySome: UnwrapRef<(typeof import("@vueuse/core"))["useArraySome"]>; + readonly useArrayUnique: UnwrapRef<(typeof import("@vueuse/core"))["useArrayUnique"]>; + readonly useAsyncQueue: UnwrapRef<(typeof import("@vueuse/core"))["useAsyncQueue"]>; + readonly useAsyncState: UnwrapRef<(typeof import("@vueuse/core"))["useAsyncState"]>; + readonly useAttrs: UnwrapRef<(typeof import("vue"))["useAttrs"]>; + readonly useBase64: UnwrapRef<(typeof import("@vueuse/core"))["useBase64"]>; + readonly useBattery: UnwrapRef<(typeof import("@vueuse/core"))["useBattery"]>; + readonly useBluetooth: UnwrapRef<(typeof import("@vueuse/core"))["useBluetooth"]>; + readonly useBreakpoints: UnwrapRef<(typeof import("@vueuse/core"))["useBreakpoints"]>; + readonly useBroadcastChannel: UnwrapRef<(typeof import("@vueuse/core"))["useBroadcastChannel"]>; + readonly useBrowserLocation: UnwrapRef<(typeof import("@vueuse/core"))["useBrowserLocation"]>; + readonly useCached: UnwrapRef<(typeof import("@vueuse/core"))["useCached"]>; + readonly useClipboard: UnwrapRef<(typeof import("@vueuse/core"))["useClipboard"]>; + readonly useClipboardItems: UnwrapRef<(typeof import("@vueuse/core"))["useClipboardItems"]>; + readonly useCloned: UnwrapRef<(typeof import("@vueuse/core"))["useCloned"]>; + readonly useColorMode: UnwrapRef<(typeof import("@vueuse/core"))["useColorMode"]>; + readonly useConfirmDialog: UnwrapRef<(typeof import("@vueuse/core"))["useConfirmDialog"]>; + readonly useCounter: UnwrapRef<(typeof import("@vueuse/core"))["useCounter"]>; + readonly useCssModule: UnwrapRef<(typeof import("vue"))["useCssModule"]>; + readonly useCssVar: UnwrapRef<(typeof import("@vueuse/core"))["useCssVar"]>; + readonly useCssVars: UnwrapRef<(typeof import("vue"))["useCssVars"]>; + readonly useCurrentElement: UnwrapRef<(typeof import("@vueuse/core"))["useCurrentElement"]>; + readonly useCycleList: UnwrapRef<(typeof import("@vueuse/core"))["useCycleList"]>; + readonly useDark: UnwrapRef<(typeof import("@vueuse/core"))["useDark"]>; + readonly useDateFormat: UnwrapRef<(typeof import("@vueuse/core"))["useDateFormat"]>; + readonly useDebounce: UnwrapRef<(typeof import("@vueuse/core"))["useDebounce"]>; + readonly useDebounceFn: UnwrapRef<(typeof import("@vueuse/core"))["useDebounceFn"]>; + readonly useDebouncedRefHistory: UnwrapRef< + (typeof import("@vueuse/core"))["useDebouncedRefHistory"] + >; + readonly useDeviceMotion: UnwrapRef<(typeof import("@vueuse/core"))["useDeviceMotion"]>; + readonly useDeviceOrientation: UnwrapRef< + (typeof import("@vueuse/core"))["useDeviceOrientation"] + >; + readonly useDevicePixelRatio: UnwrapRef<(typeof import("@vueuse/core"))["useDevicePixelRatio"]>; + readonly useDevicesList: UnwrapRef<(typeof import("@vueuse/core"))["useDevicesList"]>; + readonly useDisplayMedia: UnwrapRef<(typeof import("@vueuse/core"))["useDisplayMedia"]>; + readonly useDocumentVisibility: UnwrapRef< + (typeof import("@vueuse/core"))["useDocumentVisibility"] + >; + readonly useDraggable: UnwrapRef<(typeof import("@vueuse/core"))["useDraggable"]>; + readonly useDropZone: UnwrapRef<(typeof import("@vueuse/core"))["useDropZone"]>; + readonly useElementBounding: UnwrapRef<(typeof import("@vueuse/core"))["useElementBounding"]>; + readonly useElementByPoint: UnwrapRef<(typeof import("@vueuse/core"))["useElementByPoint"]>; + readonly useElementHover: UnwrapRef<(typeof import("@vueuse/core"))["useElementHover"]>; + readonly useElementSize: UnwrapRef<(typeof import("@vueuse/core"))["useElementSize"]>; + readonly useElementVisibility: UnwrapRef< + (typeof import("@vueuse/core"))["useElementVisibility"] + >; + readonly useEventBus: UnwrapRef<(typeof import("@vueuse/core"))["useEventBus"]>; + readonly useEventListener: UnwrapRef<(typeof import("@vueuse/core"))["useEventListener"]>; + readonly useEventSource: UnwrapRef<(typeof import("@vueuse/core"))["useEventSource"]>; + readonly useEyeDropper: UnwrapRef<(typeof import("@vueuse/core"))["useEyeDropper"]>; + readonly useFavicon: UnwrapRef<(typeof import("@vueuse/core"))["useFavicon"]>; + readonly useFetch: UnwrapRef<(typeof import("@vueuse/core"))["useFetch"]>; + readonly useFileDialog: UnwrapRef<(typeof import("@vueuse/core"))["useFileDialog"]>; + readonly useFileSystemAccess: UnwrapRef<(typeof import("@vueuse/core"))["useFileSystemAccess"]>; + readonly useFocus: UnwrapRef<(typeof import("@vueuse/core"))["useFocus"]>; + readonly useFocusWithin: UnwrapRef<(typeof import("@vueuse/core"))["useFocusWithin"]>; + readonly useFps: UnwrapRef<(typeof import("@vueuse/core"))["useFps"]>; + readonly useFullscreen: UnwrapRef<(typeof import("@vueuse/core"))["useFullscreen"]>; + readonly useGamepad: UnwrapRef<(typeof import("@vueuse/core"))["useGamepad"]>; + readonly useGeolocation: UnwrapRef<(typeof import("@vueuse/core"))["useGeolocation"]>; + readonly useI18n: UnwrapRef<(typeof import("vue-i18n"))["useI18n"]>; + readonly useIdle: UnwrapRef<(typeof import("@vueuse/core"))["useIdle"]>; + readonly useImage: UnwrapRef<(typeof import("@vueuse/core"))["useImage"]>; + readonly useInfiniteScroll: UnwrapRef<(typeof import("@vueuse/core"))["useInfiniteScroll"]>; + readonly useIntersectionObserver: UnwrapRef< + (typeof import("@vueuse/core"))["useIntersectionObserver"] + >; + readonly useInterval: UnwrapRef<(typeof import("@vueuse/core"))["useInterval"]>; + readonly useIntervalFn: UnwrapRef<(typeof import("@vueuse/core"))["useIntervalFn"]>; + readonly useKeyModifier: UnwrapRef<(typeof import("@vueuse/core"))["useKeyModifier"]>; + readonly useLastChanged: UnwrapRef<(typeof import("@vueuse/core"))["useLastChanged"]>; + readonly useLink: UnwrapRef<(typeof import("vue-router"))["useLink"]>; + readonly useLocalStorage: UnwrapRef<(typeof import("@vueuse/core"))["useLocalStorage"]>; + readonly useMagicKeys: UnwrapRef<(typeof import("@vueuse/core"))["useMagicKeys"]>; + readonly useManualRefHistory: UnwrapRef<(typeof import("@vueuse/core"))["useManualRefHistory"]>; + readonly useMediaControls: UnwrapRef<(typeof import("@vueuse/core"))["useMediaControls"]>; + readonly useMediaQuery: UnwrapRef<(typeof import("@vueuse/core"))["useMediaQuery"]>; + readonly useMemoize: UnwrapRef<(typeof import("@vueuse/core"))["useMemoize"]>; + readonly useMemory: UnwrapRef<(typeof import("@vueuse/core"))["useMemory"]>; + readonly useMounted: UnwrapRef<(typeof import("@vueuse/core"))["useMounted"]>; + readonly useMouse: UnwrapRef<(typeof import("@vueuse/core"))["useMouse"]>; + readonly useMouseInElement: UnwrapRef<(typeof import("@vueuse/core"))["useMouseInElement"]>; + readonly useMousePressed: UnwrapRef<(typeof import("@vueuse/core"))["useMousePressed"]>; + readonly useMutationObserver: UnwrapRef<(typeof import("@vueuse/core"))["useMutationObserver"]>; + readonly useNavigatorLanguage: UnwrapRef< + (typeof import("@vueuse/core"))["useNavigatorLanguage"] + >; + readonly useNetwork: UnwrapRef<(typeof import("@vueuse/core"))["useNetwork"]>; + readonly useNow: UnwrapRef<(typeof import("@vueuse/core"))["useNow"]>; + readonly useObjectUrl: UnwrapRef<(typeof import("@vueuse/core"))["useObjectUrl"]>; + readonly useOffsetPagination: UnwrapRef<(typeof import("@vueuse/core"))["useOffsetPagination"]>; + readonly useOnline: UnwrapRef<(typeof import("@vueuse/core"))["useOnline"]>; + readonly usePageLeave: UnwrapRef<(typeof import("@vueuse/core"))["usePageLeave"]>; + readonly useParallax: UnwrapRef<(typeof import("@vueuse/core"))["useParallax"]>; + readonly useParentElement: UnwrapRef<(typeof import("@vueuse/core"))["useParentElement"]>; + readonly usePerformanceObserver: UnwrapRef< + (typeof import("@vueuse/core"))["usePerformanceObserver"] + >; + readonly usePermission: UnwrapRef<(typeof import("@vueuse/core"))["usePermission"]>; + readonly usePointer: UnwrapRef<(typeof import("@vueuse/core"))["usePointer"]>; + readonly usePointerLock: UnwrapRef<(typeof import("@vueuse/core"))["usePointerLock"]>; + readonly usePointerSwipe: UnwrapRef<(typeof import("@vueuse/core"))["usePointerSwipe"]>; + readonly usePreferredColorScheme: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredColorScheme"] + >; + readonly usePreferredContrast: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredContrast"] + >; + readonly usePreferredDark: UnwrapRef<(typeof import("@vueuse/core"))["usePreferredDark"]>; + readonly usePreferredLanguages: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredLanguages"] + >; + readonly usePreferredReducedMotion: UnwrapRef< + (typeof import("@vueuse/core"))["usePreferredReducedMotion"] + >; + readonly usePrevious: UnwrapRef<(typeof import("@vueuse/core"))["usePrevious"]>; + readonly useRafFn: UnwrapRef<(typeof import("@vueuse/core"))["useRafFn"]>; + readonly useRefHistory: UnwrapRef<(typeof import("@vueuse/core"))["useRefHistory"]>; + readonly useResizeObserver: UnwrapRef<(typeof import("@vueuse/core"))["useResizeObserver"]>; + readonly useRoute: UnwrapRef<(typeof import("vue-router"))["useRoute"]>; + readonly useRouter: UnwrapRef<(typeof import("vue-router"))["useRouter"]>; + readonly useScreenOrientation: UnwrapRef< + (typeof import("@vueuse/core"))["useScreenOrientation"] + >; + readonly useScreenSafeArea: UnwrapRef<(typeof import("@vueuse/core"))["useScreenSafeArea"]>; + readonly useScriptTag: UnwrapRef<(typeof import("@vueuse/core"))["useScriptTag"]>; + readonly useScroll: UnwrapRef<(typeof import("@vueuse/core"))["useScroll"]>; + readonly useScrollLock: UnwrapRef<(typeof import("@vueuse/core"))["useScrollLock"]>; + readonly useSessionStorage: UnwrapRef<(typeof import("@vueuse/core"))["useSessionStorage"]>; + readonly useShare: UnwrapRef<(typeof import("@vueuse/core"))["useShare"]>; + readonly useSlots: UnwrapRef<(typeof import("vue"))["useSlots"]>; + readonly useSorted: UnwrapRef<(typeof import("@vueuse/core"))["useSorted"]>; + readonly useSpeechRecognition: UnwrapRef< + (typeof import("@vueuse/core"))["useSpeechRecognition"] + >; + readonly useSpeechSynthesis: UnwrapRef<(typeof import("@vueuse/core"))["useSpeechSynthesis"]>; + readonly useStepper: UnwrapRef<(typeof import("@vueuse/core"))["useStepper"]>; + readonly useStorage: UnwrapRef<(typeof import("@vueuse/core"))["useStorage"]>; + readonly useStorageAsync: UnwrapRef<(typeof import("@vueuse/core"))["useStorageAsync"]>; + readonly useStyleTag: UnwrapRef<(typeof import("@vueuse/core"))["useStyleTag"]>; + readonly useSupported: UnwrapRef<(typeof import("@vueuse/core"))["useSupported"]>; + readonly useSwipe: UnwrapRef<(typeof import("@vueuse/core"))["useSwipe"]>; + readonly useTemplateRefsList: UnwrapRef<(typeof import("@vueuse/core"))["useTemplateRefsList"]>; + readonly useTextDirection: UnwrapRef<(typeof import("@vueuse/core"))["useTextDirection"]>; + readonly useTextSelection: UnwrapRef<(typeof import("@vueuse/core"))["useTextSelection"]>; + readonly useTextareaAutosize: UnwrapRef<(typeof import("@vueuse/core"))["useTextareaAutosize"]>; + readonly useThrottle: UnwrapRef<(typeof import("@vueuse/core"))["useThrottle"]>; + readonly useThrottleFn: UnwrapRef<(typeof import("@vueuse/core"))["useThrottleFn"]>; + readonly useThrottledRefHistory: UnwrapRef< + (typeof import("@vueuse/core"))["useThrottledRefHistory"] + >; + readonly useTimeAgo: UnwrapRef<(typeof import("@vueuse/core"))["useTimeAgo"]>; + readonly useTimeout: UnwrapRef<(typeof import("@vueuse/core"))["useTimeout"]>; + readonly useTimeoutFn: UnwrapRef<(typeof import("@vueuse/core"))["useTimeoutFn"]>; + readonly useTimeoutPoll: UnwrapRef<(typeof import("@vueuse/core"))["useTimeoutPoll"]>; + readonly useTimestamp: UnwrapRef<(typeof import("@vueuse/core"))["useTimestamp"]>; + readonly useTitle: UnwrapRef<(typeof import("@vueuse/core"))["useTitle"]>; + readonly useToNumber: UnwrapRef<(typeof import("@vueuse/core"))["useToNumber"]>; + readonly useToString: UnwrapRef<(typeof import("@vueuse/core"))["useToString"]>; + readonly useToggle: UnwrapRef<(typeof import("@vueuse/core"))["useToggle"]>; + readonly useTransition: UnwrapRef<(typeof import("@vueuse/core"))["useTransition"]>; + readonly useUrlSearchParams: UnwrapRef<(typeof import("@vueuse/core"))["useUrlSearchParams"]>; + readonly useUserMedia: UnwrapRef<(typeof import("@vueuse/core"))["useUserMedia"]>; + readonly useVModel: UnwrapRef<(typeof import("@vueuse/core"))["useVModel"]>; + readonly useVModels: UnwrapRef<(typeof import("@vueuse/core"))["useVModels"]>; + readonly useVibrate: UnwrapRef<(typeof import("@vueuse/core"))["useVibrate"]>; + readonly useVirtualList: UnwrapRef<(typeof import("@vueuse/core"))["useVirtualList"]>; + readonly useWakeLock: UnwrapRef<(typeof import("@vueuse/core"))["useWakeLock"]>; + readonly useWebNotification: UnwrapRef<(typeof import("@vueuse/core"))["useWebNotification"]>; + readonly useWebSocket: UnwrapRef<(typeof import("@vueuse/core"))["useWebSocket"]>; + readonly useWebWorker: UnwrapRef<(typeof import("@vueuse/core"))["useWebWorker"]>; + readonly useWebWorkerFn: UnwrapRef<(typeof import("@vueuse/core"))["useWebWorkerFn"]>; + readonly useWindowFocus: UnwrapRef<(typeof import("@vueuse/core"))["useWindowFocus"]>; + readonly useWindowScroll: UnwrapRef<(typeof import("@vueuse/core"))["useWindowScroll"]>; + readonly useWindowSize: UnwrapRef<(typeof import("@vueuse/core"))["useWindowSize"]>; + readonly watch: UnwrapRef<(typeof import("vue"))["watch"]>; + readonly watchArray: UnwrapRef<(typeof import("@vueuse/core"))["watchArray"]>; + readonly watchAtMost: UnwrapRef<(typeof import("@vueuse/core"))["watchAtMost"]>; + readonly watchDebounced: UnwrapRef<(typeof import("@vueuse/core"))["watchDebounced"]>; + readonly watchDeep: UnwrapRef<(typeof import("@vueuse/core"))["watchDeep"]>; + readonly watchEffect: UnwrapRef<(typeof import("vue"))["watchEffect"]>; + readonly watchIgnorable: UnwrapRef<(typeof import("@vueuse/core"))["watchIgnorable"]>; + readonly watchImmediate: UnwrapRef<(typeof import("@vueuse/core"))["watchImmediate"]>; + readonly watchOnce: UnwrapRef<(typeof import("@vueuse/core"))["watchOnce"]>; + readonly watchPausable: UnwrapRef<(typeof import("@vueuse/core"))["watchPausable"]>; + readonly watchPostEffect: UnwrapRef<(typeof import("vue"))["watchPostEffect"]>; + readonly watchSyncEffect: UnwrapRef<(typeof import("vue"))["watchSyncEffect"]>; + readonly watchThrottled: UnwrapRef<(typeof import("@vueuse/core"))["watchThrottled"]>; + readonly watchTriggerable: UnwrapRef<(typeof import("@vueuse/core"))["watchTriggerable"]>; + readonly watchWithFilter: UnwrapRef<(typeof import("@vueuse/core"))["watchWithFilter"]>; + readonly whenever: UnwrapRef<(typeof import("@vueuse/core"))["whenever"]>; + } +} diff --git a/src/types/components.d.ts b/src/types/components.d.ts new file mode 100644 index 0000000..6e194f0 --- /dev/null +++ b/src/types/components.d.ts @@ -0,0 +1,90 @@ +/* prettier-ignore */ +// @ts-nocheck +// Generated by unplugin-vue-components +// Read more: https://github.com/vuejs/core/pull/3399 +export {} + +declare module "vue" { + export interface GlobalComponents { + AppLink: (typeof import("./../components/AppLink/index.vue"))["default"]; + Breadcrumb: (typeof import("./../components/Breadcrumb/index.vue"))["default"]; + CopyButton: (typeof import("./../components/CopyButton/index.vue"))["default"]; + CURD: (typeof import("./../components/CURD/index.vue"))["default"]; + Dict: (typeof import("./../components/Dict/index.vue"))["default"]; + DictLabel: (typeof import("./../components/Dict/DictLabel.vue"))["default"]; + ECharts: (typeof import("./../components/ECharts/index.vue"))["default"]; + ElBacktop: (typeof import("element-plus/es"))["ElBacktop"]; + ElBreadcrumb: (typeof import("element-plus/es"))["ElBreadcrumb"]; + ElBreadcrumbItem: (typeof import("element-plus/es"))["ElBreadcrumbItem"]; + ElButton: (typeof import("element-plus/es"))["ElButton"]; + ElCard: (typeof import("element-plus/es"))["ElCard"]; + ElCascader: (typeof import("element-plus/es"))["ElCascader"]; + ElCheckbox: (typeof import("element-plus/es"))["ElCheckbox"]; + ElCheckboxGroup: (typeof import("element-plus/es"))["ElCheckboxGroup"]; + ElCol: (typeof import("element-plus/es"))["ElCol"]; + ElColorPicker: (typeof import("element-plus/es"))["ElColorPicker"]; + ElConfigProvider: (typeof import("element-plus/es"))["ElConfigProvider"]; + ElDatePicker: (typeof import("element-plus/es"))["ElDatePicker"]; + ElDialog: (typeof import("element-plus/es"))["ElDialog"]; + ElDivider: (typeof import("element-plus/es"))["ElDivider"]; + ElDrawer: (typeof import("element-plus/es"))["ElDrawer"]; + ElDropdown: (typeof import("element-plus/es"))["ElDropdown"]; + ElDropdownItem: (typeof import("element-plus/es"))["ElDropdownItem"]; + ElDropdownMenu: (typeof import("element-plus/es"))["ElDropdownMenu"]; + ElForm: (typeof import("element-plus/es"))["ElForm"]; + ElFormItem: (typeof import("element-plus/es"))["ElFormItem"]; + ElIcon: (typeof import("element-plus/es"))["ElIcon"]; + ElImage: (typeof import("element-plus/es"))["ElImage"]; + ElInput: (typeof import("element-plus/es"))["ElInput"]; + ElInputTag: (typeof import("element-plus/es"))["ElInputTag"]; + ElInputNumber: (typeof import("element-plus/es"))["ElInputNumber"]; + ElLink: (typeof import("element-plus/es"))["ElLink"]; + ElMenu: (typeof import("element-plus/es"))["ElMenu"]; + ElMenuItem: (typeof import("element-plus/es"))["ElMenuItem"]; + ElOption: (typeof import("element-plus/es"))["ElOption"]; + ElPagination: (typeof import("element-plus/es"))["ElPagination"]; + ElPopover: (typeof import("element-plus/es"))["ElPopover"]; + ElRadio: (typeof import("element-plus/es"))["ElRadio"]; + ElRadioGroup: (typeof import("element-plus/es"))["ElRadioGroup"]; + ElRow: (typeof import("element-plus/es"))["ElRow"]; + ElScrollbar: (typeof import("element-plus/es"))["ElScrollbar"]; + ElSelect: (typeof import("element-plus/es"))["ElSelect"]; + ElStatistic: (typeof import("element-plus/es"))["ElStatistic"]; + ElSubMenu: (typeof import("element-plus/es"))["ElSubMenu"]; + ElSwitch: (typeof import("element-plus/es"))["ElSwitch"]; + ElTable: (typeof import("element-plus/es"))["ElTable"]; + ElTableColumn: (typeof import("element-plus/es"))["ElTableColumn"]; + ElTag: (typeof import("element-plus/es"))["ElTag"]; + ElText: (typeof import("element-plus/es"))["ElText"]; + ElTimeSelect: (typeof import("element-plus/es"))["ElTimeSelect"]; + ElTooltip: (typeof import("element-plus/es"))["ElTooltip"]; + ElTree: (typeof import("element-plus/es"))["ElTree"]; + ElTreeSelect: (typeof import("element-plus/es"))["ElTreeSelect"]; + ElUpload: (typeof import("element-plus/es"))["ElUpload"]; + ElWatermark: (typeof import("element-plus/es"))["ElWatermark"]; + ElSkeleton: (typeof import("element-plus/es"))["ElSkeleton"]; + FileUpload: (typeof import("./../components/Upload/FileUpload.vue"))["default"]; + Form: (typeof import("./../components/CURD/Form.vue"))["default"]; + Fullscreen: (typeof import("./../components/Fullscreen/index.vue"))["default"]; + GithubCorner: (typeof import("./../components/GithubCorner/index.vue"))["default"]; + Hamburger: (typeof import("./../components/Hamburger/index.vue"))["default"]; + IconSelect: (typeof import("./../components/IconSelect/index.vue"))["default"]; + LangSelect: (typeof import("./../components/LangSelect/index.vue"))["default"]; + MenuSearch: (typeof import("./../components/MenuSearch/index.vue"))["default"]; + MultiImageUpload: (typeof import("./../components/Upload/MultiImageUpload.vue"))["default"]; + Notification: (typeof import("./../components/Notification/index.vue"))["default"]; + PageContent: (typeof import("./../components/CURD/PageContent.vue"))["default"]; + PageModal: (typeof import("./../components/CURD/PageModal.vue"))["default"]; + PageSearch: (typeof import("./../components/CURD/PageSearch.vue"))["default"]; + Pagination: (typeof import("./../components/Pagination/index.vue"))["default"]; + RouterLink: (typeof import("vue-router"))["RouterLink"]; + RouterView: (typeof import("vue-router"))["RouterView"]; + SingleImageUpload: (typeof import("./../components/Upload/SingleImageUpload.vue"))["default"]; + SizeSelect: (typeof import("./../components/SizeSelect/index.vue"))["default"]; + TableSelect: (typeof import("./../components/TableSelect/index.vue"))["default"]; + WangEditor: (typeof import("./../components/WangEditor/index.vue"))["default"]; + } + export interface ComponentCustomProperties { + vLoading: (typeof import("element-plus/es"))["ElLoadingDirective"]; + } +} diff --git a/src/types/env.d.ts b/src/types/env.d.ts new file mode 100644 index 0000000..301f03e --- /dev/null +++ b/src/types/env.d.ts @@ -0,0 +1,33 @@ +// https://cn.vitejs.dev/guide/env-and-mode + +// TypeScript 类型提示都为 string: https://github.com/vitejs/vite/issues/6930 +interface ImportMetaEnv { + /** 应用端口 */ + VITE_APP_PORT: number; + /** API 基础路径(代理前缀) */ + VITE_APP_BASE_API: string; + /** API 地址 */ + VITE_APP_API_URL: string; + /** 是否开启 Mock 服务 */ + VITE_MOCK_DEV_SERVER: boolean; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +} + +/** + * 平台的名称、版本、运行所需的`node`版本、依赖、构建时间的类型提示 + */ +declare const __APP_INFO__: { + pkg: { + name: string; + version: string; + engines: { + node: string; + }; + dependencies: Record; + devDependencies: Record; + }; + buildTimestamp: number; +}; diff --git a/src/types/global.d.ts b/src/types/global.d.ts new file mode 100644 index 0000000..25487ca --- /dev/null +++ b/src/types/global.d.ts @@ -0,0 +1,109 @@ +declare global { + /** + * 响应数据 + */ + interface ApiResponse { + code: string; + data: T; + msg: string; + } + + /** + * 分页查询参数 + */ + interface PageQuery { + pageNum: number; + pageSize: number; + } + + /** + * 分页响应对象 + */ + interface PageResult { + /** 数据列表 */ + list: T; + /** 总数 */ + total: number; + } + + /** + * 页签对象 + */ + interface TagView { + /** 页签名称 */ + name: string; + /** 页签标题 */ + title: string; + /** 页签路由路径 */ + path: string; + /** 页签路由完整路径 */ + fullPath: string; + /** 页签图标 */ + icon?: string; + /** 是否固定页签 */ + affix?: boolean; + /** 是否开启缓存 */ + keepAlive?: boolean; + /** 路由查询参数 */ + query?: any; + } + + /** + * 系统设置 + */ + interface AppSettings { + /** 系统标题 */ + title: string; + /** 系统版本 */ + version: string; + /** 是否显示设置 */ + showSettings: boolean; + /** 是否显示多标签导航 */ + showTagsView: boolean; + /** 是否显示应用Logo */ + showAppLogo: boolean; + /** 导航栏布局(left|top|mix) */ + layout: "left" | "top" | "mix"; + /** 主题颜色 */ + themeColor: string; + /** 主题模式(dark|light) */ + theme: import("@/enums/settings/theme.enum").ThemeMode; + /** 布局大小(default |large |small) */ + size: string; + /** 语言( zh-cn| en) */ + language: string; + /** 是否显示水印 */ + showWatermark: boolean; + /** 水印内容 */ + watermarkContent: string; + /** 侧边栏配色方案 */ + sidebarColorScheme: "classic-blue" | "minimal-white"; + } + + /** + * 下拉选项数据类型 + */ + interface OptionType { + /** 值 */ + value: string | number; + /** 文本 */ + label: string; + /** 子列表 */ + children?: OptionType[]; + } + + /** + * 导入结果 + */ + interface ExcelResult { + /** 状态码 */ + code: string; + /** 无效数据条数 */ + invalidCount: number; + /** 有效数据条数 */ + validCount: number; + /** 错误信息 */ + messageList: Array; + } +} +export {}; diff --git a/src/types/router.d.ts b/src/types/router.d.ts new file mode 100644 index 0000000..17a3cb4 --- /dev/null +++ b/src/types/router.d.ts @@ -0,0 +1,54 @@ +import "vue-router"; + +declare module "vue-router" { + // https://router.vuejs.org/zh/guide/advanced/meta.html#typescript + // 可以通过扩展 RouteMeta 接口来输入 meta 字段 + interface RouteMeta { + /** + * 菜单名称 + * @example 'Dashboard' + */ + title?: string; + + /** + * 菜单图标 + * @example 'el-icon-edit' + */ + icon?: string; + + /** + * 是否隐藏菜单 + * true 隐藏, false 显示 + * @default false + */ + hidden?: boolean; + + /** + * 始终显示父级菜单,即使只有一个子菜单 + * true 显示父级菜单, false 隐藏父级菜单,显示唯一子节点 + * @default false + */ + alwaysShow?: boolean; + + /** + * 是否固定在页签上 + * true 固定, false 不固定 + * @default false + */ + affix?: boolean; + + /** + * 是否缓存页面 + * true 缓存, false 不缓存 + * @default false + */ + keepAlive?: boolean; + + /** + * 是否在面包屑导航中隐藏 + * true 隐藏, false 显示 + * @default false + */ + breadcrumb?: boolean; + } +} diff --git a/src/types/shims-vue.d.ts b/src/types/shims-vue.d.ts new file mode 100644 index 0000000..d77b62b --- /dev/null +++ b/src/types/shims-vue.d.ts @@ -0,0 +1,5 @@ +declare module "*.vue" { + import type { DefineComponent } from "vue"; + const component: DefineComponent<{}, {}, any>; + export default component; +} diff --git a/src/types/socket.d.ts b/src/types/socket.d.ts new file mode 100644 index 0000000..15a8ed7 --- /dev/null +++ b/src/types/socket.d.ts @@ -0,0 +1,6 @@ +// https://github.com/sockjs/sockjs-client/issues/565 + +declare module "sockjs-client/dist/sockjs.min.js" { + import Client from "sockjs-client"; + export default Client; +} diff --git a/src/utils/auth.ts b/src/utils/auth.ts new file mode 100644 index 0000000..db0a740 --- /dev/null +++ b/src/utils/auth.ts @@ -0,0 +1,86 @@ +import { Storage } from "./storage"; +import { AUTH_KEYS } from "@/constants"; + +/** + * 身份验证工具类 + * 集中管理所有与认证相关的功能,包括: + * - 登录状态判断 + * - Token 的存取 + * - 记住我功能的状态管理 + */ +export class Auth { + /** + * 判断用户是否已登录 + * @returns 是否已登录 + */ + static isLoggedIn(): boolean { + return !!Auth.getAccessToken(); + } + + /** + * 获取当前有效的访问令牌 + * 会根据"记住我"状态从适当的存储位置获取 + * @returns 当前有效的访问令牌 + */ + static getAccessToken(): string { + const isRememberMe = Storage.get(AUTH_KEYS.REMEMBER_ME, false); + // 根据"记住我"状态决定从哪个存储位置获取token + return isRememberMe + ? Storage.get(AUTH_KEYS.ACCESS_TOKEN, "") + : Storage.sessionGet(AUTH_KEYS.ACCESS_TOKEN, ""); + } + + /** + * 获取刷新令牌 + * @returns 当前有效的刷新令牌 + */ + static getRefreshToken(): string { + const isRememberMe = Storage.get(AUTH_KEYS.REMEMBER_ME, false); + return isRememberMe + ? Storage.get(AUTH_KEYS.REFRESH_TOKEN, "") + : Storage.sessionGet(AUTH_KEYS.REFRESH_TOKEN, ""); + } + + /** + * 设置访问令牌和刷新令牌 + * @param accessToken 访问令牌 + * @param refreshToken 刷新令牌 + * @param rememberMe 是否记住我 + */ + static setTokens(accessToken: string, refreshToken: string, rememberMe: boolean): void { + // 保存"记住我"状态 + Storage.set(AUTH_KEYS.REMEMBER_ME, rememberMe); + + if (rememberMe) { + // 使用localStorage长期保存 + Storage.set(AUTH_KEYS.ACCESS_TOKEN, accessToken); + Storage.set(AUTH_KEYS.REFRESH_TOKEN, refreshToken); + } else { + // 使用sessionStorage临时保存 + Storage.sessionSet(AUTH_KEYS.ACCESS_TOKEN, accessToken); + Storage.sessionSet(AUTH_KEYS.REFRESH_TOKEN, refreshToken); + // 清除localStorage中可能存在的token + Storage.remove(AUTH_KEYS.ACCESS_TOKEN); + Storage.remove(AUTH_KEYS.REFRESH_TOKEN); + } + } + + /** + * 清除所有身份验证相关的数据 + */ + static clearAuth(): void { + Storage.remove(AUTH_KEYS.ACCESS_TOKEN); + Storage.remove(AUTH_KEYS.REFRESH_TOKEN); + Storage.sessionRemove(AUTH_KEYS.ACCESS_TOKEN); + Storage.sessionRemove(AUTH_KEYS.REFRESH_TOKEN); + // 不清除记住我设置,保留用户偏好 + } + + /** + * 获取"记住我"状态 + * @returns 是否记住我 + */ + static getRememberMe(): boolean { + return Storage.get(AUTH_KEYS.REMEMBER_ME, false); + } +} diff --git a/src/utils/i18n.ts b/src/utils/i18n.ts new file mode 100644 index 0000000..17ed904 --- /dev/null +++ b/src/utils/i18n.ts @@ -0,0 +1,12 @@ +// translate router.meta.title, be used in breadcrumb sidebar tagsview +import i18n from "@/lang/index"; + +export function translateRouteTitle(title: any) { + // 判断是否存在国际化配置,如果没有原生返回 + const hasKey = i18n.global.te("route." + title); + if (hasKey) { + const translatedTitle = i18n.global.t("route." + title); + return translatedTitle; + } + return title; +} diff --git a/src/utils/index.ts b/src/utils/index.ts new file mode 100644 index 0000000..67fce78 --- /dev/null +++ b/src/utils/index.ts @@ -0,0 +1,58 @@ +/** + * Check if an element has a class + * @param {HTMLElement} ele + * @param {string} cls + * @returns {boolean} + */ +export function hasClass(ele: HTMLElement, cls: string) { + return !!ele.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)")); +} + +/** + * Add class to element + * @param {HTMLElement} ele + * @param {string} cls + */ +export function addClass(ele: HTMLElement, cls: string) { + if (!hasClass(ele, cls)) ele.className += " " + cls; +} + +/** + * Remove class from element + * @param {HTMLElement} ele + * @param {string} cls + */ +export function removeClass(ele: HTMLElement, cls: string) { + if (hasClass(ele, cls)) { + const reg = new RegExp("(\\s|^)" + cls + "(\\s|$)"); + ele.className = ele.className.replace(reg, " "); + } +} + +/** + * 判断是否是外部链接 + * + * @param {string} path + * @returns {Boolean} + */ +export function isExternal(path: string) { + const isExternal = /^(https?:|http?:|mailto:|tel:)/.test(path); + return isExternal; +} + +/** + * 格式化增长率,保留两位小数 ,并且去掉末尾的0 取绝对值 + * + * @param growthRate + * @returns + */ +export function formatGrowthRate(growthRate: number) { + if (growthRate === 0) { + return "-"; + } + + const formattedRate = Math.abs(growthRate * 100) + .toFixed(2) + .replace(/\.?0+$/, ""); + return formattedRate + "%"; +} diff --git a/src/utils/nprogress.ts b/src/utils/nprogress.ts new file mode 100644 index 0000000..c1d5f23 --- /dev/null +++ b/src/utils/nprogress.ts @@ -0,0 +1,18 @@ +import NProgress from "nprogress"; +import "nprogress/nprogress.css"; + +// 进度条 +NProgress.configure({ + // 动画方式 + easing: "ease", + // 递增进度条的速度 + speed: 500, + // 是否显示加载ico + showSpinner: false, + // 自动递增间隔 + trickleSpeed: 200, + // 初始化时的最小百分比 + minimum: 0.3, +}); + +export default NProgress; diff --git a/src/utils/request.ts b/src/utils/request.ts new file mode 100644 index 0000000..4baf361 --- /dev/null +++ b/src/utils/request.ts @@ -0,0 +1,174 @@ +import axios, { type InternalAxiosRequestConfig, type AxiosResponse } from "axios"; +import qs from "qs"; +import { useUserStoreHook } from "@/store/modules/user.store"; +import { ResultEnum } from "@/enums/api/result.enum"; +import { Auth } from "@/utils/auth"; +import router from "@/router"; + +/** + * 创建 HTTP 请求实例 + */ +const httpRequest = axios.create({ + baseURL: import.meta.env.VITE_APP_BASE_API, + timeout: 50000, + headers: { "Content-Type": "application/json;charset=utf-8" }, + paramsSerializer: (params) => qs.stringify(params), +}); + +/** + * 请求拦截器 - 添加 Authorization 头 + */ +httpRequest.interceptors.request.use( + (config: InternalAxiosRequestConfig) => { + const accessToken = Auth.getAccessToken(); + + // 如果 Authorization 设置为 no-auth,则不携带 Token + if (config.headers.Authorization !== "no-auth" && accessToken) { + config.headers.Authorization = `Bearer ${accessToken}`; + } else { + delete config.headers.Authorization; + } + + return config; + }, + (error) => { + console.error("Request interceptor error:", error); + return Promise.reject(error); + } +); + +/** + * 响应拦截器 - 统一处理响应和错误 + */ +httpRequest.interceptors.response.use( + (response: AxiosResponse) => { + // 如果响应是二进制流,则直接返回(用于文件下载、Excel 导出等) + if (response.config.responseType === "blob") { + return response; + } + + const { code, data, msg } = response.data; + + // 请求成功 + if (code === ResultEnum.SUCCESS) { + return data; + } + + // 业务错误 + ElMessage.error(msg || "系统出错"); + return Promise.reject(new Error(msg || "Business Error")); + }, + async (error) => { + console.error("Response interceptor error:", error); + + const { config, response } = error; + + // 网络错误或服务器无响应 + if (!response) { + ElMessage.error("网络连接失败,请检查网络设置"); + return Promise.reject(error); + } + + const { code, msg } = response.data as ApiResponse; + + switch (code) { + case ResultEnum.ACCESS_TOKEN_INVALID: + // Access Token 过期,尝试刷新 + return refreshTokenAndRetry(config); + + case ResultEnum.REFRESH_TOKEN_INVALID: + // Refresh Token 过期,跳转登录页 + await redirectToLogin("登录已过期,请重新登录"); + return Promise.reject(new Error(msg || "Refresh Token Invalid")); + + default: + ElMessage.error(msg || "请求失败"); + return Promise.reject(new Error(msg || "Request Error")); + } + } +); + +/** + * 重试请求的回调函数类型 + */ +type RetryCallback = () => void; + +// Token 刷新相关状态 +let isRefreshingToken = false; +const pendingRequests: RetryCallback[] = []; + +/** + * 刷新 Token 并重试请求 + */ +async function refreshTokenAndRetry(config: InternalAxiosRequestConfig): Promise { + return new Promise((resolve, reject) => { + // 封装需要重试的请求 + const retryRequest = () => { + const newToken = Auth.getAccessToken(); + if (newToken && config.headers) { + config.headers.Authorization = `Bearer ${newToken}`; + } + httpRequest(config).then(resolve).catch(reject); + }; + + // 将请求加入等待队列 + pendingRequests.push(retryRequest); + + // 如果没有正在刷新,则开始刷新流程 + if (!isRefreshingToken) { + isRefreshingToken = true; + + useUserStoreHook() + .refreshToken() + .then(() => { + // 刷新成功,重试所有等待的请求 + pendingRequests.forEach((callback) => { + try { + callback(); + } catch (error) { + console.error("Retry request error:", error); + } + }); + // 清空队列 + pendingRequests.length = 0; + }) + .catch(async (error) => { + console.error("Token refresh failed:", error); + // 刷新失败,清空队列并跳转登录页 + pendingRequests.length = 0; + await redirectToLogin("登录状态已失效,请重新登录"); + // 拒绝所有等待的请求 + pendingRequests.forEach(() => { + reject(new Error("Token refresh failed")); + }); + }) + .finally(() => { + isRefreshingToken = false; + }); + } + }); +} + +/** + * 重定向到登录页面 + */ +async function redirectToLogin(message: string = "请重新登录"): Promise { + try { + ElNotification({ + title: "提示", + message, + type: "warning", + duration: 3000, + }); + + await useUserStoreHook().resetAllState(); + + // 跳转到登录页,保留当前路由用于登录后跳转 + const currentPath = router.currentRoute.value.fullPath; + await router.push(`/login?redirect=${encodeURIComponent(currentPath)}`); + } catch (error) { + console.error("Redirect to login error:", error); + } +} + +export default httpRequest; diff --git a/src/utils/storage.ts b/src/utils/storage.ts new file mode 100644 index 0000000..25bf6f3 --- /dev/null +++ b/src/utils/storage.ts @@ -0,0 +1,51 @@ +/** + * 存储工具类 + * 提供localStorage和sessionStorage操作方法 + */ +export class Storage { + /** + * localStorage 存储 + */ + static set(key: string, value: any): void { + localStorage.setItem(key, JSON.stringify(value)); + } + + static get(key: string, defaultValue?: T): T { + const value = localStorage.getItem(key); + if (!value) return defaultValue as T; + + try { + return JSON.parse(value); + } catch { + // 如果解析失败,返回原始字符串 + return value as unknown as T; + } + } + + static remove(key: string): void { + localStorage.removeItem(key); + } + + /** + * sessionStorage 存储 + */ + static sessionSet(key: string, value: any): void { + sessionStorage.setItem(key, JSON.stringify(value)); + } + + static sessionGet(key: string, defaultValue?: T): T { + const value = sessionStorage.getItem(key); + if (!value) return defaultValue as T; + + try { + return JSON.parse(value); + } catch { + // 如果解析失败,返回原始字符串 + return value as unknown as T; + } + } + + static sessionRemove(key: string): void { + sessionStorage.removeItem(key); + } +} diff --git a/src/utils/theme.ts b/src/utils/theme.ts new file mode 100644 index 0000000..e4aa356 --- /dev/null +++ b/src/utils/theme.ts @@ -0,0 +1,112 @@ +import { ThemeMode } from "@/enums"; + +// 辅助函数:将十六进制颜色转换为 RGB +function hexToRgb(hex: string): [number, number, number] { + const bigint = parseInt(hex.slice(1), 16); + return [(bigint >> 16) & 255, (bigint >> 8) & 255, bigint & 255]; +} + +// 辅助函数:将 RGB 转换为十六进制颜色 +function rgbToHex(r: number, g: number, b: number): string { + return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`; +} + +// 辅助函数:调整颜色亮度 +/** function adjustBrightness(hex: string, factor: number, theme: string): string { + const rgb = hexToRgb(hex); + // 是否是暗黑模式 + const isDarkMode = theme === "dark" ? 0 : 255; + const newRgb = rgb.map((val) => + Math.max(0, Math.min(255, Math.round(val + (isDarkMode - val) * factor))) + ) as [number, number, number]; + return rgbToHex(...newRgb); +} */ + +/** + * 加深颜色值 + * @param {String} color 颜色值字符串 + * @param {Number} level 加深的程度,限0-1之间 + * @returns {String} 返回处理后的颜色值 + */ +export function getDarkColor(color: string, level: number): string { + const rgb = hexToRgb(color); + for (let i = 0; i < 3; i++) rgb[i] = Math.round(20.5 * level + rgb[i] * (1 - level)); + return rgbToHex(rgb[0], rgb[1], rgb[2]); +} + +/** + * 变浅颜色值 + * @param {String} color 颜色值字符串 + * @param {Number} level 加深的程度,限0-1之间 + * @returns {String} 返回处理后的颜色值 + */ +export const getLightColor = (color: string, level: number): string => { + const rgb = hexToRgb(color); + for (let i = 0; i < 3; i++) rgb[i] = Math.round(255 * level + rgb[i] * (1 - level)); + return rgbToHex(rgb[0], rgb[1], rgb[2]); +}; + +/** + * 生成主题色 + * @param primary 主题色 + * @param theme 主题类型 + */ +export function generateThemeColors(primary: string, theme: ThemeMode) { + const colors: Record = { + primary, + }; + + // 生成浅色变体 + for (let i = 1; i <= 9; i++) { + colors[`primary-light-${i}`] = + theme === ThemeMode.LIGHT + ? `${getLightColor(primary, i / 10)}` + : `${getDarkColor(primary, i / 10)}`; + } + + // 生成深色变体 + colors["primary-dark-2"] = + theme === ThemeMode.LIGHT ? `${getLightColor(primary, 0.2)}` : `${getDarkColor(primary, 0.3)}`; + + return colors; +} + +export function applyTheme(colors: Record) { + const el = document.documentElement; + + Object.entries(colors).forEach(([key, value]) => { + el.style.setProperty(`--el-color-${key}`, value); + }); + + // 确保主题色立即生效,强制重新渲染 + requestAnimationFrame(() => { + // 触发样式重新计算 + el.style.setProperty("--theme-update-trigger", Date.now().toString()); + }); +} + +/** + * 切换暗黑模式 + * + * @param isDark 是否启用暗黑模式 + */ +export function toggleDarkMode(isDark: boolean) { + if (isDark) { + document.documentElement.classList.add(ThemeMode.DARK); + } else { + document.documentElement.classList.remove(ThemeMode.DARK); + } +} + +/** + * 切换浅色主题下的侧边栏颜色方案 + * + * @param isBlue 布尔值,表示是否开启深蓝色侧边栏颜色方案 + */ +export function toggleSidebarColor(isBuleSidebar: boolean) { + if (isBuleSidebar) { + document.documentElement.classList.add("sidebar-color-blue"); + } else { + document.documentElement.classList.remove("sidebar-color-blue"); + } +} diff --git a/src/views/codegen/index.vue b/src/views/codegen/index.vue new file mode 100644 index 0000000..7bd3dfb --- /dev/null +++ b/src/views/codegen/index.vue @@ -0,0 +1,866 @@ + + + diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue new file mode 100644 index 0000000..52d20e0 --- /dev/null +++ b/src/views/dashboard/index.vue @@ -0,0 +1,1407 @@ + + + + + diff --git a/src/views/demo/api/apifox.vue b/src/views/demo/api/apifox.vue new file mode 100644 index 0000000..0eb334b --- /dev/null +++ b/src/views/demo/api/apifox.vue @@ -0,0 +1,27 @@ + +