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..5cfea8e --- /dev/null +++ b/.env.development @@ -0,0 +1,17 @@ +# 应用端口 +VITE_APP_PORT=3000 + +# 代理前缀 +VITE_APP_BASE_API=/dev-api + +# 接口地址 + +VITE_APP_API_URL=https://admintestpapi.sxczgkj.cn/ # 线上 +# 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..dccd5ce --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +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 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..fd2cef3 --- /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..9fb64d6 --- /dev/null +++ b/README.en-US.md @@ -0,0 +1,176 @@ +
+ vue3-element-admin +

vue3-element-admin

+ + + + + + + + + + + 有来技术 + + + 有来技术 + + + 有来技术 + +
+ + +![](https://foruda.gitee.com/images/1708618984641188532/a7cca095_716974.png "rainbow.png") + +
+ 👀 Live Preview | 📖 Read Documentation | 🌐 中文 +
+ + + + +## Introduction + +[vue3-element-admin](https://gitee.com/youlaiorg/vue3-element-admin) is a free and open-source admin template for backend management frontend, built with popular technologies such as Vue3, Vite5, TypeScript, Element-Plus, and Pinia (with accompanying [backend source code](https://gitee.com/youlaiorg/youlai-boot)). + + + + +## 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 both local `Mock` data and remote API. Comes with [Java backend source code](https://gitee.com/youlaiorg/youlai-boot) and online API documentation. + +- **Permission Management**: Complete permission system for users, roles, menus, dictionaries, and departments. + +- **Essential Infrastructure**: Dynamic routing, button permissions, internationalization, code style, Git commit conventions, and common component encapsulation. + +- **Continuous Updates**: Since 2021, the project has maintained an open-source status with continuous updates, integrating new tools and dependencies in real time, and has accumulated a broad user base. + +## Project Preview + +![Light Mode](https://foruda.gitee.com/images/1709651876583793739/0ba1ee1c_716974.png) + +![Dark Mode](https://foruda.gitee.com/images/1709651875494206224/2a2b0b53_716974.png) + +![API Documentation](https://foruda.gitee.com/images/1687755822857820115/96054330_716974.png) + +## Project Links + +| Project | Gitee | Github | GitCode | +|----------| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| Frontend | [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.net/youlai/vue3-element-admin) | +| Lite | [vue3-element-template](https://gitee.com/youlaiorg/vue3-element-template) | [vue3-element-template](https://github.com/youlaitech/vue3-element-template) |-| +| Backend | [youlai-boot](https://gitee.com/youlaiorg/youlai-boot) | [youlai-boot](https://github.com/haoxianrui/youlai-boot.git) | [youlai-boot](https://gitcode.net/youlai/youlai-boot) | + +## Environment Setup + +| Environment | Name and Version | Download Link | +| -------------------- | :----------------------------------------------------------- | ------------------------------------------------------------ | +| **Development Tool** | VSCode | [Download](https://code.visualstudio.com/Download) | +| **Runtime Environment** | Node ≥18 | [Download](http://nodejs.cn/download) | + + +## Project Setup + +```bash +# Clone the repository +git clone https://gitee.com/youlaiorg/vue3-element-admin.git + +# Change directory +cd vue3-element-admin + +# Install pnpm +npm install pnpm -g + +# Install dependencies +pnpm install + +# Start the project +pnpm run dev +``` + +## Project Deployment + +```bash +# Build the project +pnpm run build + +# Upload files to the remote server +Copy the files generated in the `dist` directory to the `/usr/share/nginx/html` directory. + +# nginx.cofig configuration +server { + listen 80; + server_name localhost; + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + # Reverse proxy configuration + location /prod-api/ { + proxy_pass http://vapi.youlai.tech/; # Replace vapi.youlai.tech with your backend API address + } +} +``` + +## Local Mock + +The project supports both online API and local mock API. By default, it uses the online API. If you want to switch to the mock API, modify the value of `VITE_MOCK_DEV_SERVER` 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 set up a full-stack development environment. + +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 the local environment. +3. Modify the value of `VITE_APP_API_URL` in the `.env.development` file to `http://localhost:8989`, replacing it with the backend API URL. + +## 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 `?.`. + +- **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). + +## Project Documentation + +- [Building a Backend Management System from Scratch with Vue3, Vite, TypeScript, and Element-Plus](https://blog.csdn.net/u013737132/article/details/130191394) + +- [ESLint+Prettier+Stylelint+EditorConfig for Standardized and Unified Frontend Code Style](https://blog.csdn.net/u013737132/article/details/130190788) +- [Git Commit Conventions with Husky, Lint-staged, Commitlint, Commitizen, and cz-git](https://blog.csdn.net/u013737132/article/details/130191363) + +## 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) + +## Community 🚀 + +> **Follow "Youlai Tech" WeChat Official Account to get the QR code for the community.** +> +> If the QR code for the community has expired, please add my WeChat (haoxianrui) and indicate whether you are interested in "Frontend", "Backend", or "Full Stack" to get the latest QR code. +> +> This measure is taken to ensure the quality of the community and prevent marketing advertising from infiltrating. Thank you for your understanding! + +| Official Account | Community | +|:----:|:----:| +| ![Youlai Tech WeChat Official Account QR Code](https://foruda.gitee.com/images/1687689212187063809/3c69eaee_716974.png) | ![Community QR Code](https://foruda.gitee.com/images/1687689212139273561/6a65ef69_716974.png) | + diff --git a/README.md b/README.md index 81e5aee..a97ac1a 100644 --- a/README.md +++ b/README.md @@ -1 +1,204 @@ -#management-web +
+ 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 + Vite5+ TypeScript5 + Element-Plus + Pinia 等主流技术栈构建的免费开源的中后台管理的前端模板(配套[Java 后端源码](https://gitee.com/youlaiorg/youlai-boot))。 + + +## 项目特色 + +- **简洁易用**:基于 [vue-element-admin](https://gitee.com/panjiachen/vue-element-admin) 升级的 Vue3 版本,无过渡封装 ,易上手。 + +- **数据交互**:同时支持本地 `Mock` 和线上接口,配套 [Java 后端源码](https://gitee.com/youlaiorg/youlai-boot)和[在线接口文档](https://www.apifox.cn/apidoc/shared-195e783f-4d85-4235-a038-eec696de4ea5)。 + +- **权限管理**:用户、角色、菜单、字典、部门等完善的权限系统功能。 + +- **基础设施**:动态路由、按钮权限、国际化、代码规范、Git 提交规范、常用组件封装。 + +- **持续更新**:项目持续开源更新,实时更新工具和依赖。 + + + +## 项目预览 + +![明亮模式](https://foruda.gitee.com/images/1709651876583793739/0ba1ee1c_716974.png) + +![暗黑模式](https://foruda.gitee.com/images/1709651875494206224/2a2b0b53_716974.png) + +![接口文档](https://foruda.gitee.com/images/1687755822857820115/96054330_716974.png) + +## 项目源码 + +| 项目 | Gitee | Github | GitCode| +| ---- | ----| ---- | ---- | +| 前端 | [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-template](https://gitee.com/youlaiorg/vue3-element-template) | [vue3-element-template](https://github.com/youlaitech/vue3-element-template) |-| +| 后端 | [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)| + +## 环境准备 + +| 环境 | 名称版本 | 下载地址 | +| -------------------- | :----------------------------------------------------------- | ------------------------------------------------------------ | +| **开发工具** | VSCode | [下载](https://code.visualstudio.com/Download) | +| **运行环境** | Node ≥18 (其中 20.6.0 版本不可用) | [下载](http://nodejs.cn/download) | + + +## 项目启动 + +```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 +``` + + + +## 项目部署 + +```bash +# 项目打包 +pnpm run build + +# 上传文件至远程服务器 +将本地打包生成的 dist 目录下的所有文件拷贝至服务器的 /usr/share/nginx/html 目录。 + +# nginx.cofig 配置 +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/; + } +} +``` + +## 本地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) + + + +## 项目文档 + +- [基于 Vue3 + Vite + TypeScript + Element-Plus 从0到1搭建后台管理系统](https://blog.csdn.net/u013737132/article/details/130191394) + +- [ESLint+Prettier+Stylelint+EditorConfig 约束和统一前端代码规范](https://blog.csdn.net/u013737132/article/details/130190788) +- [Husky + Lint-staged + Commitlint + Commitizen + cz-git 配置 Git 提交规范](https://blog.csdn.net/u013737132/article/details/130191363) + + +## 提交规范 + +执行 `pnpm run commit` 唤起 git commit 交互,根据提示完成信息的输入和选择。 + +![](https://foruda.gitee.com/images/1687755823165218215/c1705416_716974.png) + + +## 项目统计 + +![Alt](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) + +## G-Star + +![](https://foruda.gitee.com/images/1728577513089814203/95f2a70d_716974.jpeg) + +## 交流群🚀 + +> **关注「有来技术」公众号,获取交流群二维码。** +> +> 如果交流群的二维码过期,请加微信(haoxianrui)并备注「前端」、「后端」或「全栈」以获取最新二维码。 +> +> 为确保交流群质量,防止营销广告人群混入,我们采取了此措施。望各位理解! + +| 公众号 | 交流群 | +|:----:|:----:| +| ![有来技术公众号二维码](https://foruda.gitee.com/images/1687689212187063809/3c69eaee_716974.png) | ![交流群二维码](https://foruda.gitee.com/images/1687689212139273561/6a65ef69_716974.png) | + diff --git a/commitlint.config.cjs b/commitlint.config.cjs new file mode 100644 index 0000000..4ecb995 --- /dev/null +++ b/commitlint.config.cjs @@ -0,0 +1,95 @@ +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.js b/eslint.config.js new file mode 100644 index 0000000..f5997a7 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,115 @@ +import globals from "globals"; +import js from "@eslint/js"; + +// ESLint 核心插件 +import pluginVue from "eslint-plugin-vue"; +import pluginTypeScript from "@typescript-eslint/eslint-plugin"; + +// Prettier 插件及配置 +import configPrettier from "eslint-config-prettier"; +import pluginPrettier from "eslint-plugin-prettier"; + +// 解析器 +import * as parserVue from "vue-eslint-parser"; +import * as parserTypeScript from "@typescript-eslint/parser"; + +// 定义 ESLint 配置 +export default [ + // 通用 JavaScript 配置 + { + ...js.configs.recommended, + ignores: ["**/.*", "dist/*", "*.d.ts", "public/*", "src/assets/**"], + languageOptions: { + globals: { + ...globals.browser, // 浏览器变量 (window, document 等) + ...globals.node, // Node.js 变量 (process, require 等) + }, + }, + plugins: { + prettier: pluginPrettier, + }, + rules: { + ...configPrettier.rules, + ...pluginPrettier.configs.recommended.rules, + "no-debug": "off", // 禁止 debugger + "prettier/prettier": [ + "error", + { + endOfLine: "auto", // 自动识别换行符 + }, + ], + }, + }, + + // TypeScript 配置 + { + files: ["**/*.?([cm])ts"], + languageOptions: { + parser: parserTypeScript, + parserOptions: { + sourceType: "module", + }, + }, + plugins: { + "@typescript-eslint": pluginTypeScript, + }, + rules: { + ...pluginTypeScript.configs.strict.rules, + "@typescript-eslint/no-explicit-any": "off", // 允许使用 any + "@typescript-eslint/no-empty-function": "off", // 允许空函数 + "@typescript-eslint/no-empty-object-type": "off", // 允许空对象类型 + "@typescript-eslint/consistent-type-imports": [ + "error", + { disallowTypeAnnotations: false, fixStyle: "inline-type-imports" }, + ], // 统一类型导入风格 + }, + }, + + // TypeScript 声明文件的特殊配置 + { + files: ["**/*.d.ts"], + rules: { + "eslint-comments/no-unlimited-disable": "off", + "unused-imports/no-unused-vars": "off", + "@typescript-eslint/ban-ts-comment": "off", // 允许使用 @ts-nocheck 注释 + }, + }, + + // JavaScript (commonjs) 配置 + { + files: ["**/*.?([cm])js"], + rules: { + "@typescript-eslint/no-var-requires": "off", // 允许 require + }, + }, + + // Vue 文件配置 + { + files: ["**/*.vue"], + languageOptions: { + parser: parserVue, + parserOptions: { + parser: "@typescript-eslint/parser", + sourceType: "module", + }, + }, + plugins: { + vue: pluginVue, + }, + processor: pluginVue.processors[".vue"], + rules: { + ...pluginVue.configs["vue3-recommended"].rules, + "vue/no-v-html": "off", // 允许 v-html + "vue/require-default-prop": "off", // 允许没有默认值的 prop + "vue/multi-word-component-names": "off", // 关闭组件名称多词要求 + "vue/html-self-closing": [ + "error", + { + html: { void: "always", normal: "always", component: "always" }, + svg: "always", + math: "always", + }, + ], // 自闭合标签 + }, + }, +]; diff --git a/index.html b/index.html new file mode 100644 index 0000000..bd224a6 --- /dev/null +++ b/index.html @@ -0,0 +1,61 @@ + + + + + + + + + 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..59803e5 --- /dev/null +++ b/mock/auth.mock.ts @@ -0,0 +1,43 @@ +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: null, + 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-data.mock.ts b/mock/dict-data.mock.ts new file mode 100644 index 0000000..9f33f2d --- /dev/null +++ b/mock/dict-data.mock.ts @@ -0,0 +1,216 @@ +import { defineMock } from "./base"; + +export default defineMock([ + { + url: "dict-data/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: "dict-data/:dictCode/options", + 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: "dict-data", + method: ["POST"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "新增字典" + body.name + "成功", + }; + }, + }, + + // 获取字典数据表单 + { + url: "dict-data/:id/form", + method: ["GET"], + body: ({ params }) => { + return { + code: "00000", + data: dictMap[params.id], + msg: "一切ok", + }; + }, + }, + + // 修改字典数据 + { + url: "dict-data/:id", + method: ["PUT"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "修改字典数据" + body.name + "成功", + }; + }, + }, + + // 删除字典 + { + url: "dict-data/:id", + method: ["DELETE"], + body({ params }) { + return { + code: "00000", + data: null, + msg: "删除字典" + params.id + "成功", + }; + }, + }, +]); + +// 字典数据映射表数据 +const dictMap: Record = { + 1: { + code: "00000", + data: { + id: 1, + value: "1", + label: "男", + sort: 1, + status: 1, + tagType: "primary", + }, + msg: "一切ok", + }, + 2: { + code: "00000", + data: { + id: 2, + value: "2", + label: "女", + sort: 2, + status: 1, + tagType: "danger", + }, + msg: "一切ok", + }, + 3: { + code: "00000", + data: { + id: 3, + value: "0", + label: "保密", + sort: 3, + status: 1, + tagType: "info", + }, + msg: "一切ok", + }, +}; diff --git a/mock/dict.mock.ts b/mock/dict.mock.ts new file mode 100644 index 0000000..5f3e5f2 --- /dev/null +++ b/mock/dict.mock.ts @@ -0,0 +1,181 @@ +import { defineMock } from "./base"; + +export default defineMock([ + { + url: "dict/page", + method: ["GET"], + body: { + code: "00000", + data: { + list: [ + { + id: 1, + name: "性别", + dictCode: "gender", + status: 1, + }, + ], + total: 1, + }, + msg: "一切ok", + }, + }, + + // 新增字典 + { + url: "dict", + method: ["POST"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "新增字典" + body.name + "成功", + }; + }, + }, + + // 获取字典表单数据 + { + url: "dict/:id/form", + method: ["GET"], + body: ({ params }) => { + return { + code: "00000", + data: dictMap[params.id], + msg: "一切ok", + }; + }, + }, + + // 修改字典 + { + url: "dict/:id", + method: ["PUT"], + body({ body }) { + return { + code: "00000", + data: null, + msg: "修改字典" + body.name + "成功", + }; + }, + }, + + // 删除字典 + { + url: "dict/:id", + method: ["DELETE"], + body({ params }) { + return { + code: "00000", + data: null, + msg: "删除字典" + params.id + "成功", + }; + }, + }, + + // 所有字典列表 + { + url: "dict/list", + method: ["GET"], + body() { + return { + code: "00000", + data: [ + { + name: "通知级别", + dictCode: "notice_level", + dictDataList: [ + { + value: "L", + label: "低", + tagType: "info", + }, + { + value: "M", + label: "中", + tagType: "warning", + }, + { + value: "H", + label: "高", + tagType: "danger", + }, + ], + }, + { + name: "通知类型", + dictCode: "notice_type", + dictDataList: [ + { + value: "1", + label: "系统升级", + tagType: "success", + }, + { + value: "2", + label: "系统维护", + tagType: "primary", + }, + { + value: "3", + label: "安全警告", + tagType: "danger", + }, + { + value: "4", + label: "假期通知", + tagType: "success", + }, + { + value: "5", + label: "公司新闻", + tagType: "primary", + }, + { + value: "99", + label: "其他", + tagType: "info", + }, + ], + }, + { + name: "性别", + dictCode: "gender", + dictDataList: [ + { + value: "1", + label: "男", + tagType: "primary", + }, + { + value: "2", + label: "女", + tagType: "danger", + }, + { + value: "0", + label: "保密", + tagType: "info", + }, + ], + }, + ], + msg: "一切ok", + }; + }, + }, +]); + +// 字典映射表数据 +const dictMap: Record = { + 1: { + code: "00000", + data: { + id: 1, + name: "性别", + dictCode: "gender", + status: 1, + }, + msg: "一切ok", + }, +}; 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..9d3840d --- /dev/null +++ b/mock/menu.mock.ts @@ -0,0 +1,1711 @@ +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-data", + component: "system/dict/data", + name: "DictData", + 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: "/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-data", + component: "system/dict/data", + 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-data:add", + children: [], + }, + { + id: 137, + parentId: 135, + name: "字典数据编辑", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 5, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dict-data:edit", + children: [], + }, + { + id: 138, + parentId: 135, + name: "字典数据删除", + type: "BUTTON", + routeName: null, + routePath: "", + component: null, + sort: 6, + visible: 1, + icon: "", + redirect: null, + perm: "sys:dict-data: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", + 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..57c8482 --- /dev/null +++ b/mock/user.mock.ts @@ -0,0 +1,237 @@ +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:notice:edit", + "sys:menu:delete", + "sys:dict:edit", + "sys:notice:query", + "sys:dict:delete", + "sys:config:add", + "sys:config:refresh", + "sys:menu:add", + "sys:user:add", + "sys:user:export", + "sys:role:edit", + "sys:dept:delete", + "sys:config:update", + "sys:user:password:reset", + "sys:notice:revoke", + "sys:user:import", + "sys:user:delete", + "sys:dict_type:delete", + "sys:dict:add", + "sys:role:add", + "sys:notice:publish", + "sys:notice:delete", + "sys:dept:edit", + "sys:dict_type:edit", + "sys:user:query", + "sys:user:edit", + "sys:config:delete", + "sys:dept:add", + "sys:notice:add", + "sys:role:delete", + "sys:menu:edit", + "sys:config:query", + ], + }, + 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..04be2bf --- /dev/null +++ b/package.json @@ -0,0 +1,125 @@ +{ + "name": "vue3-element-admin", + "version": "2.21.1", + "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 --fix ./src", + "lint:prettier": "prettier --write \"**/*.{js,cjs,ts,json,tsx,css,less,scss,vue,html,md}\"", + "lint:stylelint": "stylelint \"**/*.{css,scss,vue}\" --fix", + "lint:lint-staged": "lint-staged", + "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.0.0", + "@vueuse/core": "^12.5.0", + "@wangeditor-next/editor": "^5.6.31", + "@wangeditor-next/editor-for-vue": "^5.1.14", + "axios": "^1.7.9", + "codemirror": "^5.65.18", + "codemirror-editor-vue3": "^2.8.0", + "default-passive-events": "^2.0.0", + "echarts": "^5.6.0", + "element-plus": "^2.9.3", + "exceljs": "^4.4.0", + "js-cookie": "^3.0.5", + "jsencrypt": "^3.3.2", + "lodash-es": "^4.17.21", + "nprogress": "^0.2.0", + "path-browserify": "^1.0.1", + "path-to-regexp": "^8.2.0", + "pinia": "^2.3.1", + "qs": "^6.14.0", + "sortablejs": "^1.15.6", + "vue": "^3.5.13", + "vue-i18n": "^11.1.0", + "vue-router": "^4.5.0" + }, + "devDependencies": { + "@commitlint/cli": "^19.7.1", + "@commitlint/config-conventional": "^19.7.1", + "@eslint/js": "^9.19.0", + "@types/codemirror": "^5.60.15", + "@types/lodash": "^4.17.15", + "@types/node": "^22.13.1", + "@types/nprogress": "^0.2.3", + "@types/path-browserify": "^1.0.3", + "@types/qs": "^6.9.18", + "@types/sortablejs": "^1.15.8", + "@typescript-eslint/eslint-plugin": "^8.23.0", + "@typescript-eslint/parser": "^8.23.0", + "@vitejs/plugin-vue": "^5.2.1", + "autoprefixer": "^10.4.20", + "commitizen": "^4.3.1", + "cz-git": "^1.11.0", + "eslint": "^9.19.0", + "eslint-config-prettier": "^10.0.1", + "eslint-plugin-prettier": "^5.2.3", + "eslint-plugin-vue": "^9.32.0", + "globals": "^15.14.0", + "husky": "^9.1.7", + "lint-staged": "^15.4.3", + "postcss": "^8.5.1", + "postcss-html": "^1.8.0", + "postcss-scss": "^4.0.9", + "prettier": "^3.4.2", + "sass": "^1.84.0", + "stylelint": "^16.14.1", + "stylelint-config-html": "^1.1.0", + "stylelint-config-recess-order": "^6.0.0", + "stylelint-config-recommended-scss": "^14.1.0", + "stylelint-config-recommended-vue": "^1.6.0", + "stylelint-config-standard": "^37.0.0", + "terser": "^5.38.0", + "typescript": "^5.7.3", + "typescript-eslint": "^8.23.0", + "unocss": "65.4.3", + "unplugin-auto-import": "^19.0.0", + "unplugin-vue-components": "^28.0.0", + "vite": "^6.1.0", + "vite-plugin-mock-dev-server": "^1.8.3", + "vite-plugin-svg-icons": "^2.0.1", + "vue-eslint-parser": "^9.4.3", + "vue-tsc": "^2.2.0" + }, + "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..6bc6d3c --- /dev/null +++ b/src/App.vue @@ -0,0 +1,32 @@ + + + diff --git a/src/api/auth/index.ts b/src/api/auth/index.ts new file mode 100644 index 0000000..64fb97b --- /dev/null +++ b/src/api/auth/index.ts @@ -0,0 +1,84 @@ +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: 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; +} + +/** 登录响应 */ +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/index.ts b/src/api/codegen/index.ts new file mode 100644 index 0000000..af592ba --- /dev/null +++ b/src/api/codegen/index.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: 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: 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?: number; + + /** 表名 */ + tableName?: string; + + /** 业务名 */ + businessName?: string; + + /** 模块名 */ + moduleName?: string; + + /** 包名 */ + packageName?: string; + + /** 实体名 */ + entityName?: string; + + /** 作者 */ + author?: string; + + /** 上级菜单 */ + parentMenuId?: number; + + /** 后端应用名 */ + backendAppName?: string; + /** 前端应用名 */ + frontendAppName?: string; + + /** 字段配置列表 */ + fieldConfigs?: FieldConfig[]; +} + +/** 字段配置 */ +export interface FieldConfig { + /** 主键 */ + id?: number; + + /** 列名 */ + 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/coup/index.js b/src/api/coup/index.js new file mode 100644 index 0000000..246fff7 --- /dev/null +++ b/src/api/coup/index.js @@ -0,0 +1,205 @@ +// 代客下单 +import request from "@/utils/request-php"; +import { getToken } from '@/utils/auth' +function getLoginName() { + const obj = localStorage.getItem("userInfo") || ''; + const { username } = obj ? JSON.parse(obj) : {}; + return username +} +// 抖音团购核销准备 +export function $douyin_fulfilmentcertificateprepare(data) { + return request({ + url: 'douyin/fulfilmentcertificateprepare', + method: "post", + data: { + ...data + } + }); +} +// 抖音团购核销 +export function $douyin_certificateprepare(data) { + return request({ + url: 'douyin/certificateprepare', + method: "post", + data: { + + ...data + } + }); +} + +// 抖音团购核销撤销 +export function $douyin_fulfilmentcertificatecancel(data) { + return request({ + url: 'douyin/fulfilmentcertificatecancel', + method: "post", + data: { + ...data + } + }); +} +// 抖音团购核销记录 +export function $douyin_orderlist(data) { + return request({ + url: 'douyin/orderlist', + method: "post", + data: { + + ...data + } + }); +} + + +// 抖音门店列表 +export function $douyin_storelist(data) { + return request({ + url: 'douyin/storelist', + method: "post", + data: { + + ...data + } + }); +} + +// 抖音绑定门店 +export function $douyin_bindstore(data) { + return request({ + url: 'douyin/bindstore', + method: "post", + data: { + + ...data + } + }); +} +// 抖音订单查询 + +export function $douyin_orderquery(data) { + return request({ + url: 'douyin/orderquery', + method: "post", + data: { + + ...data + } + }); +} +//会员签入 +export function $douyin_checkIn(data) { + return request({ + url: 'douyin/checkIn', + method: "post", + data: { + clientType: 'ADMIN', + token: getToken(), + loginName: getLoginName(), + + ...data + } + }); +} + +//美团 + +// 美团获取uisdk 绑定 链接 + +export function $meituan_getuisdkurl(data) { + return request({ + url: 'meituan/getuisdkurl', + method: "post", + data: { + + ...data + } + }); +} +// 美团获取uisdk 解绑 链接 + +export function $meituan_getuisdkuniurl(data) { + return request({ + url: 'meituan/getuisdkuniurl', + method: "post", + data: { + + ...data + } + }); +} +// 美团团购核销准备 + +export function $meituan_fulfilmentcertificateprepare(data) { + return request({ + url: 'meituan/fulfilmentcertificateprepare', + method: "post", + data: { + + ...data + } + }); +} +// 美团执行核销 + +export function $meituan_certificateprepare(data) { + return request({ + url: 'meituan/certificateprepare', + method: "post", + data: { + + ...data + } + }); +} +// 美团团购核销记录 + + +export function $meituan_orderlist(data) { + return request({ + url: 'meituan/orderlist', + method: "post", + data: { + + ...data + } + }); +} + +// 美团团购撤销 + + +export function $meituan_fulfilmentcertificatecancel(data) { + return request({ + url: 'meituan/fulfilmentcertificatecancel', + method: "post", + data: { + + ...data + } + }); +} + +// 美团查询绑定状态 +export function $meituan_searchstorestatus(data) { + return request({ + url: 'meituan/searchstorestatus', + method: "post", + data: { + + ...data + } + }); +} + +// 登出 +export function $logout(data) { + return request({ + url: 'user/logout', + method: "post", + data: { + + ...data + } + }); +} + diff --git a/src/api/file/index.ts b/src/api/file/index.ts new file mode 100644 index 0000000..0b10977 --- /dev/null +++ b/src/api/file/index.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: filePath }, + }); + }, + + /** + * 下载文件 + * @param url + * @param fileName + */ + download(url: string, fileName?: string) { + return request({ + url: 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/login.js b/src/api/login.js new file mode 100644 index 0000000..b2f6603 --- /dev/null +++ b/src/api/login.js @@ -0,0 +1,58 @@ +import request from "@/utils/request"; + +export function login(data) { + return request({ + url: "auth/login", + method: "post", + data, + }); +} + +export function getInfo() { + return request({ + url: "auth/info", + method: "get", + }); +} + +export function changChildShop(data) { + return request({ + url: "/api/tbShopInfo/changChildShop", + method: "post", + data, + }); +} + +export function getCodeImg(header) { + return request({ + url: "auth/code", + method: "get", + }); +} +export function getqueryChildShop(params) { + return request({ + url: "api/tbShopInfo/queryChildShop", + method: "get", + params, + }); +} + +export function logout() { + return request({ + url: "auth/logout", + method: "delete", + }); +} + +/** + * 个人中心 修改密码 + * @param {*} data + * @returns + */ +export function updatePass(data) { + return request({ + url: "/api/users/updatePass", + method: "post", + data, + }); +} diff --git a/src/api/system/config.ts b/src/api/system/config.ts new file mode 100644 index 0000000..95c1bb8 --- /dev/null +++ b/src/api/system/config.ts @@ -0,0 +1,104 @@ +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, + }); + }, + /** + * 获取系统配置表单数据 + * + * @param id ConfigID + * @returns Config表单数据 + */ + getFormData(id: number) { + return request({ + url: `${CONFIG_BASE_URL}/${id}/form`, + method: "get", + }); + }, + + /** 添加系统配置*/ + add(data: ConfigForm) { + return request({ + url: `${CONFIG_BASE_URL}`, + method: "post", + data: data, + }); + }, + + /** + * 更新系统配置 + * + * @param id ConfigID + * @param data Config表单数据 + */ + update(id: number, data: ConfigForm) { + return request({ + url: `${CONFIG_BASE_URL}/${id}`, + method: "put", + data: data, + }); + }, + + /** + * 删除系统配置 + * + * @param ids 系统配置ID + */ + deleteById(id: number) { + 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?: number; + /** 配置名称 */ + configName?: string; + /** 配置键 */ + configKey?: string; + /** 配置值 */ + configValue?: string; + /** 描述、备注 */ + remark?: string; +} + +/** 系统配置分页对象 */ +export interface ConfigPageVO { + /** 主键 */ + id?: number; + /** 配置名称 */ + configName?: string; + /** 配置键 */ + configKey?: string; + /** 配置值 */ + configValue?: string; + /** 描述、备注 */ + remark?: string; +} diff --git a/src/api/system/dept.ts b/src/api/system/dept.ts new file mode 100644 index 0000000..e3e7530 --- /dev/null +++ b/src/api/system/dept.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: number) { + return request({ + url: `${DEPT_BASE_URL}/${id}/form`, + method: "get", + }); + }, + + /** + * 新增部门 + * + * @param data 部门表单数据 + * @returns 请求结果 + */ + add(data: DeptForm) { + return request({ + url: `${DEPT_BASE_URL}`, + method: "post", + data: data, + }); + }, + + /** + * 修改部门 + * + * @param id 部门ID + * @param data 部门表单数据 + * @returns 请求结果 + */ + update(id: string, data: DeptForm) { + return request({ + url: `${DEPT_BASE_URL}/${id}`, + method: "put", + data: 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?: number; + /** 部门名称 */ + name?: string; + /** 部门编号 */ + code?: string; + /** 父部门ID */ + parentId?: number; + /** 排序 */ + 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-data.ts b/src/api/system/dict-data.ts new file mode 100644 index 0000000..412e1fe --- /dev/null +++ b/src/api/system/dict-data.ts @@ -0,0 +1,162 @@ +import request from "@/utils/request"; + +const DICT_DATA_BASE_URL = "/api/v1/dict-data"; + +const DictDataAPI = { + /** + * 获取字典分页列表 + * + * @param queryParams 查询参数 + * @returns 字典分页结果 + */ + getPage(queryParams: DictDataPageQuery) { + return request>({ + url: `${DICT_DATA_BASE_URL}/page`, + method: "get", + params: queryParams, + }); + }, + + /** + * 获取字典数据表单 + * + * @param id 字典ID + * @returns 字典数据表单 + */ + getFormData(id: number) { + return request>({ + url: `${DICT_DATA_BASE_URL}/${id}/form`, + method: "get", + }); + }, + + /** + * 新增字典数据 + * + * @param data 字典数据 + */ + add(data: DictDataForm) { + return request({ + url: `${DICT_DATA_BASE_URL}`, + method: "post", + data: data, + }); + }, + + /** + * 修改字典数据 + * + * @param id 字典ID + * @param data 字典数据 + */ + update(id: number, data: DictDataForm) { + return request({ + url: `${DICT_DATA_BASE_URL}/${id}`, + method: "put", + data: data, + }); + }, + + /** + * 删除字典 + * + * @param ids 字典ID,多个以英文逗号(,)分隔 + */ + deleteByIds(ids: string) { + return request({ + url: `${DICT_DATA_BASE_URL}/${ids}`, + method: "delete", + }); + }, + + /** + * 获取字典的数据项 + * + * @param dictCode 字典编码 + * @returns 字典数据项 + */ + getOptions(dictCode: string) { + return request({ + url: `${DICT_DATA_BASE_URL}/${dictCode}/options`, + method: "get", + }); + }, +}; + +export default DictDataAPI; + +/** + * 字典查询参数 + */ +export interface DictDataPageQuery extends PageQuery { + /** 关键字(字典数据值/标签) */ + keywords?: string; + + /** 字典编码 */ + dictCode?: string; +} + +/** + * 字典分页对象 + */ +export interface DictDataPageVO { + /** + * 字典ID + */ + id: number; + /** + * 字典编码 + */ + dictCode: string; + /** + * 字典数据值 + */ + value: string; + /** + * 字典数据标签 + */ + label: string; + /** + * 状态(1:启用,0:禁用) + */ + status: number; + /** + * 字典排序 + */ + sort?: number; +} + +/** + * 字典 + */ +export interface DictDataForm { + /** + * 字典ID + */ + id?: number; + /** + * 字典编码 + */ + dictCode?: string; + /** + * 字典数据值 + */ + value?: string; + /** + * 字典数据标签 + */ + label?: string; + /** + * 状态(1:启用,0:禁用) + */ + status?: number; + /** + * 字典排序 + */ + sort?: number; + + /** + * 标签类型 + */ + tagType?: "success" | "warning" | "info" | "primary" | "danger" | undefined; +} diff --git a/src/api/system/dict.ts b/src/api/system/dict.ts new file mode 100644 index 0000000..ed29b7d --- /dev/null +++ b/src/api/system/dict.ts @@ -0,0 +1,180 @@ +import request from "@/utils/request"; + +const DICT_BASE_URL = "/api/v1/dict"; + +const DictAPI = { + /** + * 获取字典分页列表 + * + * @param queryParams 查询参数 + * @returns 字典分页结果 + */ + getPage(queryParams: DictPageQuery) { + return request>({ + url: `${DICT_BASE_URL}/page`, + method: "get", + params: queryParams, + }); + }, + + /** + * 获取字典表单数据 + * + * @param id 字典ID + * @returns 字典表单数据 + */ + getFormData(id: number) { + return request>({ + url: `${DICT_BASE_URL}/${id}/form`, + method: "get", + }); + }, + + /** + * 新增字典 + * + * @param data 字典表单数据 + */ + add(data: DictForm) { + return request({ + url: `${DICT_BASE_URL}`, + method: "post", + data: data, + }); + }, + + /** + * 修改字典 + * + * @param id 字典ID + * @param data 字典表单数据 + */ + update(id: number, data: DictForm) { + return request({ + url: `${DICT_BASE_URL}/${id}`, + method: "put", + data: data, + }); + }, + + /** + * 删除字典 + * + * @param ids 字典ID,多个以英文逗号(,)分隔 + */ + deleteByIds(ids: string) { + return request({ + url: `${DICT_BASE_URL}/${ids}`, + method: "delete", + }); + }, + + /** + * 获取字典列表 + * + * @returns 字典列表 + */ + getList() { + return request({ + url: `${DICT_BASE_URL}/list`, + method: "get", + }); + }, +}; + +export default DictAPI; + +/** + * 字典查询参数 + */ +export interface DictPageQuery extends PageQuery { + /** + * 关键字(字典名称/编码) + */ + keywords?: string; + + /** + * 字典状态(1:启用,0:禁用) + */ + status?: number; +} + +/** + * 字典分页对象 + */ +export interface DictPageVO { + /** + * 字典ID + */ + id: number; + /** + * 字典名称 + */ + name: string; + /** + * 字典编码 + */ + dictCode: string; + /** + * 字典状态(1:启用,0:禁用) + */ + status: number; +} + +/** + * 字典 + */ +export interface DictForm { + /** + * 字典ID + */ + id?: number; + /** + * 字典名称 + */ + name?: string; + /** + * 字典编码 + */ + dictCode?: string; + /** + * 字典状态(1-启用,0-禁用) + */ + status?: number; + /** + * 备注 + */ + remark?: string; +} + +/** + * 字典数据项分页VO + * + * @description 字典数据分页对象 + */ +export interface DictVO { + /** 字典名称 */ + name: string; + + /** 字典编码 */ + dictCode: string; + + /** 字典数据集合 */ + dictDataList: DictData[]; +} + +/** + * 字典数据 + * + * @description 字典数据 + */ +export interface DictData { + /** 字典数据值 */ + value: string; + + /** 字典数据标签 */ + label: string; + + /** 标签类型 */ + tagType: string; +} diff --git a/src/api/system/log.ts b/src/api/system/log.ts new file mode 100644 index 0000000..32dbc88 --- /dev/null +++ b/src/api/system/log.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: number; + /** 日志模块 */ + 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.ts b/src/api/system/menu.ts new file mode 100644 index 0000000..a3d9b63 --- /dev/null +++ b/src/api/system/menu.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: onlyParent }, + }); + }, + + /** + * 获取菜单表单数据 + * + * @param id 菜单ID + */ + getFormData(id: string) { + return request({ + url: `${MENU_BASE_URL}/${id}/form`, + method: "get", + }); + }, + + /** + * 添加菜单 + * + * @param data 菜单表单数据 + * @returns 请求结果 + */ + add(data: MenuForm) { + return request({ + url: `${MENU_BASE_URL}`, + method: "post", + data: data, + }); + }, + + /** + * 修改菜单 + * + * @param id 菜单ID + * @param data 菜单表单数据 + * @returns 请求结果 + */ + update(id: string, data: MenuForm) { + return request({ + url: `${MENU_BASE_URL}/${id}`, + method: "put", + data: data, + }); + }, + + /** + * 删除菜单 + * + * @param id 菜单ID + * @returns 请求结果 + */ + deleteById(id: number) { + return request({ + url: `${MENU_BASE_URL}/${id}`, + method: "delete", + }); + }, +}; + +export default MenuAPI; + +import type { MenuTypeEnum } from "@/enums/MenuTypeEnum"; + +/** 菜单查询参数 */ +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.ts b/src/api/system/notice.ts new file mode 100644 index 0000000..17bb1ef --- /dev/null +++ b/src/api/system/notice.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 NoticeID + * @returns Notice表单数据 + */ + getFormData(id: number) { + return request({ + url: `${NOTICE_BASE_URL}/${id}/form`, + method: "get", + }); + }, + + /** + * 添加通知公告 + * + * @param data Notice表单数据 + * @returns + */ + add(data: NoticeForm) { + return request({ + url: `${NOTICE_BASE_URL}`, + method: "post", + data: data, + }); + }, + + /** + * 更新通知公告 + * + * @param id NoticeID + * @param data Notice表单数据 + */ + update(id: number, data: NoticeForm) { + return request({ + url: `${NOTICE_BASE_URL}/${id}`, + method: "put", + data: data, + }); + }, + + /** + * 批量删除通知公告,多个以英文逗号(,)分割 + * + * @param ids 通知公告ID字符串,多个以英文逗号(,)分割 + */ + deleteByIds(ids: string) { + return request({ + url: `${NOTICE_BASE_URL}/${ids}`, + method: "delete", + }); + }, + + /** + * 发布通知 + * + * @param id 被发布的通知公告id + * @returns + */ + publish(id: number) { + return request({ + url: `${NOTICE_BASE_URL}/${id}/publish`, + method: "put", + }); + }, + + /** + * 撤回通知 + * + * @param id 撤回的通知id + * @returns + */ + revoke(id: number) { + 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?: number; + /** 通知标题 */ + 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.ts b/src/api/system/role.ts new file mode 100644 index 0000000..cc21e34 --- /dev/null +++ b/src/api/system/role.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: number) { + return request({ + url: `${ROLE_BASE_URL}/${roleId}/menuIds`, + method: "get", + }); + }, + + /** + * 分配菜单权限 + * + * @param roleId 角色ID + * @param data 菜单ID集合 + */ + updateRoleMenus(roleId: number, data: number[]) { + return request({ + url: `${ROLE_BASE_URL}/${roleId}/menus`, + method: "put", + data: data, + }); + }, + + /** + * 获取角色表单数据 + * + * @param id 角色ID + * @returns 角色表单数据 + */ + getFormData(id: number) { + return request({ + url: `${ROLE_BASE_URL}/${id}/form`, + method: "get", + }); + }, + + /** 添加角色 */ + add(data: RoleForm) { + return request({ + url: `${ROLE_BASE_URL}`, + method: "post", + data: data, + }); + }, + + /** + * 更新角色 + * + * @param id 角色ID + * @param data 角色表单数据 + */ + update(id: number, data: RoleForm) { + return request({ + url: `${ROLE_BASE_URL}/${id}`, + method: "put", + data: 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 { + /** 角色编码 */ + code?: string; + /** 角色ID */ + id?: number; + /** 角色名称 */ + name?: string; + /** 排序 */ + sort?: number; + /** 角色状态 */ + status?: number; + /** 创建时间 */ + createTime?: Date; + /** 修改时间 */ + updateTime?: Date; +} + +/** 角色表单对象 */ +export interface RoleForm { + /** 角色ID */ + id?: number; + /** 角色编码 */ + code?: string; + /** 数据权限 */ + dataScope?: number; + /** 角色名称 */ + name?: string; + /** 排序 */ + sort?: number; + /** 角色状态(1-正常;0-停用) */ + status?: number; +} diff --git a/src/api/system/user.ts b/src/api/system/user.ts new file mode 100644 index 0000000..b58e6f5 --- /dev/null +++ b/src/api/system/user.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: number) { + return request({ + url: `${USER_BASE_URL}/${userId}/form`, + method: "get", + }); + }, + + /** + * 添加用户 + * + * @param data 用户表单数据 + */ + add(data: UserForm) { + return request({ + url: `${USER_BASE_URL}`, + method: "post", + data: data, + }); + }, + + /** + * 修改用户 + * + * @param id 用户ID + * @param data 用户表单数据 + */ + update(id: number, data: UserForm) { + return request({ + url: `${USER_BASE_URL}/${id}`, + method: "put", + data: data, + }); + }, + + /** + * 修改用户密码 + * + * @param id 用户ID + * @param password 新密码 + */ + resetPassword(id: number, password: string) { + return request({ + url: `${USER_BASE_URL}/${id}/password/reset`, + method: "put", + params: { password: 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: number, file: File) { + const formData = new FormData(); + formData.append("file", file); + return request({ + url: `${USER_BASE_URL}/import`, + method: "post", + params: { deptId: 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: data, + }); + }, + + /** 修改个人中心用户密码 */ + changePassword(data: PasswordChangeForm) { + return request({ + url: `${USER_BASE_URL}/password`, + method: "put", + data: data, + }); + }, + + /** 发送短信验证码(绑定或更换手机号)*/ + sendMobileCode(mobile: string) { + return request({ + url: `${USER_BASE_URL}/mobile/code`, + method: "post", + params: { mobile: mobile }, + }); + }, + + /** 绑定或更换手机号 */ + bindOrChangeMobile(data: MobileUpdateForm) { + return request({ + url: `${USER_BASE_URL}/mobile`, + method: "put", + data: data, + }); + }, + + /** 发送邮箱验证码(绑定或更换邮箱)*/ + sendEmailCode(email: string) { + return request({ + url: `${USER_BASE_URL}/email/code`, + method: "post", + params: { email: email }, + }); + }, + + /** 绑定或更换邮箱 */ + bindOrChangeEmail(data: EmailUpdateForm) { + return request({ + url: `${USER_BASE_URL}/email`, + method: "put", + data: data, + }); + }, + + /** + * 获取用户下拉列表 + */ + getOptions() { + return request({ + url: `${USER_BASE_URL}/options`, + method: "get", + }); + }, +}; + +export default UserAPI; + +/** 登录用户信息 */ +export interface UserInfo { + /** 用户ID */ + userId?: number; + + /** 用户名 */ + username?: string; + + /** 昵称 */ + nickname?: string; + + /** 头像URL */ + avatar?: string; + + /** 角色 */ + roles: string[]; + + /** 权限 */ + perms: string[]; +} + +/** + * 用户分页查询对象 + */ +export interface UserPageQuery extends PageQuery { + /** 搜索关键字 */ + keywords?: string; + + /** 用户状态 */ + status?: number; + + /** 部门ID */ + deptId?: number; + + /** 开始时间 */ + createTime?: [string, string]; +} + +/** 用户分页对象 */ +export interface UserPageVO { + /** 用户ID */ + id: number; + /** 用户头像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 { + /** 用户头像 */ + avatar?: string; + /** 部门ID */ + deptId?: number; + /** 邮箱 */ + email?: string; + /** 性别 */ + gender?: number; + /** 用户ID */ + id?: number; + /** 手机号 */ + mobile?: string; + /** 昵称 */ + nickname?: string; + /** 角色ID集合 */ + roleIds?: number[]; + /** 用户状态(1:正常;0:禁用) */ + status?: number; + /** 用户名 */ + username?: string; +} + +/** 个人中心用户信息 */ +export interface UserProfileVO { + /** 用户ID */ + id?: number; + + /** 用户名 */ + username?: string; + + /** 昵称 */ + nickname?: string; + + /** 头像URL */ + avatar?: string; + + /** 性别 */ + gender?: number; + + /** 手机号 */ + mobile?: string; + + /** 邮箱 */ + email?: string; + + /** 部门名称 */ + deptName?: string; + + /** 角色名称,多个使用英文逗号(,)分割 */ + roleNames?: string; + + /** 创建时间 */ + createTime?: Date; +} + +/** 个人中心用户信息表单 */ +export interface UserProfileForm { + /** 用户ID */ + id?: number; + + /** 用户名 */ + 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/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/data_statistics.svg b/src/assets/icons/data_statistics.svg new file mode 100644 index 0000000..74a7adf --- /dev/null +++ b/src/assets/icons/data_statistics.svg @@ -0,0 +1 @@ + \ No newline at end of file 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/1024.png b/src/assets/images/1024.png new file mode 100644 index 0000000..716381b Binary files /dev/null and b/src/assets/images/1024.png differ 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/avatar.png b/src/assets/images/avatar.png new file mode 100644 index 0000000..997732a Binary files /dev/null and b/src/assets/images/avatar.png differ diff --git a/src/assets/images/background.webp b/src/assets/images/background.webp new file mode 100644 index 0000000..3ad73c8 Binary files /dev/null and b/src/assets/images/background.webp differ diff --git a/src/assets/images/background_img.jpg b/src/assets/images/background_img.jpg new file mode 100644 index 0000000..5d5644d Binary files /dev/null and b/src/assets/images/background_img.jpg differ diff --git a/src/assets/images/data_home_bg1.png b/src/assets/images/data_home_bg1.png new file mode 100644 index 0000000..3034319 Binary files /dev/null and b/src/assets/images/data_home_bg1.png differ diff --git a/src/assets/images/data_home_item1.png b/src/assets/images/data_home_item1.png new file mode 100644 index 0000000..082564d Binary files /dev/null and b/src/assets/images/data_home_item1.png differ diff --git a/src/assets/images/data_home_item1_icon.png b/src/assets/images/data_home_item1_icon.png new file mode 100644 index 0000000..493c506 Binary files /dev/null and b/src/assets/images/data_home_item1_icon.png differ diff --git a/src/assets/images/data_home_item2.png b/src/assets/images/data_home_item2.png new file mode 100644 index 0000000..0b9a553 Binary files /dev/null and b/src/assets/images/data_home_item2.png differ diff --git a/src/assets/images/data_home_item2_icon.png b/src/assets/images/data_home_item2_icon.png new file mode 100644 index 0000000..1f0cb4e Binary files /dev/null and b/src/assets/images/data_home_item2_icon.png differ diff --git a/src/assets/images/data_home_item3.png b/src/assets/images/data_home_item3.png new file mode 100644 index 0000000..e2f257b Binary files /dev/null and b/src/assets/images/data_home_item3.png differ diff --git a/src/assets/images/data_home_item3_icon.png b/src/assets/images/data_home_item3_icon.png new file mode 100644 index 0000000..7cc6781 Binary files /dev/null and b/src/assets/images/data_home_item3_icon.png differ diff --git a/src/assets/images/data_home_item4.png b/src/assets/images/data_home_item4.png new file mode 100644 index 0000000..097c19a Binary files /dev/null and b/src/assets/images/data_home_item4.png differ diff --git a/src/assets/images/data_home_item4_icon.png b/src/assets/images/data_home_item4_icon.png new file mode 100644 index 0000000..01920f3 Binary files /dev/null and b/src/assets/images/data_home_item4_icon.png differ diff --git a/src/assets/images/default_logo.png b/src/assets/images/default_logo.png new file mode 100644 index 0000000..e79c156 Binary files /dev/null and b/src/assets/images/default_logo.png differ diff --git a/src/assets/images/home/data_forms1.png b/src/assets/images/home/data_forms1.png new file mode 100644 index 0000000..56ae797 Binary files /dev/null and b/src/assets/images/home/data_forms1.png differ diff --git a/src/assets/images/home/data_forms2.png b/src/assets/images/home/data_forms2.png new file mode 100644 index 0000000..8375bad Binary files /dev/null and b/src/assets/images/home/data_forms2.png differ diff --git a/src/assets/images/home/data_forms3.png b/src/assets/images/home/data_forms3.png new file mode 100644 index 0000000..934632f Binary files /dev/null and b/src/assets/images/home/data_forms3.png differ diff --git a/src/assets/images/home/data_forms4.png b/src/assets/images/home/data_forms4.png new file mode 100644 index 0000000..04b65ac Binary files /dev/null and b/src/assets/images/home/data_forms4.png differ diff --git a/src/assets/images/img_download_error.png b/src/assets/images/img_download_error.png new file mode 100644 index 0000000..9bc9660 Binary files /dev/null and b/src/assets/images/img_download_error.png differ diff --git a/src/assets/images/login-bg-dark.jpg b/src/assets/images/login-bg-dark.jpg new file mode 100644 index 0000000..50dc817 Binary files /dev/null and b/src/assets/images/login-bg-dark.jpg differ diff --git a/src/assets/images/login-bg.jpg b/src/assets/images/login-bg.jpg new file mode 100644 index 0000000..993b958 Binary files /dev/null and b/src/assets/images/login-bg.jpg differ diff --git a/src/assets/images/logo.png b/src/assets/images/logo.png new file mode 100644 index 0000000..452fdc0 Binary files /dev/null and b/src/assets/images/logo.png differ diff --git a/src/assets/images/perpole.png b/src/assets/images/perpole.png new file mode 100644 index 0000000..f8ddfb1 Binary files /dev/null and b/src/assets/images/perpole.png differ diff --git a/src/assets/images/scan.png b/src/assets/images/scan.png new file mode 100644 index 0000000..8cb3dca Binary files /dev/null and b/src/assets/images/scan.png differ diff --git a/src/assets/images/shalou.png b/src/assets/images/shalou.png new file mode 100644 index 0000000..46cd083 Binary files /dev/null and b/src/assets/images/shalou.png differ diff --git a/src/assets/images/shop_editor_bg.png b/src/assets/images/shop_editor_bg.png new file mode 100644 index 0000000..da3a58a Binary files /dev/null and b/src/assets/images/shop_editor_bg.png differ diff --git a/src/assets/images/shouye.jpeg b/src/assets/images/shouye.jpeg new file mode 100644 index 0000000..4bb0d9f Binary files /dev/null and b/src/assets/images/shouye.jpeg differ diff --git a/src/assets/images/upload.png b/src/assets/images/upload.png new file mode 100644 index 0000000..e2a27e6 Binary files /dev/null and b/src/assets/images/upload.png differ 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..b97aacf --- /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..33b71d8 --- /dev/null +++ b/src/components/Breadcrumb/index.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/src/components/CURD/PageContent.vue b/src/components/CURD/PageContent.vue new file mode 100644 index 0000000..e8a408f --- /dev/null +++ b/src/components/CURD/PageContent.vue @@ -0,0 +1,976 @@ + + + + + diff --git a/src/components/CURD/PageForm.vue b/src/components/CURD/PageForm.vue new file mode 100644 index 0000000..199f404 --- /dev/null +++ b/src/components/CURD/PageForm.vue @@ -0,0 +1,156 @@ + + + diff --git a/src/components/CURD/PageModal.vue b/src/components/CURD/PageModal.vue new file mode 100644 index 0000000..87465d6 --- /dev/null +++ b/src/components/CURD/PageModal.vue @@ -0,0 +1,377 @@ + + + + + diff --git a/src/components/CURD/PageSearch.vue b/src/components/CURD/PageSearch.vue new file mode 100644 index 0000000..3b218de --- /dev/null +++ b/src/components/CURD/PageSearch.vue @@ -0,0 +1,239 @@ + + + + + diff --git a/src/components/CURD/types.ts b/src/components/CURD/types.ts new file mode 100644 index 0000000..7ed66ed --- /dev/null +++ b/src/components/CURD/types.ts @@ -0,0 +1,272 @@ +import type { + DialogProps, + DrawerProps, + FormItemRule, + FormProps, + PaginationProps, + TableProps, + ColProps, +} from "element-plus"; +import type PageContent from "./PageContent.vue"; +import type PageForm from "./PageForm.vue"; +import type PageModal from "./PageModal.vue"; +import type PageSearch from "./PageSearch.vue"; + +export type PageSearchInstance = InstanceType; +export type PageContentInstance = InstanceType; +export type PageModalInstance = InstanceType; +export type PageFormInstance = InstanceType; + +export type IObject = Record; + +export interface IOperatData { + name: string; + row: IObject; + column: IObject; + $index: number; +} + +export interface ISearchConfig { + // 页面名称(参与组成权限标识,如sys:user:xxx) + pageName: string; + // 表单项 + formItems: Array<{ + // 组件类型(如input,select等) + type?: "input" | "select" | "tree-select" | "date-picker" | "input-tag"; + // 标签文本 + label: string; + // 标签提示 + tips?: string; + // 键名 + prop: string; + // 组件属性(input-tag组件支持join,btnText,size属性) + attrs?: IObject; + // 初始值 + initialValue?: any; + // 可选项(适用于select组件) + options?: { label: string; value: any }[]; + // 初始化数据函数扩展 + initFn?: (formItem: IObject) => void; + }>; + // 是否开启展开和收缩 + isExpandable?: boolean; + // 默认展示的表单项数量 + showNumber?: number; +} + +export interface IContentConfig { + // 页面名称(参与组成权限标识,如sys:user:xxx) + pageName: string; + // table组件属性 + table?: Omit, "data">; + // 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< + | "add" + | "delete" + | "import" + | "export" + | { + auth: string; + icon?: string; + name: string; + text: string; + type?: "primary" | "success" | "warning" | "danger" | "info"; + } + >; + // 表格工具栏右侧图标 + defaultToolbar?: Array< + | "refresh" + | "filter" + | "imports" + | "exports" + | "search" + | { + name: string; + icon: string; + title?: string; + auth?: string; + } + >; + // 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< + | "edit" + | "delete" + | { + auth?: string; + icon?: string; + name: string; + text: string; + type?: "primary" | "success" | "warning" | "danger" | "info"; + render?: (row: IObject) => boolean; + } + >; + // filter值拼接符 + filterJoin?: string; + [key: string]: any; + // 初始化数据函数 + initFn?: (item: IObject) => void; + }>; +} + +export interface IModalConfig { + // 页面名称 + pageName?: string; + // 主键名(主要用于编辑数据,默认为id) + pk?: string; + // 组件类型 + 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等,默认input) + type?: + | "input" + | "select" + | "radio" + | "switch" + | "checkbox" + | "tree-select" + | "date-picker" + | "input-number" + | "text" + | "custom"; + // 组件属性 + attrs?: IObject; + // 组件可选项(适用于select,radio,checkbox组件) + options?: Array<{ + label: string; + value: any; + disabled?: boolean; + [key: string]: any; + }>; + // 插槽名(适用于组件类型为custom) + slotName?: string; + // 标签文本 + label: string; + // 标签提示 + tips?: string; + // 键名 + prop: string; + // 验证规则 + rules?: FormItemRule[]; + // 初始值 + initialValue?: any; + // 是否隐藏 + hidden?: boolean; + // layout组件Col属性 + col?: Partial; + // 监听函数 + watch?: (newValue: any, oldValue: any, data: T, items: IObject[]) => void; + // 计算属性函数 + computed?: (data: T) => any; + // 监听收集函数 + watchEffect?: (data: T) => 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..d0fa009 --- /dev/null +++ b/src/components/CURD/usePage.ts @@ -0,0 +1,68 @@ +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() { + //显示添加表单 + addModalRef.value?.setModalVisible(); + } + // 编辑 + function handleEditClick(row: IObject) { + //显示编辑表单 根据数据进行填充 + editModalRef.value?.setModalVisible(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, + handleSubmitClick, + handleExportClick, + handleSearchClick, + handleFilterChange, + }; +} + +export default usePage; 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/Dict/DictLabel.vue b/src/components/Dict/DictLabel.vue new file mode 100644 index 0000000..fd05131 --- /dev/null +++ b/src/components/Dict/DictLabel.vue @@ -0,0 +1,52 @@ + + + diff --git a/src/components/Dict/index.vue b/src/components/Dict/index.vue new file mode 100644 index 0000000..f17b38a --- /dev/null +++ b/src/components/Dict/index.vue @@ -0,0 +1,140 @@ + + + diff --git a/src/components/Fullscreen/index.vue b/src/components/Fullscreen/index.vue new file mode 100644 index 0000000..bd85b4b --- /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..1c0642a --- /dev/null +++ b/src/components/Hamburger/index.vue @@ -0,0 +1,37 @@ + + + + + + diff --git a/src/components/IconSelect/index.vue b/src/components/IconSelect/index.vue new file mode 100644 index 0000000..006158a --- /dev/null +++ b/src/components/IconSelect/index.vue @@ -0,0 +1,207 @@ + + + + + diff --git a/src/components/LangSelect/index.vue b/src/components/LangSelect/index.vue new file mode 100644 index 0000000..2f35582 --- /dev/null +++ b/src/components/LangSelect/index.vue @@ -0,0 +1,47 @@ + + + diff --git a/src/components/MenuSearch/index.vue b/src/components/MenuSearch/index.vue new file mode 100644 index 0000000..7c2787a --- /dev/null +++ b/src/components/MenuSearch/index.vue @@ -0,0 +1,223 @@ + + + + + diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue new file mode 100644 index 0000000..3a7e53d --- /dev/null +++ b/src/components/Pagination/index.vue @@ -0,0 +1,92 @@ + + + + + diff --git a/src/components/SizeSelect/index.vue b/src/components/SizeSelect/index.vue new file mode 100644 index 0000000..6ab38f7 --- /dev/null +++ b/src/components/SizeSelect/index.vue @@ -0,0 +1,42 @@ + + + diff --git a/src/components/SvgIcon/index.vue b/src/components/SvgIcon/index.vue new file mode 100644 index 0000000..0fdd735 --- /dev/null +++ b/src/components/SvgIcon/index.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/src/components/TableSelect/index.vue b/src/components/TableSelect/index.vue new file mode 100644 index 0000000..54fc763 --- /dev/null +++ b/src/components/TableSelect/index.vue @@ -0,0 +1,357 @@ + + + + + diff --git a/src/components/Upload/FileUpload.vue b/src/components/Upload/FileUpload.vue new file mode 100644 index 0000000..15cacd6 --- /dev/null +++ b/src/components/Upload/FileUpload.vue @@ -0,0 +1,237 @@ + + + + diff --git a/src/components/Upload/MultiImageUpload.vue b/src/components/Upload/MultiImageUpload.vue new file mode 100644 index 0000000..6dc39b3 --- /dev/null +++ b/src/components/Upload/MultiImageUpload.vue @@ -0,0 +1,216 @@ + + + + diff --git a/src/components/Upload/SingleImageUpload.vue b/src/components/Upload/SingleImageUpload.vue new file mode 100644 index 0000000..3ce77c7 --- /dev/null +++ b/src/components/Upload/SingleImageUpload.vue @@ -0,0 +1,203 @@ + + + + + + diff --git a/src/components/WangEditor/index.vue b/src/components/WangEditor/index.vue new file mode 100644 index 0000000..883e23c --- /dev/null +++ b/src/components/WangEditor/index.vue @@ -0,0 +1,90 @@ + + + + + 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..6dd2995 --- /dev/null +++ b/src/directive/permission/index.ts @@ -0,0 +1,64 @@ +import type { Directive, DirectiveBinding } from "vue"; + +import { useUserStore } from "@/store"; + +/** + * 按钮权限 + */ +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("ROOT")) { + 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/DeviceEnum.ts b/src/enums/DeviceEnum.ts new file mode 100644 index 0000000..709bcb3 --- /dev/null +++ b/src/enums/DeviceEnum.ts @@ -0,0 +1,14 @@ +/** + * 设备枚举 + */ +export const enum DeviceEnum { + /** + * 宽屏设备 + */ + DESKTOP = "desktop", + + /** + * 窄屏设备 + */ + MOBILE = "mobile", +} diff --git a/src/enums/FormTypeEnum.ts b/src/enums/FormTypeEnum.ts new file mode 100644 index 0000000..96c5462 --- /dev/null +++ b/src/enums/FormTypeEnum.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/LanguageEnum.ts b/src/enums/LanguageEnum.ts new file mode 100644 index 0000000..a50b655 --- /dev/null +++ b/src/enums/LanguageEnum.ts @@ -0,0 +1,14 @@ +/** + * 语言枚举 + */ +export const enum LanguageEnum { + /** + * 中文 + */ + ZH_CN = "zh-cn", + + /** + * 英文 + */ + EN = "en", +} diff --git a/src/enums/LayoutEnum.ts b/src/enums/LayoutEnum.ts new file mode 100644 index 0000000..68be72e --- /dev/null +++ b/src/enums/LayoutEnum.ts @@ -0,0 +1,18 @@ +/** + * 菜单布局枚举 + */ +export const enum LayoutEnum { + /** + * 左侧菜单布局 + */ + LEFT = "left", + /** + * 顶部菜单布局 + */ + TOP = "top", + + /** + * 混合菜单布局 + */ + MIX = "mix", +} diff --git a/src/enums/MenuTypeEnum.ts b/src/enums/MenuTypeEnum.ts new file mode 100644 index 0000000..b69942f --- /dev/null +++ b/src/enums/MenuTypeEnum.ts @@ -0,0 +1,22 @@ +/** + * 菜单类型枚举 + */ +export const enum MenuTypeEnum { + /** + * 目录 + */ + CATALOG = "CATALOG", + /** + * 菜单 + */ + MENU = "MENU", + + /** + * 按钮 + */ + BUTTON = "BUTTON", + /** + * 外链 + */ + EXTLINK = "EXTLINK", +} diff --git a/src/enums/QueryTypeEnum.ts b/src/enums/QueryTypeEnum.ts new file mode 100644 index 0000000..253efc0 --- /dev/null +++ b/src/enums/QueryTypeEnum.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/ResultEnum.ts b/src/enums/ResultEnum.ts new file mode 100644 index 0000000..349a628 --- /dev/null +++ b/src/enums/ResultEnum.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/SidebarStatusEnum.ts b/src/enums/SidebarStatusEnum.ts new file mode 100644 index 0000000..a0d877a --- /dev/null +++ b/src/enums/SidebarStatusEnum.ts @@ -0,0 +1,14 @@ +/** + * 侧边栏状态枚举 + */ +export const enum SidebarStatusEnum { + /** + * 展开 + */ + OPENED = "opened", + + /** + * 关闭 + */ + CLOSED = "closed", +} diff --git a/src/enums/SizeEnum.ts b/src/enums/SizeEnum.ts new file mode 100644 index 0000000..e91e913 --- /dev/null +++ b/src/enums/SizeEnum.ts @@ -0,0 +1,19 @@ +/** + * 布局大小枚举 + */ +export const enum SizeEnum { + /** + * 默认 + */ + DEFAULT = "default", + + /** + * 大型 + */ + LARGE = "large", + + /** + * 小型 + */ + SMALL = "small", +} diff --git a/src/enums/ThemeEnum.ts b/src/enums/ThemeEnum.ts new file mode 100644 index 0000000..91458e1 --- /dev/null +++ b/src/enums/ThemeEnum.ts @@ -0,0 +1,18 @@ +/** + * 主题枚举 + */ +export const enum ThemeEnum { + /** + * 明亮主题 + */ + LIGHT = "light", + /** + * 暗黑主题 + */ + DARK = "dark", + + /** + * 系统自动 + */ + AUTO = "auto", +} diff --git a/src/lang/index.ts b/src/lang/index.ts new file mode 100644 index 0000000..ec3e6cc --- /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"; +// 本地语言包 +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: 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..3b06212 --- /dev/null +++ b/src/lang/package/en.ts @@ -0,0 +1,62 @@ +export default { + // 菜单国际化 + route: { + dashboard: "Dashboard", + document: "Document", + }, + // 登录页面国际化 + login: { + 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", + }, + captchaCode: { + required: "Please enter Verify Code", + }, + }, + otherLoginMethods: "Other login methods", + }, + // 导航栏国际化 + 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", + tagsView: "Tags View", + sidebarLogo: "Sidebar Logo", + watermark: "Watermark", + }, +}; diff --git a/src/lang/package/zh-cn.ts b/src/lang/package/zh-cn.ts new file mode 100644 index 0000000..0b48e4a --- /dev/null +++ b/src/lang/package/zh-cn.ts @@ -0,0 +1,62 @@ +export default { + // 菜单国际化 + route: { + dashboard: "首页", + document: "项目文档", + }, + // 登录页面国际化 + login: { + username: "用户名", + password: "密码", + login: "登 录", + captchaCode: "验证码", + capsLock: "大写锁定已打开", + rememberMe: "记住我", + forgetPassword: "忘记密码", + message: { + username: { + required: "请输入用户名", + }, + password: { + required: "请输入密码", + min: "密码不能少于6位", + }, + captchaCode: { + required: "请输入验证码", + }, + }, + otherLoginMethods: "其他登录方式", + }, + // 导航栏国际化 + navbar: { + dashboard: "首页", + logout: "注销登出", + document: "项目文档", + gitee: "项目地址", + profile: "个人中心", + }, + sizeSelect: { + tooltip: "布局大小", + default: "默认", + large: "大型", + small: "小型", + message: { + success: "切换布局大小成功!", + }, + }, + langSelect: { + message: { + success: "切换语言成功!", + }, + }, + settings: { + project: "项目配置", + theme: "主题设置", + interface: "界面设置", + navigation: "导航设置", + themeColor: "主题颜色", + tagsView: "开启 Tags-View", + sidebarLogo: "侧边栏 Logo", + watermark: "开启水印", + }, +}; diff --git a/src/layout/components/AppMain/index.vue b/src/layout/components/AppMain/index.vue new file mode 100644 index 0000000..1386267 --- /dev/null +++ b/src/layout/components/AppMain/index.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/src/layout/components/HeaderTop/index.vue b/src/layout/components/HeaderTop/index.vue new file mode 100644 index 0000000..5020254 --- /dev/null +++ b/src/layout/components/HeaderTop/index.vue @@ -0,0 +1,34 @@ + + + \ No newline at end of file diff --git a/src/layout/components/NavBar/components/NavbarRight.vue b/src/layout/components/NavBar/components/NavbarRight.vue new file mode 100644 index 0000000..d6713d1 --- /dev/null +++ b/src/layout/components/NavBar/components/NavbarRight.vue @@ -0,0 +1,78 @@ + + + + diff --git a/src/layout/components/NavBar/components/Notification.vue b/src/layout/components/NavBar/components/Notification.vue new file mode 100644 index 0000000..aed67a3 --- /dev/null +++ b/src/layout/components/NavBar/components/Notification.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/src/layout/components/NavBar/components/UserProfile.vue b/src/layout/components/NavBar/components/UserProfile.vue new file mode 100644 index 0000000..9529065 --- /dev/null +++ b/src/layout/components/NavBar/components/UserProfile.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/src/layout/components/NavBar/index.vue b/src/layout/components/NavBar/index.vue new file mode 100644 index 0000000..ae875e9 --- /dev/null +++ b/src/layout/components/NavBar/index.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/src/layout/components/Settings/components/LayoutSelect.vue b/src/layout/components/Settings/components/LayoutSelect.vue new file mode 100644 index 0000000..ff8fb1a --- /dev/null +++ b/src/layout/components/Settings/components/LayoutSelect.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/src/layout/components/Settings/components/ThemeColorPicker.vue b/src/layout/components/Settings/components/ThemeColorPicker.vue new file mode 100644 index 0000000..587c1ac --- /dev/null +++ b/src/layout/components/Settings/components/ThemeColorPicker.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/src/layout/components/Settings/index.vue b/src/layout/components/Settings/index.vue new file mode 100644 index 0000000..edc7a0d --- /dev/null +++ b/src/layout/components/Settings/index.vue @@ -0,0 +1,136 @@ + + + + + diff --git a/src/layout/components/Sidebar/components/SidebarLogo.vue b/src/layout/components/Sidebar/components/SidebarLogo.vue new file mode 100644 index 0000000..b877207 --- /dev/null +++ b/src/layout/components/Sidebar/components/SidebarLogo.vue @@ -0,0 +1,53 @@ + + + + + diff --git a/src/layout/components/Sidebar/components/SidebarMenu.vue b/src/layout/components/Sidebar/components/SidebarMenu.vue new file mode 100644 index 0000000..5664e42 --- /dev/null +++ b/src/layout/components/Sidebar/components/SidebarMenu.vue @@ -0,0 +1,113 @@ + + + + diff --git a/src/layout/components/Sidebar/components/SidebarMenuItem.vue b/src/layout/components/Sidebar/components/SidebarMenuItem.vue new file mode 100644 index 0000000..8703d62 --- /dev/null +++ b/src/layout/components/Sidebar/components/SidebarMenuItem.vue @@ -0,0 +1,204 @@ + + + + + diff --git a/src/layout/components/Sidebar/components/SidebarMenuItemTitle.vue b/src/layout/components/Sidebar/components/SidebarMenuItemTitle.vue new file mode 100644 index 0000000..d3cf87d --- /dev/null +++ b/src/layout/components/Sidebar/components/SidebarMenuItemTitle.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue b/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue new file mode 100644 index 0000000..3e42176 --- /dev/null +++ b/src/layout/components/Sidebar/components/SidebarMixTopMenu.vue @@ -0,0 +1,91 @@ + + + + diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue new file mode 100644 index 0000000..2cfcd72 --- /dev/null +++ b/src/layout/components/Sidebar/index.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue new file mode 100644 index 0000000..0e1ce48 --- /dev/null +++ b/src/layout/components/TagsView/index.vue @@ -0,0 +1,442 @@ + + + + + diff --git a/src/layout/index.vue b/src/layout/index.vue new file mode 100644 index 0000000..3aca7bb --- /dev/null +++ b/src/layout/index.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..60d7936 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,19 @@ +import { createApp } from "vue"; +import App from "./App.vue"; +import setupPlugins from "@/plugins"; + +// 本地SVG图标 +import "virtual:svg-icons-register"; +// 暗黑主题样式 +import "element-plus/theme-chalk/dark/css-vars.css"; +// 暗黑模式自定义变量 +import "@/styles/dark/css-vars.css"; +import "@/styles/index.scss"; +import "uno.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..df853d8 --- /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 webSocketManager from "@/utils/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 + webSocketManager.setupWebSocket(); + // 注册 CodeMirror + app.use(InstallCodeMirror); + }, +}; diff --git a/src/plugins/permission.ts b/src/plugins/permission.ts new file mode 100644 index 0000000..169174b --- /dev/null +++ b/src/plugins/permission.ts @@ -0,0 +1,88 @@ +import type { NavigationGuardNext, RouteLocationNormalized, RouteRecordRaw } from "vue-router"; +import NProgress from "@/utils/nprogress"; +import { getToken } from "@/utils/auth"; +import router from "@/router"; +import { usePermissionStore, useUserStore } from "@/store"; + +export function setupPermission() { + // 白名单路由 + const whiteList = ["/login"]; + + router.beforeEach(async (to, from, next) => { + NProgress.start(); + + const isLogin = !!getToken(); // 判断是否登录 + if (isLogin) { + if (to.path === "/login") { + // 已登录,访问登录页,跳转到首页 + next({ path: "/" }); + } else { + const permissionStore = usePermissionStore(); + // 判断路由是否加载完成 + if (permissionStore.isRoutesLoaded) { + if (to.matched.length === 0) { + // 路由未匹配,跳转到404 + next("/404"); + } else { + // 动态设置页面标题 + const title = (to.params.title as string) || (to.query.title as string); + if (title) { + to.meta.title = title; + } + next(); + } + } else { + try { + // 生成动态路由 + const dynamicRoutes = await permissionStore.generateRoutes(); + dynamicRoutes.forEach((route: RouteRecordRaw) => router.addRoute(route)); + next({ ...to, replace: true }); + } catch (error) { + console.error(error); + // 路由加载失败,重置 token 并重定向到登录页 + await useUserStore().clearUserData(); + redirectToLogin(to, next); + NProgress.done(); + } + } + } + } else { + next(); + // // 未登录,判断是否在白名单中 + // if (whiteList.includes(to.path)) { + // } else { + // // 不在白名单,重定向到登录页 + // redirectToLogin(to, next); + // NProgress.done(); + // } + } + }); + + // 后置守卫,保证每次路由跳转结束时关闭进度条 + router.afterEach(() => { + 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; + 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("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/router/index.ts b/src/router/index.ts new file mode 100644 index 0000000..1ff86ea --- /dev/null +++ b/src/router/index.ts @@ -0,0 +1,84 @@ +import type { App } from "vue"; +import { createRouter, createWebHashHistory, type RouteRecordRaw } from "vue-router"; + +export const Layout = () => import("@/layout/index.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: "/", + component: Layout, + redirect: "/index", + meta: { + title: "数据统计", + icon: "data_statistics", + }, + children: [ + { + path: "index", + component: () => import("@/views/data/index.vue"), + name: "index", + meta: { + title: "数据统计", + affix: false, + keepAlive: true, + }, + }, + { + path: "sales", + name: "sales", + component: () => import("@/views/data/sales.vue"), + meta: { + title: "销售统计", + affix: false, + keepAlive: true, + }, + }, + { + path: "401", + component: () => import("@/views/error/401.vue"), + meta: { hidden: true }, + }, + { + path: "404", + component: () => import("@/views/error/404.vue"), + meta: { 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..6024479 --- /dev/null +++ b/src/settings.ts @@ -0,0 +1,38 @@ +import { SizeEnum } from "./enums/SizeEnum"; +import { LayoutEnum } from "./enums/LayoutEnum"; +import { ThemeEnum } from "./enums/ThemeEnum"; +import { LanguageEnum } from "./enums/LanguageEnum"; + +const { pkg } = __APP_INFO__; + +// 检查用户的操作系统是否使用深色模式 +const mediaQueryList = window.matchMedia("(prefers-color-scheme: dark)"); + +const defaultSettings: AppSettings = { + // 系统Title + title: pkg.name, + // 系统版本 + version: pkg.version, + // 是否显示设置 + showSettings: true, + // 是否显示标签视图 + tagsView: true, + // 是否显示侧边栏Logo + sidebarLogo: true, + // 布局方式,默认为左侧布局 + layout: LayoutEnum.LEFT, + // 主题,根据操作系统的色彩方案自动选择 + theme: mediaQueryList.matches ? ThemeEnum.DARK : ThemeEnum.LIGHT, + // 组件大小 default | medium | small | large + size: SizeEnum.DEFAULT, + // 语言 + language: LanguageEnum.ZH_CN, + // 主题颜色 + themeColor: "#4080FF", + // 是否开启水印 + watermarkEnabled: false, + // 水印内容 + watermarkContent: pkg.name, +}; + +export default defaultSettings; diff --git a/src/store/index.ts b/src/store/index.ts new file mode 100644 index 0000000..6c0115a --- /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"; +export * from "./modules/permission"; +export * from "./modules/settings"; +export * from "./modules/tags-view"; +export * from "./modules/user"; +export * from "./modules/dict"; +export { store }; diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts new file mode 100644 index 0000000..6bf9a60 --- /dev/null +++ b/src/store/modules/app.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/DeviceEnum"; +import { SidebarStatusEnum } from "@/enums/SidebarStatusEnum"; + +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", SidebarStatusEnum.CLOSED); + const sidebar = reactive({ + opened: sidebarStatus.value === SidebarStatusEnum.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 ? SidebarStatusEnum.OPENED : SidebarStatusEnum.CLOSED; + } + + // 关闭侧边栏 + function closeSideBar() { + sidebar.opened = false; + sidebarStatus.value = SidebarStatusEnum.CLOSED; + } + + // 打开侧边栏 + function openSideBar() { + sidebar.opened = true; + sidebarStatus.value = SidebarStatusEnum.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.ts b/src/store/modules/dict.ts new file mode 100644 index 0000000..f87ec5b --- /dev/null +++ b/src/store/modules/dict.ts @@ -0,0 +1,41 @@ +import { store } from "@/store"; +import DictionaryAPI, { type DictVO, type DictData } from "@/api/system/dict"; + +export const useDictStore = defineStore("dict", () => { + const dictionary = useStorage>("dictionary", {}); + + const setDictionary = (dict: DictVO) => { + dictionary.value[dict.dictCode] = dict.dictDataList; + }; + + const loadDictionaries = async () => { + const dictList = await DictionaryAPI.getList(); + dictList.forEach(setDictionary); + }; + + const getDictionary = (dictCode: string): DictData[] => { + return dictionary.value[dictCode] || []; + }; + + const clearDictionaryCache = () => { + dictionary.value = {}; + }; + + const updateDictionaryCache = async () => { + clearDictionaryCache(); // 先清除旧缓存 + await loadDictionaries(); // 重新加载最新字典数据 + }; + + return { + dictionary, + setDictionary, + loadDictionaries, + getDictionary, + clearDictionaryCache, + updateDictionaryCache, + }; +}); + +export function useDictStoreHook() { + return useDictStore(store); +} diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts new file mode 100644 index 0000000..14558bf --- /dev/null +++ b/src/store/modules/permission.ts @@ -0,0 +1,116 @@ +import type { RouteRecordRaw } from "vue-router"; +import { constantRoutes } from "@/router"; +import { store } from "@/store"; +import router from "@/router"; + +import MenuAPI, { type RouteVO } from "@/api/system/menu"; +const modules = import.meta.glob("../../views/**/**.vue"); +const Layout = () => import("@/layout/index.vue"); + +export const usePermissionStore = defineStore("permission", () => { + // 储所有路由,包括静态路由和动态路由 + const routes = ref(constantRoutes); + console.log(router); + // 混合模式左侧菜单路由 + const mixedLayoutLeftRoutes = ref([]); + // 路由是否加载完成 + const isRoutesLoaded = ref(false); + + /** + * 获取后台动态路由数据,解析并注册到全局路由 + * + * @returns Promise 解析后的动态路由列表 + */ + function generateRoutes() { + return new Promise((resolve, reject) => { + MenuAPI.getRoutes() + .then((data) => { + const dynamicRoutes = parseDynamicRoutes(data); + routes.value = [...constantRoutes, ...dynamicRoutes]; + isRoutesLoaded.value = true; + resolve(dynamicRoutes); + }) + .catch((error) => { + reject(error); + }); + }); + } + + /** + * 根据父菜单路径设置混合模式左侧菜单 + * + * @param parentPath 父菜单的路径,用于查找对应的菜单项 + */ + const setMixedLayoutLeftRoutes = (parentPath: string) => { + const matchedItem = routes.value.find((item) => item.path === parentPath); + if (matchedItem && matchedItem.children) { + mixedLayoutLeftRoutes.value = matchedItem.children; + } + }; + + /** + * 重置路由 + */ + const resetRouter = () => { + // 清空本地存储的路由和菜单数据 + routes.value = []; + mixedLayoutLeftRoutes.value = []; + // 从 Vue Router 中移除所有动态注册的路由 + router.getRoutes().forEach((route) => { + if (route.name) { + router.removeRoute(route.name); + } + }); + isRoutesLoaded.value = false; + }; + + return { + routes, + mixedLayoutLeftRoutes, + isRoutesLoaded, + generateRoutes, + setMixedLayoutLeftRoutes, + resetRouter, + }; +}); + +/** + * 解析后端返回的路由数据并转换为 Vue Router 兼容的路由配置 + * + * 1. 遍历 `rawRoutes` 并转换为 `RouteRecordRaw` 格式。 + * 2. 若 `component` 为 `"Layout"`,则替换为 `Layout` 组件。 + * 3. 若 `component` 为字符串路径,则动态加载对应的 Vue 组件,找不到则默认 `404.vue`。 + * 4. 递归解析 `children`,确保子路由也被正确转换。 + * + * @param rawRoutes 后端返回的原始路由数据 + * @returns 解析后的路由配置数组 + */ +const parseDynamicRoutes = (rawRoutes: RouteVO[]): 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; +}; +/** + * 在组件外使用 Pinia store 实例 @see https://pinia.vuejs.org/core-concepts/outside-component-usage.html + */ +export function usePermissionStoreHook() { + return usePermissionStore(store); +} diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts new file mode 100644 index 0000000..025d2df --- /dev/null +++ b/src/store/modules/settings.ts @@ -0,0 +1,75 @@ +import defaultSettings from "@/settings"; +import { ThemeEnum } from "@/enums/ThemeEnum"; +import { generateThemeColors, applyTheme, toggleDarkMode } from "@/utils/theme"; + +type SettingsValue = boolean | string; + +export const useSettingsStore = defineStore("setting", () => { + // 基本设置 + const settingsVisible = ref(false); + // 标签 + const tagsView = useStorage("tagsView", defaultSettings.tagsView); + // 侧边栏 Logo + const sidebarLogo = useStorage("sidebarLogo", defaultSettings.sidebarLogo); + // 布局 + const layout = useStorage("layout", defaultSettings.layout); + // 水印 + const watermarkEnabled = useStorage( + "watermarkEnabled", + defaultSettings.watermarkEnabled + ); + + // 主题 + const themeColor = useStorage("themeColor", defaultSettings.themeColor); + const theme = useStorage("theme", defaultSettings.theme); + + // 监听主题变化 + watch( + [theme, themeColor], + ([newTheme, newThemeColor]) => { + toggleDarkMode(newTheme === ThemeEnum.DARK); + const colors = generateThemeColors(newThemeColor); + applyTheme(colors); + }, + { immediate: true } + ); + + // 设置映射 + const settingsMap: Record> = { + tagsView, + sidebarLogo, + layout, + watermarkEnabled, + }; + + function changeSetting({ key, value }: { key: string; value: SettingsValue }) { + const setting = settingsMap[key]; + if (setting) setting.value = value; + } + + function changeTheme(val: string) { + theme.value = val; + } + + function changeThemeColor(color: string) { + themeColor.value = color; + } + + function changeLayout(val: string) { + layout.value = val; + } + + return { + settingsVisible, + tagsView, + sidebarLogo, + layout, + themeColor, + theme, + watermarkEnabled, + changeSetting, + changeTheme, + changeThemeColor, + changeLayout, + }; +}); diff --git a/src/store/modules/tags-view.ts b/src/store/modules/tags-view.ts new file mode 100644 index 0000000..82fb50b --- /dev/null +++ b/src/store/modules/tags-view.ts @@ -0,0 +1,254 @@ +export const useTagsViewStore = defineStore("tagsView", () => { + const visitedViews = ref([]); + const cachedViews = ref([]); + const router = useRouter(); + const route = useRoute(); + + /** + * 添加已访问视图到已访问视图列表中 + */ + function addVisitedView(view: TagView) { + // 如果已经存在于已访问的视图列表中,则不再添加 + if (visitedViews.value.some((v) => v.path === view.path)) { + 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.ts b/src/store/modules/user.ts new file mode 100644 index 0000000..5812f7a --- /dev/null +++ b/src/store/modules/user.ts @@ -0,0 +1,123 @@ +import { store } from "@/store"; +import { usePermissionStoreHook } from "@/store/modules/permission"; +import { useDictStoreHook } from "@/store/modules/dict"; + +import AuthAPI, { type LoginFormData } from "@/api/auth"; +import UserAPI, { type UserInfo } from "@/api/system/user"; + +import { setToken, setRefreshToken, getRefreshToken, clearToken } from "@/utils/auth"; + +export const useUserStore = defineStore("user", () => { + const userInfo = useStorage("userInfo", {} as UserInfo); + + /** + * 登录 + * + * @param {LoginFormData} + * @returns + */ + function login(LoginFormData: LoginFormData) { + return new Promise((resolve, reject) => { + AuthAPI.login(LoginFormData) + .then((data) => { + const { tokenType, accessToken, refreshToken } = data; + setToken(tokenType + " " + accessToken); // Bearer eyJhbGciOiJIUzI1NiJ9.xxx.xxx + setRefreshToken(refreshToken); + 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(() => { + clearUserData(); + resolve(); + }) + .catch((error) => { + reject(error); + }); + }); + } + + /** + * 刷新 token + */ + function refreshToken() { + const refreshToken = getRefreshToken(); + return new Promise((resolve, reject) => { + AuthAPI.refreshToken(refreshToken) + .then((data) => { + const { tokenType, accessToken, refreshToken } = data; + setToken(tokenType + " " + accessToken); + setRefreshToken(refreshToken); + resolve(); + }) + .catch((error) => { + console.log(" refreshToken 刷新失败", error); + reject(error); + }); + }); + } + + /** + * 清理用户数据 + * + * @returns + */ + function clearUserData() { + return new Promise((resolve) => { + clearToken(); + usePermissionStoreHook().resetRouter(); + useDictStoreHook().clearDictionaryCache(); + resolve(); + }); + } + + return { + userInfo, + getUserInfo, + login, + logout, + clearUserData, + refreshToken, + }; +}); + +/** + * 用于在组件外部(如在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 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/index.scss b/src/styles/index.scss new file mode 100644 index 0000000..349c84f --- /dev/null +++ b/src/styles/index.scss @@ -0,0 +1,28 @@ +@use "./reset"; + +.app-container { + padding: 15px; +} + +.search-bar { + padding: 18px 0 0 10px; + margin-bottom: 10px; + background-color: var(--el-bg-color-overlay); + border: 1px solid var(--el-border-color-light); + border-radius: 4px; + box-shadow: var(--el-box-shadow-light); +} + +.table-container > .el-card__header { + padding: calc(var(--el-card-padding) - 8px) var(--el-card-padding); +} + +.link-type, +.link-type:focus { + color: #337ab7; + cursor: pointer; + + &:hover { + color: rgb(32 160 255); + } +} diff --git a/src/styles/reset.scss b/src/styles/reset.scss new file mode 100644 index 0000000..a20f04a --- /dev/null +++ b/src/styles/reset.scss @@ -0,0 +1,76 @@ +*, +::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..b17cb52 --- /dev/null +++ b/src/styles/variables.module.scss @@ -0,0 +1,12 @@ +/* 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; + window-top: $window-top; +} +/* stylelint-enable property-no-unknown */ diff --git a/src/styles/variables.scss b/src/styles/variables.scss new file mode 100644 index 0000000..c909aef --- /dev/null +++ b/src/styles/variables.scss @@ -0,0 +1,59 @@ +@forward "element-plus/theme-chalk/src/common/var.scss" with ( + $colors: ( + "primary": ( + "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: #bfcbd9; + --menu-active-text: var(--el-menu-active-color); + --menu-hover: #263445; + --sidebar-logo-background: #fff; + + // 修复表格 fixed 列被选中后由于透明色导致叠字的 bug + .el-table { + --el-table-current-row-bg-color: rgb(235 243 250); + } +} + +/** 暗黑主题 */ +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%); +} + +$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-width: 210px; // 侧边栏宽度 +$sidebar-width-collapsed: 54px; // 侧边栏收缩宽度 +$navbar-height: 50px; // 导航栏高度 +$tags-view-height: 34px; // TagsView 高度 +$window-top: 60px; // 窗口顶部高度 diff --git a/src/types/auto-imports.d.ts b/src/types/auto-imports.d.ts new file mode 100644 index 0000000..f4a814d --- /dev/null +++ b/src/types/auto-imports.d.ts @@ -0,0 +1,1780 @@ +/* eslint-disable */ +/* 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..d03a6b6 --- /dev/null +++ b/src/types/components.d.ts @@ -0,0 +1,98 @@ +/* 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"]; + AppMain: (typeof import("./../layout/components/AppMain/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"]; + 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"]; + 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"]; + 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"]; + 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"]; + LayoutSelect: (typeof import("./../layout/components/Settings/components/LayoutSelect.vue"))["default"]; + PageContent: (typeof import("./../components/CURD/PageContent.vue"))["default"]; + PageForm: (typeof import("./../components/CURD/PageForm.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"]; + Settings: (typeof import("./../layout/components/Settings/index.vue"))["default"]; + Sidebar: (typeof import("./../layout/components/Sidebar/index.vue"))["default"]; + SidebarLogo: (typeof import("./../layout/components/Sidebar/components/SidebarLogo.vue"))["default"]; + SidebarMenu: (typeof import("./../layout/components/Sidebar/components/SidebarMenu.vue"))["default"]; + SidebarMenuItem: (typeof import("./../layout/components/Sidebar/components/SidebarMenuItem.vue"))["default"]; + SidebarMenuItemTitle: (typeof import("./../layout/components/Sidebar/components/SidebarMenuItemTitle.vue"))["default"]; + SidebarMixTopMenu: (typeof import("./../layout/components/Sidebar/components/SidebarMixTopMenu.vue"))["default"]; + SingleImageUpload: (typeof import("./../components/Upload/SingleImageUpload.vue"))["default"]; + SizeSelect: (typeof import("./../components/SizeSelect/index.vue"))["default"]; + SvgIcon: (typeof import("./../components/SvgIcon/index.vue"))["default"]; + TableSelect: (typeof import("./../components/TableSelect/index.vue"))["default"]; + TagsView: (typeof import("./../layout/components/TagsView/index.vue"))["default"]; + ThemeColorPicker: (typeof import("./../layout/components/Settings/components/ThemeColorPicker.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..efc4ba4 --- /dev/null +++ b/src/types/global.d.ts @@ -0,0 +1,106 @@ +declare global { + /** + * 响应数据 + */ + interface ResponseData { + 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; + /** 是否显示多标签导航 */ + tagsView: boolean; + /** 是否显示侧边栏Logo */ + sidebarLogo: boolean; + /** 导航栏布局(left|top|mix) */ + layout: string; + /** 主题颜色 */ + themeColor: string; + /** 主题模式(dark|light) */ + theme: string; + /** 布局大小(default |large |small) */ + size: string; + /** 语言( zh-cn| en) */ + language: string; + /** 是否开启水印 */ + watermarkEnabled: boolean; + /** 水印内容 */ + watermarkContent: string; + } + + /** + * 下拉选项数据类型 + */ + 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..bd3e9b3 --- /dev/null +++ b/src/utils/auth.ts @@ -0,0 +1,27 @@ +// 访问 token 缓存的 key +const ACCESS_TOKEN_KEY = "access_token"; +// 刷新 token 缓存的 key +const REFRESH_TOKEN_KEY = "refresh_token"; + +function getToken(): string { + return localStorage.getItem(ACCESS_TOKEN_KEY) || ""; +} + +function setToken(token: string) { + localStorage.setItem(ACCESS_TOKEN_KEY, token); +} + +function getRefreshToken(): string { + return localStorage.getItem(REFRESH_TOKEN_KEY) || ""; +} + +function setRefreshToken(token: string) { + localStorage.setItem(REFRESH_TOKEN_KEY, token); +} + +function clearToken() { + localStorage.removeItem(ACCESS_TOKEN_KEY); + localStorage.removeItem(REFRESH_TOKEN_KEY); +} + +export { getToken, setToken, clearToken, getRefreshToken, setRefreshToken }; diff --git a/src/utils/globalCancelToken.js b/src/utils/globalCancelToken.js new file mode 100644 index 0000000..6f3912c --- /dev/null +++ b/src/utils/globalCancelToken.js @@ -0,0 +1,29 @@ +// 最新的一个请求 +let cancel = null + +// 所有请求 +let cancelTokenList = [] + +function setToken(cancelToken) { + cancel = cancelToken + cancelTokenList.push(cancelToken) +} + +function cancelToken() { + cancel && cancel() + cancelTokenList.pop() +} + +function clearAllToken() { + while (cancelTokenList.length > 0) { + let cancel = cancelTokenList.pop() + console.log(cancel, 'cancel') + cancel && cancel() + } +} + +export { + setToken, + cancelToken, + clearAllToken, +} 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-php.js b/src/utils/request-php.js new file mode 100644 index 0000000..9b8857a --- /dev/null +++ b/src/utils/request-php.js @@ -0,0 +1,134 @@ +import axios from "axios"; +import router from "@/router"; +import Config from "@/settings"; +import Cookies from "js-cookie"; +import { setToken } from "@/utils/globalCancelToken.js"; +function getToken() { + return localStorage.getItem("bausertoken"); +} +// 创建axios实例 +const service = axios.create({ + // baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_API : '/', + baseURL: "https://czgdoumei.sxczgkj.com/index.php/api/", // api 的 base_url + timeout: Config.timeout, // 请求超时时间 +}); + +// request拦截器 +service.interceptors.request.use( + (config) => { + if (getToken()) { + config.headers["bausertoken"] = getToken(); + } + config.headers["Content-Type"] = "application/json"; + // 添加可取消请求配置 + config.cancelToken = new axios.CancelToken((c) => setToken(c)); + return config; + }, + (error) => { + Promise.reject(error); + } +); + +// response 拦截器 +service.interceptors.response.use( + (response) => { + const data = response.data; + console.log(data); + if (data.code == 0) { + ElNotification.error({ + title: data.msg, + duration: 5000, + }); + return; + } + if (data.code == 439) { + ElNotification.error({ + title: "请登录", + duration: 5000, + }); + return; + } + if (data.code == 4399) { + ElNotification.error({ + title: data.msg, + duration: 5000, + }); + return data; + } + if (data.code == 1 && !data.data) { + // ElNotification.success({ + // title: data.msg, + // duration: 5000 + // }) + return true; + } + return data.data; + }, + (error) => { + console.log(error); + if (axios.isCancel(error)) { + console.log("请求已取消"); + ElNotification.error({ + title: "请求已取消", + duration: 5000, + }); + return Promise.reject("请求已取消"); + } + + // 兼容blob下载出错json提示 + if ( + error.response.data instanceof Blob && + error.response.data.type.toLowerCase().indexOf("json") !== -1 + ) { + const reader = new FileReader(); + reader.readAsText(error.response.data, "utf-8"); + reader.onload = function (e) { + const errorMsg = JSON.parse(reader.result).message; + ElNotification.error({ + title: errorMsg, + duration: 5000, + }); + }; + } else { + let code = 0; + try { + code = error.response.data.status; + } catch (e) { + if (error.toString().indexOf("Error: timeout") !== -1) { + ElNotification.error({ + title: "网络请求超时", + duration: 5000, + }); + return Promise.reject(error); + } + } + console.log(code); + if (code) { + if (code === 401) { + // store.dispatch("LogOut").then(() => { + // // 用户登录界面提示 + // Cookies.set("point", 401); + // location.reload(); + // }); + } else if (code === 403) { + router.push({ path: "/401" }); + } else { + const errorMsg = error.response.data.message; + if (errorMsg !== undefined) { + ElNotification.error({ + title: errorMsg, + duration: 5000, + }); + } + } + } else { + ElNotification.error({ + title: "接口请求失败", + duration: 5000, + }); + } + } + return Promise.reject(error); + } +); +export default service; diff --git a/src/utils/request.ts b/src/utils/request.ts new file mode 100644 index 0000000..95a4a2f --- /dev/null +++ b/src/utils/request.ts @@ -0,0 +1,112 @@ +import axios, { type InternalAxiosRequestConfig, type AxiosResponse } from "axios"; +import qs from "qs"; +import { useUserStoreHook } from "@/store/modules/user"; +import { ResultEnum } from "@/enums/ResultEnum"; +import { getToken } from "@/utils/auth"; +import router from "@/router"; + +// 创建 axios 实例 +const service = 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), +}); + +// 请求拦截器 +service.interceptors.request.use( + (config: InternalAxiosRequestConfig) => { + const accessToken = getToken(); + // 如果 Authorization 设置为 no-auth,则不携带 Token,用于登录、刷新 Token 等接口 + if (config.headers.Authorization !== "no-auth" && accessToken) { + config.headers.Authorization = accessToken; + } else { + delete config.headers.Authorization; + } + return config; + }, + (error) => Promise.reject(error) +); + +// 响应拦截器 +service.interceptors.response.use( + (response: AxiosResponse) => { + // 如果响应是二进制流,则直接返回,用于下载文件、Excel 导出等 + if (response.config.responseType === "blob") { + return response; + } + + const { code, data, msg } = response.data; + if (code === ResultEnum.SUCCESS || code === undefined || code === null) { + return data ? data : response.data; + } + + ElMessage.error(msg || "系统出错"); + return Promise.reject(new Error(msg || "Error")); + }, + async (error: any) => { + // 非 2xx 状态码处理 401、403、500 等 + const { config, response } = error; + if (response) { + const { code, msg } = response.data; + if (code === ResultEnum.ACCESS_TOKEN_INVALID) { + // Token 过期,刷新 Token + return handleTokenRefresh(config); + } else if (code === ResultEnum.REFRESH_TOKEN_INVALID) { + return Promise.reject(new Error(msg || "Error")); + } else { + ElMessage.error(msg || "系统出错"); + } + } + return Promise.reject(error.message); + } +); + +export default service; + +// 刷新 Token 的锁 +let isRefreshing = false; +// 因 Token 过期导致失败的请求队列 +let requestsQueue: Array<() => void> = []; + +// 刷新 Token 处理 +async function handleTokenRefresh(config: InternalAxiosRequestConfig) { + return new Promise((resolve) => { + const requestCallback = () => { + config.headers.Authorization = getToken(); + resolve(service(config)); + }; + + requestsQueue.push(requestCallback); + + if (!isRefreshing) { + isRefreshing = true; + + // 刷新 Token + useUserStoreHook() + .refreshToken() + .then(() => { + // Token 刷新成功,执行请求队列 + requestsQueue.forEach((callback) => callback()); + requestsQueue = []; + }) + .catch((error) => { + console.log("handleTokenRefresh error", error); + // Token 刷新失败,清除用户数据并跳转到登录 + ElNotification({ + title: "提示", + message: "您的会话已过期,请重新登录", + type: "info", + }); + useUserStoreHook() + .clearUserData() + .then(() => { + router.push("/login"); + }); + }) + .finally(() => { + isRefreshing = false; + }); + } + }); +} diff --git a/src/utils/rsaEncrypt.js b/src/utils/rsaEncrypt.js new file mode 100644 index 0000000..1948ddd --- /dev/null +++ b/src/utils/rsaEncrypt.js @@ -0,0 +1,14 @@ +import JSEncrypt from 'jsencrypt/bin/jsencrypt.min' + +// 密钥对生成 http://web.chacuo.net/netrsakeypair + +const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' + + '2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ==' + +// 加密 +export function encrypt(txt) { + const encryptor = new JSEncrypt() + encryptor.setPublicKey(publicKey) // 设置公钥 + return encryptor.encrypt(txt) // 对需要加密的数据进行加密 +} + diff --git a/src/utils/theme.ts b/src/utils/theme.ts new file mode 100644 index 0000000..a62d01d --- /dev/null +++ b/src/utils/theme.ts @@ -0,0 +1,52 @@ +// 辅助函数:将十六进制颜色转换为 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): string { + const rgb = hexToRgb(hex); + const newRgb = rgb.map((val) => + Math.max(0, Math.min(255, Math.round(val + (255 - val) * factor))) + ) as [number, number, number]; + return rgbToHex(...newRgb); +} + +export function generateThemeColors(primary: string) { + const colors: Record = { + primary, + }; + + // 生成浅色变体 + for (let i = 1; i <= 9; i++) { + const factor = i * 0.1; + colors[`primary-light-${i}`] = adjustBrightness(primary, factor); + } + + // 生成深色变体 + colors["primary-dark-2"] = adjustBrightness(primary, -0.2); + + return colors; +} + +export function applyTheme(colors: Record) { + const el = document.documentElement; + + Object.entries(colors).forEach(([key, value]) => { + el.style.setProperty(`--el-color-${key}`, value); + }); +} + +export function toggleDarkMode(isDark: boolean) { + if (isDark) { + document.documentElement.classList.add("dark"); + } else { + document.documentElement.classList.remove("dark"); + } +} diff --git a/src/utils/websocket.ts b/src/utils/websocket.ts new file mode 100644 index 0000000..bd8fadb --- /dev/null +++ b/src/utils/websocket.ts @@ -0,0 +1,93 @@ +import { Client } from "@stomp/stompjs"; +import { getToken } from "@/utils/auth"; + +class WebSocketManager { + private client: Client | null = null; + private messageHandlers: Map void)[]> = new Map(); + private reconnectAttempts = 0; + private maxReconnectAttempts = 3; // 自定义最大重试次数 + private reconnectDelay = 5000; // 重试延迟(单位:毫秒) + + // 初始化 WebSocket 客户端 + setupWebSocket() { + const endpoint = import.meta.env.VITE_APP_WS_ENDPOINT; + + // 如果没有配置 WebSocket 端点或显式关闭,直接返回 + if (!endpoint) { + console.log("WebSocket 已被禁用,如需打开请在配置文件中配置 VITE_APP_WS_ENDPOINT"); + return; + } + + if (this.client && this.client.connected) { + console.log("客户端已存在并且连接正常"); + return this.client; + } + + this.client = new Client({ + brokerURL: endpoint, + connectHeaders: { + Authorization: getToken(), + }, + heartbeatIncoming: 30000, + heartbeatOutgoing: 30000, + reconnectDelay: 0, // 设置为 0 禁用重连 + onConnect: () => { + console.log(`连接到 WebSocket 服务器: ${endpoint}`); + this.reconnectAttempts = 0; // 重置重连计数 + this.messageHandlers.forEach((handlers, topic) => { + handlers.forEach((handler) => { + this.subscribeToTopic(topic, handler); + }); + }); + }, + onStompError: (frame) => { + console.error(`连接错误: ${frame.headers["message"]}`); + console.error(`错误详情: ${frame.body}`); + }, + onDisconnect: () => { + console.log(`WebSocket 连接已断开: ${endpoint}`); + this.reconnectAttempts++; + if (this.reconnectAttempts < this.maxReconnectAttempts) { + console.log(`正在尝试重连... 尝试次数: ${this.reconnectAttempts}`); + } else { + console.log("重连次数已达上限,停止重连"); + this.client?.deactivate(); + } + }, + }); + + this.client.activate(); + } + + // 订阅主题 + public subscribeToTopic(topic: string, onMessage: (message: string) => void) { + console.log(`正在订阅主题: ${topic}`); + if (!this.client || !this.client.connected) { + this.setupWebSocket(); + } + + if (this.messageHandlers.has(topic)) { + this.messageHandlers.get(topic)?.push(onMessage); + } else { + this.messageHandlers.set(topic, [onMessage]); + } + + if (this.client?.connected) { + this.client.subscribe(topic, (message) => { + const handlers = this.messageHandlers.get(topic); + handlers?.forEach((handler) => handler(message.body)); + }); + } + } + + // 断开 WebSocket 连接 + public disconnect() { + if (this.client) { + console.log("断开 WebSocket 连接"); + this.client.deactivate(); + this.client = null; + } + } +} + +export default new WebSocketManager(); diff --git a/src/views/data/credit.vue b/src/views/data/credit.vue new file mode 100644 index 0000000..e5e6a79 --- /dev/null +++ b/src/views/data/credit.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/views/data/index.vue b/src/views/data/index.vue new file mode 100644 index 0000000..e5e6a79 --- /dev/null +++ b/src/views/data/index.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/views/data/sales.vue b/src/views/data/sales.vue new file mode 100644 index 0000000..e5e6a79 --- /dev/null +++ b/src/views/data/sales.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/views/data/table.vue b/src/views/data/table.vue new file mode 100644 index 0000000..e5e6a79 --- /dev/null +++ b/src/views/data/table.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/views/data/work.vue b/src/views/data/work.vue new file mode 100644 index 0000000..e5e6a79 --- /dev/null +++ b/src/views/data/work.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/views/error/401.vue b/src/views/error/401.vue new file mode 100644 index 0000000..cb7231d --- /dev/null +++ b/src/views/error/401.vue @@ -0,0 +1,85 @@ + + + + + diff --git a/src/views/error/404.vue b/src/views/error/404.vue new file mode 100644 index 0000000..005c09e --- /dev/null +++ b/src/views/error/404.vue @@ -0,0 +1,123 @@ + + + + + diff --git a/src/views/index/index.vue b/src/views/index/index.vue new file mode 100644 index 0000000..801450b --- /dev/null +++ b/src/views/index/index.vue @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/src/views/login/index.vue b/src/views/login/index.vue new file mode 100644 index 0000000..797b437 --- /dev/null +++ b/src/views/login/index.vue @@ -0,0 +1,302 @@ + + + + + diff --git a/src/views/redirect/index.vue b/src/views/redirect/index.vue new file mode 100644 index 0000000..2b61386 --- /dev/null +++ b/src/views/redirect/index.vue @@ -0,0 +1,15 @@ + + + diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..7afb4fc --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "moduleResolution": "node", + "lib": ["esnext", "dom"], + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + }, + + // 严格性和类型检查相关配置 + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + + // 模块和兼容性相关配置 + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "resolveJsonModule": true, + + // 调试和兼容性相关配置 + "sourceMap": true, + "useDefineForClassFields": true, + "allowJs": true, + + // 类型声明相关配置 + "types": ["node", "vite/client", "element-plus/global"] + }, + + "include": ["mock/**/*.ts", "src/**/*.ts", "src/**/*.vue", "vite.config.ts"], + "exclude": ["node_modules", "dist"] +} diff --git a/uno.config.ts b/uno.config.ts new file mode 100644 index 0000000..1e19402 --- /dev/null +++ b/uno.config.ts @@ -0,0 +1,44 @@ +// uno.config.ts +import { + defineConfig, + presetAttributify, + presetIcons, + presetTypography, + presetUno, + presetWebFonts, + transformerDirectives, + transformerVariantGroup, +} from "unocss"; + +export default defineConfig({ + shortcuts: { + "flex-center": "flex justify-center items-center", + "flex-x-center": "flex justify-center", + "flex-y-center": "flex items-center", + "wh-full": "w-full h-full", + "flex-x-start": "flex items-center justify-start", + "flex-x-between": "flex items-center justify-between", + "flex-x-end": "flex items-center justify-end", + "absolute-lt": "absolute left-0 top-0", + "absolute-rt": "absolute right-0 top-0 ", + "fixed-lt": "fixed left-0 top-0", + }, + theme: { + colors: { + primary: "var(--el-color-primary)", + primary_dark: "var(--el-color-primary-light-5)", + }, + }, + presets: [ + presetUno(), + presetAttributify(), + presetIcons(), + presetTypography(), + presetWebFonts({ + fonts: { + // ... + }, + }), + ], + transformers: [transformerDirectives(), transformerVariantGroup()], +}); diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..c13ceba --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,231 @@ +import vue from "@vitejs/plugin-vue"; +import { type UserConfig, type ConfigEnv, loadEnv, defineConfig } from "vite"; + +import AutoImport from "unplugin-auto-import/vite"; +import Components from "unplugin-vue-components/vite"; +import { ElementPlusResolver } from "unplugin-vue-components/resolvers"; + +import { createSvgIconsPlugin } from "vite-plugin-svg-icons"; +import mockDevServerPlugin from "vite-plugin-mock-dev-server"; + +import UnoCSS from "unocss/vite"; +import { resolve } from "path"; +import { name, version, engines, dependencies, devDependencies } from "./package.json"; + +// 平台的名称、版本、运行所需的 node 版本、依赖、构建时间的类型提示 +const __APP_INFO__ = { + pkg: { name, version, engines, dependencies, devDependencies }, + buildTimestamp: Date.now(), +}; + +const pathSrc = resolve(__dirname, "src"); +// Vite配置 https://cn.vitejs.dev/config +export default defineConfig(({ mode }: ConfigEnv): UserConfig => { + const env = loadEnv(mode, process.cwd()); + return { + resolve: { + alias: { + "@": pathSrc, + }, + }, + css: { + preprocessorOptions: { + // 定义全局 SCSS 变量 + scss: { + api: "modern-compiler", + additionalData: ` + @use "@/styles/variables.scss" as *; + `, + }, + }, + }, + server: { + host: "0.0.0.0", + port: +env.VITE_APP_PORT, + open: true, + proxy: { + // 代理 /dev-api 的请求 + [env.VITE_APP_BASE_API]: { + changeOrigin: true, + // 代理目标地址:https://api.youlai.tech + target: env.VITE_APP_API_URL, + rewrite: (path) => path.replace(new RegExp("^" + env.VITE_APP_BASE_API), ""), + }, + }, + }, + plugins: [ + vue(), + env.VITE_MOCK_DEV_SERVER === "true" ? mockDevServerPlugin() : null, + UnoCSS({ + hmrTopLevelAwait: false, + }), + // 自动导入配置 https://github.com/sxzz/element-plus-best-practices/blob/main/vite.config.ts + AutoImport({ + // 导入 Vue 函数,如:ref, reactive, toRef 等 + imports: ["vue", "@vueuse/core", "pinia", "vue-router", "vue-i18n"], + resolvers: [ + // 导入 Element Plus函数,如:ElMessage, ElMessageBox 等 + ElementPlusResolver(), + ], + eslintrc: { + enabled: false, + filepath: "./.eslintrc-auto-import.json", + globalsPropValue: true, + }, + vueTemplate: true, + // 导入函数类型声明文件路径 (false:关闭自动生成) + dts: false, + // dts: "src/types/auto-imports.d.ts", + }), + Components({ + resolvers: [ + // 导入 Element Plus 组件 + ElementPlusResolver(), + ], + // 指定自定义组件位置(默认:src/components) + dirs: ["src/components", "src/**/components"], + // 导入组件类型声明文件路径 (false:关闭自动生成) + dts: false, + // dts: "src/types/components.d.ts", + }), + createSvgIconsPlugin({ + // 缓存图标位置 + iconDirs: [resolve(pathSrc, "assets/icons")], + symbolId: "icon-[dir]-[name]", + }), + ], + // 预加载项目必需的组件 + optimizeDeps: { + include: [ + "vue", + "vue-router", + "element-plus", + "pinia", + "axios", + "@vueuse/core", + "sortablejs", + "exceljs", + "path-to-regexp", + "echarts", + "vue-i18n", + "nprogress", + "qs", + "path-browserify", + "@element-plus/icons-vue", + "element-plus/es/locale/lang/zh-cn", + "element-plus/es/locale/lang/en", + "element-plus/es/components/form/style/css", + "element-plus/es/components/form-item/style/css", + "element-plus/es/components/button/style/css", + "element-plus/es/components/input/style/css", + "element-plus/es/components/input-number/style/css", + "element-plus/es/components/switch/style/css", + "element-plus/es/components/upload/style/css", + "element-plus/es/components/menu/style/css", + "element-plus/es/components/col/style/css", + "element-plus/es/components/icon/style/css", + "element-plus/es/components/row/style/css", + "element-plus/es/components/tag/style/css", + "element-plus/es/components/dialog/style/css", + "element-plus/es/components/loading/style/css", + "element-plus/es/components/radio/style/css", + "element-plus/es/components/radio-group/style/css", + "element-plus/es/components/popover/style/css", + "element-plus/es/components/scrollbar/style/css", + "element-plus/es/components/tooltip/style/css", + "element-plus/es/components/dropdown/style/css", + "element-plus/es/components/dropdown-menu/style/css", + "element-plus/es/components/dropdown-item/style/css", + "element-plus/es/components/sub-menu/style/css", + "element-plus/es/components/menu-item/style/css", + "element-plus/es/components/divider/style/css", + "element-plus/es/components/card/style/css", + "element-plus/es/components/link/style/css", + "element-plus/es/components/breadcrumb/style/css", + "element-plus/es/components/breadcrumb-item/style/css", + "element-plus/es/components/table/style/css", + "element-plus/es/components/tree-select/style/css", + "element-plus/es/components/table-column/style/css", + "element-plus/es/components/select/style/css", + "element-plus/es/components/option/style/css", + "element-plus/es/components/pagination/style/css", + "element-plus/es/components/tree/style/css", + "element-plus/es/components/alert/style/css", + "element-plus/es/components/radio-button/style/css", + "element-plus/es/components/checkbox-group/style/css", + "element-plus/es/components/checkbox/style/css", + "element-plus/es/components/tabs/style/css", + "element-plus/es/components/tab-pane/style/css", + "element-plus/es/components/rate/style/css", + "element-plus/es/components/date-picker/style/css", + "element-plus/es/components/notification/style/css", + "element-plus/es/components/image/style/css", + "element-plus/es/components/statistic/style/css", + "element-plus/es/components/watermark/style/css", + "element-plus/es/components/config-provider/style/css", + "element-plus/es/components/text/style/css", + "element-plus/es/components/drawer/style/css", + "element-plus/es/components/color-picker/style/css", + "element-plus/es/components/backtop/style/css", + "element-plus/es/components/message-box/style/css", + "element-plus/es/components/skeleton/style/css", + "element-plus/es/components/skeleton/style/css", + "element-plus/es/components/skeleton-item/style/css", + "element-plus/es/components/badge/style/css", + "element-plus/es/components/steps/style/css", + "element-plus/es/components/step/style/css", + "element-plus/es/components/avatar/style/css", + "element-plus/es/components/descriptions/style/css", + "element-plus/es/components/descriptions-item/style/css", + "element-plus/es/components/checkbox-group/style/css", + "element-plus/es/components/progress/style/css", + "element-plus/es/components/image-viewer/style/css", + "element-plus/es/components/empty/style/css", + "element-plus/es/components/message/style/css", + ], + }, + // 构建配置 + build: { + chunkSizeWarningLimit: 2000, // 消除打包大小超过500kb警告 + minify: "terser", // Vite 2.6.x 以上需要配置 minify: "terser", terserOptions 才能生效 + terserOptions: { + compress: { + keep_infinity: true, // 防止 Infinity 被压缩成 1/0,这可能会导致 Chrome 上的性能问题 + drop_console: true, // 生产环境去除 console + drop_debugger: true, // 生产环境去除 debugger + }, + format: { + comments: false, // 删除注释 + }, + }, + rollupOptions: { + output: { + // manualChunks: { + // "vue-i18n": ["vue-i18n"], + // }, + // 用于从入口点创建的块的打包输出格式[name]表示文件名,[hash]表示该文件内容hash值 + entryFileNames: "js/[name].[hash].js", + // 用于命名代码拆分时创建的共享块的输出命名 + chunkFileNames: "js/[name].[hash].js", + // 用于输出静态资源的命名,[ext]表示文件扩展名 + assetFileNames: (assetInfo: any) => { + const info = assetInfo.name.split("."); + let extType = info[info.length - 1]; + // console.log('文件信息', assetInfo.name) + if (/\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/i.test(assetInfo.name)) { + extType = "media"; + } else if (/\.(png|jpe?g|gif|svg)(\?.*)?$/.test(assetInfo.name)) { + extType = "img"; + } else if (/\.(woff2?|eot|ttf|otf)(\?.*)?$/i.test(assetInfo.name)) { + extType = "fonts"; + } + return `${extType}/[name].[hash].[ext]`; + }, + }, + }, + }, + define: { + __APP_INFO__: JSON.stringify(__APP_INFO__), + }, + }; +});