diff --git a/.env.development b/.env.development index bfc807ef..ad811d4d 100644 --- a/.env.development +++ b/.env.development @@ -1,33 +1,36 @@ # 应用端口 -VITE_APP_PORT=3000 +APP_PORT=3000 + # 项目名称 VITE_APP_TITLE=vue3-element-admin -# 代理前缀 -VITE_APP_BASE_API=/dev-api + +# 代理前缀(vite proxy 的匹配 key) VITE_API_BASE=/dev-api +# 普通请求实例 baseURL(需与代理前缀一致,dev 下经 vite 代理转发到后端) +VITE_APP_BASE_API=/dev-api -# 接口地址 -#VITE_APP_API_URL=http://180.102.16.123:8000 -#VITE_APP_API_URL=https://api.youlai.tech # 线上 -# VITE_APP_API_URL=https://api.youlai.tech/v2 # 线上(多租户) -VITE_APP_API_URL=http://localhost:8000 # 本地 +# 接口地址(开发代理转发目标 = 真实后端主机名;前端路径自带 /api/v1,故此处只填主机名) +API_PROXY_TARGET=https://api.ttstd.com +# API_PROXY_TARGET=http://localhost:8000 # 本地 +# 大文件上传直连地址(uploadHttp 使用,绕过 vite 代理,同样只填主机名) +VITE_APP_API_URL=https://api.ttstd.com +# VITE_APP_API_URL=http://localhost:8000 # 本地 +# Mock 开关 +VITE_MOCK_ENABLED=false -# 启用 Mock 服务(true:开启 false:关闭) -VITE_MOCK_DEV_SERVER=false +# 多租户开关 +VITE_TENANT_ENABLED=false + +# AI 开关 +VITE_AI_ENABLED=false + +# 统一认证登录开关 +VITE_OIDC_ENABLED=false -# 多租户开关(true:开启 false:关闭) -VITE_APP_TENANT_ENABLED=false VITE_API_TYPE = MYSQL # or POSTGRES # 百度地图 JavaScript API v4.0 密钥(AK) # 申请地址:https://lbsyun.baidu.com/apiconsole/key # 注意:需在「应用管理-我的应用」中为该 AK 配置「浏览器端」白名单(Referer 域名/IP) VITE_BAIDU_MAP_AK=DaKEjkzMRHg87GZgEJqAmxUxcBbJaYvS - -# 功能开关(上游新增) -VITE_AI_ENABLED=true -VITE_TENANT_ENABLED=false -VITE_MOCK_ENABLED=false - - diff --git a/.env.production b/.env.production index 246dfffa..41ec0bd8 100644 --- a/.env.production +++ b/.env.production @@ -5,8 +5,11 @@ VITE_APP_BASE_API=/prod-api # 项目名称 VITE_APP_TITLE=vue3-element-admin -# 多租户开关(true:开启 false:关闭) +# 多租户开关 VITE_TENANT_ENABLED=false -# AI 辅助功能开关(true:开启 false:关闭,缺省关闭) +# AI 辅助功能开关 VITE_AI_ENABLED=true + +# 统一认证登录开关 +VITE_OIDC_ENABLED=false diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json deleted file mode 100644 index 0e8546f8..00000000 --- a/.eslintrc-auto-import.json +++ /dev/null @@ -1,316 +0,0 @@ -{ - "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 index 494f1617..1b28f8ee 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,9 @@ stats.html .env.local .env.*.local +# 线上部署专用变量,不入库 +.env.youlai + # Editor directories and files .idea/ .vscode/* @@ -34,4 +37,7 @@ package-lock.json yarn.lock # Local history -.history \ No newline at end of file +.history + +# Local deploy config +deploy.mjs \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit index e77b172c..26fc3643 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,2 +1,2 @@ #!/usr/bin/env sh -npm run lint:lint-staged +pnpm exec lint-staged diff --git a/.prettierignore b/.prettierignore index 44421a7a..bcd8ce89 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,12 +1,24 @@ +# 构建与测试产物 dist -node_modules +coverage +stats.html + +# 静态资源 public +src/assets + +# 依赖与工具目录 +node_modules .husky .vscode .idea + +# 锁文件 +pnpm-lock.yaml + +# 压缩产物 +*.min.* + +# 脚本与文档不参与格式化 *.sh *.md - -src/assets -stats.html -pnpm-lock.yaml diff --git a/.prettierrc.yaml b/.prettierrc.yaml index bfe6e8f6..c1816815 100644 --- a/.prettierrc.yaml +++ b/.prettierrc.yaml @@ -1,41 +1,8 @@ -# 在单参数箭头函数中始终添加括号 -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 文件中的 diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index 330be6c3..2246ad6b 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -85,7 +85,7 @@ watch( return; } getBreadcrumb(); - } + }, ); onBeforeMount(() => { diff --git a/src/components/CommandPalette/useCommandPalette.ts b/src/components/CommandPalette/useCommandPalette.ts index 58f8c055..d74ac98f 100644 --- a/src/components/CommandPalette/useCommandPalette.ts +++ b/src/components/CommandPalette/useCommandPalette.ts @@ -4,7 +4,9 @@ import router from "@/router"; import { usePermissionStore } from "@/stores"; import { isExternal } from "@/utils"; -/** 命令面板中的可搜索菜单项 */ +/** + * 命令面板中的可搜索菜单项 + */ interface SearchItem { title: string; path: string; @@ -24,13 +26,11 @@ const EXCLUDED_PATHS = ["/redirect", "/login", "/401", "/404"]; export function useCommandPalette() { const permissionStore = usePermissionStore(); - // 面板状态 const visible = ref(false); const keyword = ref(""); const activeIndex = ref(-1); const inputRef = ref(); - // 菜单数据 const menuItems = ref([]); const results = ref([]); const history = ref([]); @@ -64,7 +64,7 @@ export function useCommandPalette() { } const keywordText = keyword.value.toLowerCase(); results.value = menuItems.value.filter((item) => - item.title.toLowerCase().includes(keywordText) + item.title.toLowerCase().includes(keywordText), ); } diff --git a/src/components/CopyButton/index.vue b/src/components/CopyButton/index.vue index 4615251f..f2757130 100644 --- a/src/components/CopyButton/index.vue +++ b/src/components/CopyButton/index.vue @@ -39,7 +39,7 @@ function handleClipboard() { }, () => { ElMessage.warning("复制失败"); - } + }, ); } else { // 兼容性处理(useClipboard 有兼容性问题) diff --git a/src/components/Crud/CrudForm.vue b/src/components/Crud/CrudForm.vue new file mode 100644 index 00000000..95459b2b --- /dev/null +++ b/src/components/Crud/CrudForm.vue @@ -0,0 +1,473 @@ + + + diff --git a/src/components/Crud/CrudModal.vue b/src/components/Crud/CrudModal.vue deleted file mode 100644 index b8388100..00000000 --- a/src/components/Crud/CrudModal.vue +++ /dev/null @@ -1,290 +0,0 @@ - - - - - diff --git a/src/components/Crud/CrudPage.vue b/src/components/Crud/CrudPage.vue new file mode 100644 index 00000000..de799dde --- /dev/null +++ b/src/components/Crud/CrudPage.vue @@ -0,0 +1,152 @@ + + + diff --git a/src/components/Crud/CrudSearch.vue b/src/components/Crud/CrudSearch.vue index e80609b5..aff804a5 100644 --- a/src/components/Crud/CrudSearch.vue +++ b/src/components/Crud/CrudSearch.vue @@ -1,64 +1,70 @@