create-bubbles 0.1.13 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -8
- package/package.json +3 -3
- package/template-nextjs-vinext-eslint/.dockerignore +0 -3
- package/template-nextjs-vinext-eslint/.vscode/settings.json +0 -53
- package/template-nextjs-vinext-eslint/Dockerfile +0 -21
- package/template-nextjs-vinext-eslint/README.md +0 -100
- package/template-nextjs-vinext-eslint/commitlint.config.js +0 -1
- package/template-nextjs-vinext-eslint/docker-compose.yaml +0 -22
- package/template-nextjs-vinext-eslint/eslint.config.js +0 -20
- package/template-nextjs-vinext-eslint/lefthook.yml +0 -11
- package/template-nextjs-vinext-eslint/next.config.ts +0 -8
- package/template-nextjs-vinext-eslint/nginx.conf +0 -14
- package/template-nextjs-vinext-eslint/package.json +0 -50
- package/template-nextjs-vinext-eslint/pnpm-workspace.yaml +0 -7
- package/template-nextjs-vinext-eslint/public/file.svg +0 -1
- package/template-nextjs-vinext-eslint/public/globe.svg +0 -1
- package/template-nextjs-vinext-eslint/public/logo-white.svg +0 -128
- package/template-nextjs-vinext-eslint/public/next.svg +0 -1
- package/template-nextjs-vinext-eslint/public/vercel.svg +0 -1
- package/template-nextjs-vinext-eslint/public/window.svg +0 -1
- package/template-nextjs-vinext-eslint/src/app/_components/Header/header.module.css +0 -0
- package/template-nextjs-vinext-eslint/src/app/_components/Header/header.tsx +0 -7
- package/template-nextjs-vinext-eslint/src/app/_components/Main/index.tsx +0 -13
- package/template-nextjs-vinext-eslint/src/app/antd-provider.tsx +0 -30
- package/template-nextjs-vinext-eslint/src/app/icon.svg +0 -26
- package/template-nextjs-vinext-eslint/src/app/layout.tsx +0 -68
- package/template-nextjs-vinext-eslint/src/app/page.module.css +0 -141
- package/template-nextjs-vinext-eslint/src/app/page.tsx +0 -43
- package/template-nextjs-vinext-eslint/src/app/uno-css.tsx +0 -7
- package/template-nextjs-vinext-eslint/src/assets/icon/logo-white.svg +0 -128
- package/template-nextjs-vinext-eslint/src/assets/icon/logo.svg +0 -26
- package/template-nextjs-vinext-eslint/src/assets/image/QR.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/banner_1.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/banner_2.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/banner_3.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/banner_4.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/banner_top.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/icon_title_left.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/icon_title_right.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/img.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_COCT.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/207/347/247/221.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/205/264.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/206/266/345/273/272/345/267/245.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/233/275/344/270/255/351/223/201.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/233/275/344/272/224/345/206/266.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/233/275/344/272/244/351/200/232/345/273/272/350/256/276.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/233/275/345/273/272/344/270/232.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/233/275/345/273/272/347/255/221/347/247/221/345/255/246/351/231/242.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/233/275/347/224/265/345/273/272.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/233/275/351/223/201/345/273/272.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/345/256/234/351/200/232/344/270/226/347/272/252.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/346/225/260/347/273/264/347/251/272/351/227/264.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/346/226/260/346/230/212/350/276/260/345/273/272/350/256/276.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/346/236/227/345/220/214/346/243/252/345/233/275/351/231/205.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/346/270/235/351/232/206/351/233/206/345/233/242.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/347/273/264/345/241/224/347/247/221/346/212/200.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/350/205/276/350/256/257.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/350/265/233/350/277/252/344/277/241/346/201/257.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/207/215/345/272/206/344/272/244/351/200/232/345/244/247/345/255/246.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/207/215/345/272/206/344/272/244/351/200/232/350/201/214/344/270/232/345/255/246/351/231/242.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/207/215/345/272/206/345/244/247/345/255/246.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/207/215/345/272/206/345/267/245/345/225/206/350/201/214/344/270/232/345/255/246/351/231/242.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/207/215/345/272/206/345/267/245/347/250/213/350/201/214/344/270/232/346/212/200/346/234/257/345/255/246/351/231/242.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/207/215/345/272/206/345/273/272/345/267/245.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/230/277/351/207/214/344/272/221.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/231/206/345/206/233/345/206/233/345/214/273/345/244/247/345/255/246.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/276/231/346/271/226.png +0 -0
- package/template-nextjs-vinext-eslint/src/styles/globals.css +0 -47
- package/template-nextjs-vinext-eslint/src/types/vite-env.d.ts +0 -18
- package/template-nextjs-vinext-eslint/src/utils/env.ts +0 -14
- package/template-nextjs-vinext-eslint/src/utils/index.ts +0 -0
- package/template-nextjs-vinext-eslint/src/utils/request/core/index.ts +0 -182
- package/template-nextjs-vinext-eslint/src/utils/request/core/utils.ts +0 -30
- package/template-nextjs-vinext-eslint/src/utils/request/index.ts +0 -48
- package/template-nextjs-vinext-eslint/tsconfig.json +0 -34
- package/template-nextjs-vinext-eslint/uno.config.ts +0 -8
- package/template-nextjs-vinext-eslint/vite.config.ts +0 -8
- package/template-react-rsbuild-biome/.env +0 -5
- package/template-react-rsbuild-biome/.env.development +0 -1
- package/template-react-rsbuild-biome/.env.production +0 -1
- package/template-react-rsbuild-biome/.prettierignore +0 -34
- package/template-react-rsbuild-biome/.prettierrc +0 -16
- package/template-react-rsbuild-biome/.vscode/settings.json +0 -10
- package/template-react-rsbuild-biome/README.md +0 -29
- package/template-react-rsbuild-biome/biome.json +0 -116
- package/template-react-rsbuild-biome/commitlint.config.js +0 -1
- package/template-react-rsbuild-biome/index.html +0 -7
- package/template-react-rsbuild-biome/lefthook.yml +0 -14
- package/template-react-rsbuild-biome/package.json +0 -42
- package/template-react-rsbuild-biome/public/.gitkeep +0 -0
- package/template-react-rsbuild-biome/rsbuild.config.ts +0 -44
- package/template-react-rsbuild-biome/src/App.tsx +0 -9
- package/template-react-rsbuild-biome/src/assets/font/AlimamaShuHeiTi-Bold.ttf +0 -0
- package/template-react-rsbuild-biome/src/assets/icon/logo.svg +0 -7
- package/template-react-rsbuild-biome/src/components/Loading/PageLoading.tsx +0 -11
- package/template-react-rsbuild-biome/src/env.d.ts +0 -1
- package/template-react-rsbuild-biome/src/index.tsx +0 -18
- package/template-react-rsbuild-biome/src/layout/default/index.tsx +0 -10
- package/template-react-rsbuild-biome/src/pages/home/index.tsx +0 -5
- package/template-react-rsbuild-biome/src/router/index.tsx +0 -38
- package/template-react-rsbuild-biome/src/store/index.ts +0 -0
- package/template-react-rsbuild-biome/src/store/modules/user.ts +0 -11
- package/template-react-rsbuild-biome/src/styles/fonts.scss +0 -4
- package/template-react-rsbuild-biome/src/styles/index.scss +0 -19
- package/template-react-rsbuild-biome/src/styles/variables.scss +0 -4
- package/template-react-rsbuild-biome/src/types/auto-import.d.ts +0 -49
- package/template-react-rsbuild-biome/src/utils/env.ts +0 -10
- package/template-react-rsbuild-biome/src/utils/request/core/index.ts +0 -166
- package/template-react-rsbuild-biome/src/utils/request/core/utils.ts +0 -38
- package/template-react-rsbuild-biome/src/utils/request/index.ts +0 -43
- package/template-react-rsbuild-biome/tsconfig.json +0 -35
- package/template-react-rsbuild-biome/uno.config.ts +0 -8
- package/template-taro-vue-eslint/.editorconfig +0 -12
- package/template-taro-vue-eslint/.env +0 -3
- package/template-taro-vue-eslint/.env.development +0 -5
- package/template-taro-vue-eslint/.env.production +0 -5
- package/template-taro-vue-eslint/.vscode/settings.json +0 -57
- package/template-taro-vue-eslint/babel.config.js +0 -12
- package/template-taro-vue-eslint/commitlint.config.mjs +0 -1
- package/template-taro-vue-eslint/config/dev.ts +0 -27
- package/template-taro-vue-eslint/config/index.ts +0 -129
- package/template-taro-vue-eslint/config/output-root.ts +0 -11
- package/template-taro-vue-eslint/config/prod.ts +0 -39
- package/template-taro-vue-eslint/config/release.ts +0 -113
- package/template-taro-vue-eslint/eslint.config.mjs +0 -22
- package/template-taro-vue-eslint/lefthook.yaml +0 -13
- package/template-taro-vue-eslint/package.json +0 -115
- package/template-taro-vue-eslint/patches/@tarojs__plugin-mini-ci.patch +0 -13
- package/template-taro-vue-eslint/pnpm-workspace.yaml +0 -2
- package/template-taro-vue-eslint/project.config.json +0 -16
- package/template-taro-vue-eslint/src/api/common/upload.ts +0 -53
- package/template-taro-vue-eslint/src/app.config.ts +0 -19
- package/template-taro-vue-eslint/src/app.ts +0 -14
- package/template-taro-vue-eslint/src/assets/image/.gitkeep +0 -0
- package/template-taro-vue-eslint/src/index.html +0 -17
- package/template-taro-vue-eslint/src/pages/example/upload/index.config.ts +0 -3
- package/template-taro-vue-eslint/src/pages/example/upload/index.module.scss +0 -4
- package/template-taro-vue-eslint/src/pages/example/upload/index.vue +0 -71
- package/template-taro-vue-eslint/src/pages/index/index.config.ts +0 -3
- package/template-taro-vue-eslint/src/pages/index/index.module.scss +0 -4
- package/template-taro-vue-eslint/src/pages/index/index.vue +0 -71
- package/template-taro-vue-eslint/src/store/index.ts +0 -10
- package/template-taro-vue-eslint/src/store/modules/user.ts +0 -15
- package/template-taro-vue-eslint/src/store/taroStorage.ts +0 -7
- package/template-taro-vue-eslint/src/styles/index.css +0 -1
- package/template-taro-vue-eslint/src/styles/nut-theme.css +0 -4
- package/template-taro-vue-eslint/src/utils/env.ts +0 -13
- package/template-taro-vue-eslint/src/utils/index.ts +0 -40
- package/template-taro-vue-eslint/src/utils/request/core/index.ts +0 -193
- package/template-taro-vue-eslint/src/utils/request/core/utils.ts +0 -30
- package/template-taro-vue-eslint/src/utils/request/index.ts +0 -73
- package/template-taro-vue-eslint/tsconfig.json +0 -30
- package/template-taro-vue-eslint/types/components.d.ts +0 -12
- package/template-taro-vue-eslint/types/global.d.ts +0 -31
- package/template-taro-vue-eslint/types/vue.d.ts +0 -10
- package/template-taro-vue-eslint/unocss.config.ts +0 -38
- package/template-vp-monorepo-react-nestjs/.oxfmtrc.jsonc +0 -8
- package/template-vp-monorepo-react-nestjs/.oxlintrc.jsonc +0 -3
- package/template-vp-monorepo-react-nestjs/.specs//351/234/200/346/261/202.md +0 -5
- package/template-vp-monorepo-react-nestjs/.vite-hooks/commit-msg +0 -1
- package/template-vp-monorepo-react-nestjs/.vite-hooks/pre-commit +0 -1
- package/template-vp-monorepo-react-nestjs/README.md +0 -29
- package/template-vp-monorepo-react-nestjs/apps/service/.oxlintrc.jsonc +0 -3
- package/template-vp-monorepo-react-nestjs/apps/web/.env +0 -1
- package/template-vp-monorepo-react-nestjs/apps/web/.oxlintrc.jsonc +0 -4
- package/template-vp-monorepo-react-nestjs/apps/web/index.html +0 -13
- package/template-vp-monorepo-react-nestjs/apps/web/package.json +0 -39
- package/template-vp-monorepo-react-nestjs/apps/web/public/favicon.svg +0 -1
- package/template-vp-monorepo-react-nestjs/apps/web/public/icons.svg +0 -24
- package/template-vp-monorepo-react-nestjs/apps/web/src/App.tsx +0 -24
- package/template-vp-monorepo-react-nestjs/apps/web/src/assets/hero.png +0 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/assets/react.svg +0 -1
- package/template-vp-monorepo-react-nestjs/apps/web/src/assets/vite.svg +0 -1
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/Loading/PageLoading.tsx +0 -11
- package/template-vp-monorepo-react-nestjs/apps/web/src/main.tsx +0 -5
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/home/index.tsx +0 -17
- package/template-vp-monorepo-react-nestjs/apps/web/src/router/index.tsx +0 -25
- package/template-vp-monorepo-react-nestjs/apps/web/src/router/modules/.gitkeep +0 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/styles/index.css +0 -7
- package/template-vp-monorepo-react-nestjs/apps/web/src/types/auto-imports.d.ts +0 -58
- package/template-vp-monorepo-react-nestjs/apps/web/tsconfig.json +0 -32
- package/template-vp-monorepo-react-nestjs/apps/web/vite.config.ts +0 -32
- package/template-vp-monorepo-react-nestjs/commitlint.config.js +0 -0
- package/template-vp-monorepo-react-nestjs/package.json +0 -20
- package/template-vp-monorepo-react-nestjs/packages/utils/README.md +0 -23
- package/template-vp-monorepo-react-nestjs/packages/utils/package.json +0 -39
- package/template-vp-monorepo-react-nestjs/packages/utils/src/index.ts +0 -3
- package/template-vp-monorepo-react-nestjs/packages/utils/tests/index.test.ts +0 -6
- package/template-vp-monorepo-react-nestjs/packages/utils/tsconfig.json +0 -20
- package/template-vp-monorepo-react-nestjs/packages/utils/tsdown.config.ts +0 -9
- package/template-vp-monorepo-react-nestjs/packages/utils/vite.config.ts +0 -7
- package/template-vp-monorepo-react-nestjs/pnpm-workspace.yaml +0 -23
- package/template-vp-monorepo-react-nestjs/tsconfig.json +0 -9
- package/template-vp-monorepo-react-nestjs/vite.config.ts +0 -8
- package/template-vp-react/.env +0 -1
- package/template-vp-react/.oxfmtrc.jsonc +0 -8
- package/template-vp-react/.oxlintrc.jsonc +0 -11
- package/template-vp-react/.vite-hooks/commit-msg +0 -1
- package/template-vp-react/.vite-hooks/pre-commit +0 -1
- package/template-vp-react/.vscode/extensions.json +0 -3
- package/template-vp-react/.vscode/settings.json +0 -11
- package/template-vp-react/commitlint.config.js +0 -0
- package/template-vp-react/index.html +0 -13
- package/template-vp-react/package.json +0 -41
- package/template-vp-react/public/favicon.svg +0 -1
- package/template-vp-react/public/icons.svg +0 -24
- package/template-vp-react/src/App.tsx +0 -24
- package/template-vp-react/src/assets/hero.png +0 -0
- package/template-vp-react/src/assets/react.svg +0 -1
- package/template-vp-react/src/assets/vite.svg +0 -1
- package/template-vp-react/src/components/Loading/PageLoading.tsx +0 -11
- package/template-vp-react/src/main.tsx +0 -5
- package/template-vp-react/src/pages/home/index.tsx +0 -17
- package/template-vp-react/src/router/index.tsx +0 -25
- package/template-vp-react/src/router/modules/.gitkeep +0 -0
- package/template-vp-react/src/styles/index.css +0 -7
- package/template-vp-react/src/types/auto-imports.d.ts +0 -58
- package/template-vp-react/tsconfig.json +0 -32
- package/template-vp-react/vite.config.ts +0 -35
- package/template-vp-react-shadcn/.env +0 -1
- package/template-vp-react-shadcn/.oxfmtrc.jsonc +0 -8
- package/template-vp-react-shadcn/.oxlintrc.jsonc +0 -3
- package/template-vp-react-shadcn/.vite-hooks/commit-msg +0 -1
- package/template-vp-react-shadcn/.vite-hooks/pre-commit +0 -1
- package/template-vp-react-shadcn/.vscode/extensions.json +0 -3
- package/template-vp-react-shadcn/.vscode/settings.json +0 -12
- package/template-vp-react-shadcn/agents.md +0 -44
- package/template-vp-react-shadcn/commitlint.config.js +0 -1
- package/template-vp-react-shadcn/components.json +0 -25
- package/template-vp-react-shadcn/index.html +0 -13
- package/template-vp-react-shadcn/package.json +0 -56
- package/template-vp-react-shadcn/public/favicon.svg +0 -1
- package/template-vp-react-shadcn/public/icons.svg +0 -24
- package/template-vp-react-shadcn/src/App.tsx +0 -24
- package/template-vp-react-shadcn/src/api/.gitkeep +0 -0
- package/template-vp-react-shadcn/src/assets/hero.png +0 -0
- package/template-vp-react-shadcn/src/assets/react.svg +0 -1
- package/template-vp-react-shadcn/src/assets/vite.svg +0 -1
- package/template-vp-react-shadcn/src/components/Loading/PageLoading.tsx +0 -11
- package/template-vp-react-shadcn/src/components/Player/VideoJS/index.tsx +0 -163
- package/template-vp-react-shadcn/src/components/Player/index.ts +0 -7
- package/template-vp-react-shadcn/src/components/ui/button.tsx +0 -67
- package/template-vp-react-shadcn/src/components/ui/sonner.tsx +0 -43
- package/template-vp-react-shadcn/src/components/ui/spinner.tsx +0 -17
- package/template-vp-react-shadcn/src/hooks/.gitkeep +0 -0
- package/template-vp-react-shadcn/src/lib/utils.ts +0 -6
- package/template-vp-react-shadcn/src/main.tsx +0 -5
- package/template-vp-react-shadcn/src/pages/home/index.tsx +0 -96
- package/template-vp-react-shadcn/src/router/index.tsx +0 -25
- package/template-vp-react-shadcn/src/router/modules/.gitkeep +0 -0
- package/template-vp-react-shadcn/src/store/.gitkeep +0 -0
- package/template-vp-react-shadcn/src/styles/index.css +0 -16
- package/template-vp-react-shadcn/src/styles/shadcn.css +0 -127
- package/template-vp-react-shadcn/src/types/auto-imports.d.ts +0 -58
- package/template-vp-react-shadcn/src/utils/env/index.tsx +0 -6
- package/template-vp-react-shadcn/src/utils/request/alova-core/index.ts +0 -276
- package/template-vp-react-shadcn/src/utils/request/alova-core/utils.ts +0 -24
- package/template-vp-react-shadcn/src/utils/request/index.ts +0 -48
- package/template-vp-react-shadcn/src/utils/request/readme.md +0 -176
- package/template-vp-react-shadcn/tsconfig.json +0 -32
- package/template-vp-react-shadcn/vite.config.ts +0 -35
- package/template-vue-rolldown-oxc/.env +0 -4
- package/template-vue-rolldown-oxc/.env.development +0 -1
- package/template-vue-rolldown-oxc/.env.production +0 -1
- package/template-vue-rolldown-oxc/.gitlab-ci.yml +0 -84
- package/template-vue-rolldown-oxc/.oxlintrc.json +0 -4
- package/template-vue-rolldown-oxc/.prettierignore +0 -34
- package/template-vue-rolldown-oxc/.prettierrc +0 -18
- package/template-vue-rolldown-oxc/.vscode/settings.json +0 -11
- package/template-vue-rolldown-oxc/README.md +0 -3
- package/template-vue-rolldown-oxc/commitlint.config.js +0 -1
- package/template-vue-rolldown-oxc/index.html +0 -13
- package/template-vue-rolldown-oxc/lefthook.yml +0 -11
- package/template-vue-rolldown-oxc/package.json +0 -55
- package/template-vue-rolldown-oxc/public/vite.svg +0 -1
- package/template-vue-rolldown-oxc/src/App.vue +0 -17
- package/template-vue-rolldown-oxc/src/assets/icon/vue.svg +0 -1
- package/template-vue-rolldown-oxc/src/components/Icon/svg-icon.vue +0 -29
- package/template-vue-rolldown-oxc/src/layout/default/index.vue +0 -3
- package/template-vue-rolldown-oxc/src/main.ts +0 -13
- package/template-vue-rolldown-oxc/src/router/guard/index.tsx +0 -7
- package/template-vue-rolldown-oxc/src/router/guard/permissionGuard.ts +0 -8
- package/template-vue-rolldown-oxc/src/router/index.tsx +0 -15
- package/template-vue-rolldown-oxc/src/router/modules/index.tsx +0 -31
- package/template-vue-rolldown-oxc/src/store/index.ts +0 -10
- package/template-vue-rolldown-oxc/src/store/modules/user.ts +0 -17
- package/template-vue-rolldown-oxc/src/styles/element-plus-variables.css +0 -4
- package/template-vue-rolldown-oxc/src/styles/font.scss +0 -0
- package/template-vue-rolldown-oxc/src/styles/index.scss +0 -31
- package/template-vue-rolldown-oxc/src/styles/variables.scss +0 -3
- package/template-vue-rolldown-oxc/src/utils/env.ts +0 -10
- package/template-vue-rolldown-oxc/src/utils/request/core/index.ts +0 -166
- package/template-vue-rolldown-oxc/src/utils/request/core/utils.ts +0 -38
- package/template-vue-rolldown-oxc/src/utils/request/index.ts +0 -39
- package/template-vue-rolldown-oxc/src/views/home/index.vue +0 -16
- package/template-vue-rolldown-oxc/src/views/model/index.vue +0 -7
- package/template-vue-rolldown-oxc/src/vite-env.d.ts +0 -13
- package/template-vue-rolldown-oxc/tsconfig.json +0 -36
- package/template-vue-rolldown-oxc/uno.config.ts +0 -10
- package/template-vue-rolldown-oxc/vite.config.ts +0 -51
- package/template-vue-vite-eslint/.env +0 -6
- package/template-vue-vite-eslint/.env.development +0 -2
- package/template-vue-vite-eslint/.env.production +0 -1
- package/template-vue-vite-eslint/README.md +0 -3
- package/template-vue-vite-eslint/commitlint.config.js +0 -1
- package/template-vue-vite-eslint/eslint.config.js +0 -69
- package/template-vue-vite-eslint/index.html +0 -13
- package/template-vue-vite-eslint/lefthook.yml +0 -11
- package/template-vue-vite-eslint/package.json +0 -56
- package/template-vue-vite-eslint/public/vite.svg +0 -1
- package/template-vue-vite-eslint/src/App.vue +0 -19
- package/template-vue-vite-eslint/src/api/index.ts +0 -12
- package/template-vue-vite-eslint/src/assets/icon/computer-data.svg +0 -3
- package/template-vue-vite-eslint/src/assets/icon/cpu.svg +0 -3
- package/template-vue-vite-eslint/src/assets/icon/data-search.svg +0 -3
- package/template-vue-vite-eslint/src/assets/icon/home.svg +0 -3
- package/template-vue-vite-eslint/src/assets/icon/knowledge-graph.svg +0 -3
- package/template-vue-vite-eslint/src/assets/icon/logo.svg +0 -1
- package/template-vue-vite-eslint/src/assets/icon/robot.svg +0 -3
- package/template-vue-vite-eslint/src/assets/image/.gitkeep +0 -0
- package/template-vue-vite-eslint/src/components/Icon/svg-icon.vue +0 -29
- package/template-vue-vite-eslint/src/hooks/chart/lib.ts +0 -57
- package/template-vue-vite-eslint/src/hooks/chart/useEcharts.ts +0 -65
- package/template-vue-vite-eslint/src/layout/default/header/index.vue +0 -12
- package/template-vue-vite-eslint/src/layout/default/index.vue +0 -55
- package/template-vue-vite-eslint/src/main.ts +0 -16
- package/template-vue-vite-eslint/src/router/guard/index.ts +0 -7
- package/template-vue-vite-eslint/src/router/guard/permissionGuard.ts +0 -13
- package/template-vue-vite-eslint/src/router/index.ts +0 -18
- package/template-vue-vite-eslint/src/router/interface.ts +0 -9
- package/template-vue-vite-eslint/src/router/modules/example.ts +0 -21
- package/template-vue-vite-eslint/src/router/modules/index.ts +0 -36
- package/template-vue-vite-eslint/src/store/index.ts +0 -11
- package/template-vue-vite-eslint/src/store/modules/user.ts +0 -20
- package/template-vue-vite-eslint/src/styles/font.scss +0 -0
- package/template-vue-vite-eslint/src/styles/index.scss +0 -29
- package/template-vue-vite-eslint/src/styles/variables.scss +0 -3
- package/template-vue-vite-eslint/src/types/auto-import.d.ts +0 -78
- package/template-vue-vite-eslint/src/types/components.d.ts +0 -18
- package/template-vue-vite-eslint/src/types/vite-env.d.ts +0 -15
- package/template-vue-vite-eslint/src/utils/env.ts +0 -11
- package/template-vue-vite-eslint/src/utils/request/core/index.ts +0 -186
- package/template-vue-vite-eslint/src/utils/request/core/utils.ts +0 -41
- package/template-vue-vite-eslint/src/utils/request/index.ts +0 -42
- package/template-vue-vite-eslint/src/views/example/echart/config.ts +0 -1794
- package/template-vue-vite-eslint/src/views/example/echart/index.vue +0 -22
- package/template-vue-vite-eslint/src/views/example/h-full.vue +0 -24
- package/template-vue-vite-eslint/src/views/example/tree-chart.vue +0 -94
- package/template-vue-vite-eslint/src/views/home/index.vue +0 -25
- package/template-vue-vite-eslint/src/views/login/index.vue +0 -9
- package/template-vue-vite-eslint/tsconfig.json +0 -36
- package/template-vue-vite-eslint/uno.config.ts +0 -21
- package/template-vue-vite-eslint/vite.config.ts +0 -60
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import type { Alova, AlovaDefaultCacheAdapter, AlovaOptions } from "alova";
|
|
2
|
-
import { createAlova } from "alova";
|
|
3
|
-
import adapterFetch, { type FetchRequestAdapter, type FetchRequestInit } from "alova/fetch";
|
|
4
|
-
import type { ReactHookExportType } from "alova/react";
|
|
5
|
-
|
|
6
|
-
import { deepMergeObject, isPlainObject } from "./utils";
|
|
7
|
-
|
|
8
|
-
type StatusMatcher = number | number[];
|
|
9
|
-
type HeaderValue = string | (() => string);
|
|
10
|
-
type RequestAlovaGenerics = {
|
|
11
|
-
Responded: unknown;
|
|
12
|
-
Transformed: unknown;
|
|
13
|
-
RequestConfig: FetchRequestInit;
|
|
14
|
-
Response: Response;
|
|
15
|
-
ResponseHeader: Headers;
|
|
16
|
-
L1Cache: AlovaDefaultCacheAdapter;
|
|
17
|
-
L2Cache: AlovaDefaultCacheAdapter;
|
|
18
|
-
StatesExport: ReactHookExportType<unknown>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
interface StatusMap {
|
|
22
|
-
success?: StatusMatcher;
|
|
23
|
-
unAuthorized?: StatusMatcher;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface CodeMap {
|
|
27
|
-
success?: number[];
|
|
28
|
-
unAuthorized?: number[];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface BaseRequestOption {
|
|
32
|
-
baseUrl?: string;
|
|
33
|
-
timeout?: number;
|
|
34
|
-
commonHeaders?: Record<string, HeaderValue>;
|
|
35
|
-
statusMap?: StatusMap;
|
|
36
|
-
codeMap?: CodeMap;
|
|
37
|
-
responseDataKey?: string;
|
|
38
|
-
responseMessageKey?: string;
|
|
39
|
-
isTransformResponse?: boolean;
|
|
40
|
-
isShowSuccessMessage?: boolean;
|
|
41
|
-
successDefaultMessage?: string;
|
|
42
|
-
isShowErrorMessage?: boolean;
|
|
43
|
-
errorDefaultMessage?: string;
|
|
44
|
-
statesHook?: AlovaOptions<RequestAlovaGenerics>["statesHook"];
|
|
45
|
-
successMessageFunc?: (message: string) => void;
|
|
46
|
-
errorMessageFunc?: (message: string) => void;
|
|
47
|
-
unAuthorizedResponseFunc?: () => void;
|
|
48
|
-
requestAdapter?: FetchRequestAdapter;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface CustomConfig {
|
|
52
|
-
isTransformResponse?: boolean;
|
|
53
|
-
isShowSuccessMessage?: boolean;
|
|
54
|
-
isShowErrorMessage?: boolean;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
declare module "alova" {
|
|
58
|
-
interface AlovaCustomTypes {
|
|
59
|
-
meta: CustomConfig;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
interface RequestErrorOptions {
|
|
64
|
-
status?: number;
|
|
65
|
-
code?: unknown;
|
|
66
|
-
data?: unknown;
|
|
67
|
-
response?: Response;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export class RequestError extends Error {
|
|
71
|
-
status?: number;
|
|
72
|
-
code?: unknown;
|
|
73
|
-
data?: unknown;
|
|
74
|
-
response?: Response;
|
|
75
|
-
|
|
76
|
-
constructor(message: string, options: RequestErrorOptions = {}) {
|
|
77
|
-
super(message);
|
|
78
|
-
this.name = "RequestError";
|
|
79
|
-
this.status = options.status;
|
|
80
|
-
this.code = options.code;
|
|
81
|
-
this.data = options.data;
|
|
82
|
-
this.response = options.response;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export type RequestInstance = Alova<RequestAlovaGenerics>;
|
|
87
|
-
export type DualCallInstance = RequestInstance & ((option?: CustomConfig) => RequestInstance);
|
|
88
|
-
|
|
89
|
-
type RequestOption = BaseRequestOption & CustomConfig;
|
|
90
|
-
|
|
91
|
-
const DEFAULT_REQUEST_ADAPTER = adapterFetch();
|
|
92
|
-
const DEFAULT_RESPONSE_DATA_KEY = "data";
|
|
93
|
-
const DEFAULT_RESPONSE_MESSAGE_KEY = "message";
|
|
94
|
-
const DEFAULT_SUCCESS_MESSAGE = "操作成功";
|
|
95
|
-
const DEFAULT_ERROR_MESSAGE = "服务异常";
|
|
96
|
-
const DEFAULT_REQUEST_OPTION: RequestOption = {
|
|
97
|
-
baseUrl: "/",
|
|
98
|
-
timeout: 0,
|
|
99
|
-
statusMap: {
|
|
100
|
-
success: [200, 201, 204],
|
|
101
|
-
unAuthorized: 401,
|
|
102
|
-
},
|
|
103
|
-
codeMap: {
|
|
104
|
-
success: [200],
|
|
105
|
-
unAuthorized: [401],
|
|
106
|
-
},
|
|
107
|
-
responseDataKey: DEFAULT_RESPONSE_DATA_KEY,
|
|
108
|
-
responseMessageKey: DEFAULT_RESPONSE_MESSAGE_KEY,
|
|
109
|
-
isTransformResponse: true,
|
|
110
|
-
isShowSuccessMessage: false,
|
|
111
|
-
successDefaultMessage: DEFAULT_SUCCESS_MESSAGE,
|
|
112
|
-
isShowErrorMessage: true,
|
|
113
|
-
errorDefaultMessage: DEFAULT_ERROR_MESSAGE,
|
|
114
|
-
requestAdapter: DEFAULT_REQUEST_ADAPTER,
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
function isMatchedStatus(status: number, matcher?: StatusMatcher) {
|
|
118
|
-
if (matcher === undefined) return status >= 200 && status < 300;
|
|
119
|
-
return Array.isArray(matcher) ? matcher.includes(status) : matcher === status;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function isMatchedCode(code: unknown, codes?: number[]) {
|
|
123
|
-
if (!codes?.length) return true;
|
|
124
|
-
|
|
125
|
-
const normalizedCode = Number(code);
|
|
126
|
-
return Number.isFinite(normalizedCode) && codes.includes(normalizedCode);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function getResponseMessage(data: unknown, messageKey: string, defaultMessage: string) {
|
|
130
|
-
if (!isPlainObject(data)) return defaultMessage;
|
|
131
|
-
|
|
132
|
-
const message = data[messageKey] ?? data.message ?? data.msg;
|
|
133
|
-
if (typeof message === "string") return message || defaultMessage;
|
|
134
|
-
if (typeof message === "number") return String(message);
|
|
135
|
-
|
|
136
|
-
return defaultMessage;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function getRuntimeConfig(option: RequestOption, customConfig?: CustomConfig) {
|
|
140
|
-
return {
|
|
141
|
-
isTransformResponse: customConfig?.isTransformResponse ?? option.isTransformResponse ?? true,
|
|
142
|
-
isShowSuccessMessage:
|
|
143
|
-
customConfig?.isShowSuccessMessage ?? option.isShowSuccessMessage ?? false,
|
|
144
|
-
isShowErrorMessage: customConfig?.isShowErrorMessage ?? option.isShowErrorMessage ?? true,
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
async function parseResponse(response: Response) {
|
|
149
|
-
if (!response.body || response.status === 204) return undefined;
|
|
150
|
-
|
|
151
|
-
const contentType = response.headers.get("content-type") ?? "";
|
|
152
|
-
if (contentType.includes("application/json")) return response.json();
|
|
153
|
-
if (contentType.startsWith("text/")) return response.text();
|
|
154
|
-
|
|
155
|
-
const clonedResponse = response.clone();
|
|
156
|
-
try {
|
|
157
|
-
return await response.json();
|
|
158
|
-
} catch {
|
|
159
|
-
try {
|
|
160
|
-
return await clonedResponse.text();
|
|
161
|
-
} catch {
|
|
162
|
-
return undefined;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export function createInstance(option: RequestOption): RequestInstance {
|
|
168
|
-
const mergeOption = deepMergeObject(DEFAULT_REQUEST_OPTION, option);
|
|
169
|
-
|
|
170
|
-
return createAlova({
|
|
171
|
-
baseURL: mergeOption.baseUrl,
|
|
172
|
-
timeout: mergeOption.timeout,
|
|
173
|
-
statesHook: mergeOption.statesHook,
|
|
174
|
-
requestAdapter: mergeOption.requestAdapter ?? DEFAULT_REQUEST_ADAPTER,
|
|
175
|
-
beforeRequest: (method) => {
|
|
176
|
-
for (const [key, value] of Object.entries(mergeOption.commonHeaders ?? {})) {
|
|
177
|
-
method.config.headers[key] = typeof value === "function" ? value() : value;
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
cacheFor: null,
|
|
181
|
-
responded: {
|
|
182
|
-
onSuccess: async (response, method) => {
|
|
183
|
-
const runtimeConfig = getRuntimeConfig(mergeOption, method.config.meta);
|
|
184
|
-
if (!runtimeConfig.isTransformResponse) return response;
|
|
185
|
-
|
|
186
|
-
const data = await parseResponse(response);
|
|
187
|
-
const responseMessageKey = mergeOption.responseMessageKey ?? DEFAULT_RESPONSE_MESSAGE_KEY;
|
|
188
|
-
const errorDefaultMessage = mergeOption.errorDefaultMessage ?? DEFAULT_ERROR_MESSAGE;
|
|
189
|
-
|
|
190
|
-
if (!isMatchedStatus(response.status, mergeOption.statusMap?.success)) {
|
|
191
|
-
if (isMatchedStatus(response.status, mergeOption.statusMap?.unAuthorized)) {
|
|
192
|
-
mergeOption.unAuthorizedResponseFunc?.();
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
const errorMessage = getResponseMessage(data, responseMessageKey, errorDefaultMessage);
|
|
196
|
-
if (runtimeConfig.isShowErrorMessage) {
|
|
197
|
-
mergeOption.errorMessageFunc?.(errorMessage);
|
|
198
|
-
}
|
|
199
|
-
throw new RequestError(errorMessage, {
|
|
200
|
-
status: response.status,
|
|
201
|
-
data,
|
|
202
|
-
response,
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (!isPlainObject(data)) return data;
|
|
207
|
-
|
|
208
|
-
const responseCode = data.code;
|
|
209
|
-
const responseMessage = getResponseMessage(
|
|
210
|
-
data,
|
|
211
|
-
responseMessageKey,
|
|
212
|
-
mergeOption.successDefaultMessage ?? DEFAULT_SUCCESS_MESSAGE,
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
if (
|
|
216
|
-
responseCode !== undefined &&
|
|
217
|
-
!isMatchedCode(responseCode, mergeOption.codeMap?.success)
|
|
218
|
-
) {
|
|
219
|
-
if (isMatchedCode(responseCode, mergeOption.codeMap?.unAuthorized)) {
|
|
220
|
-
mergeOption.unAuthorizedResponseFunc?.();
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
const errorMessage = getResponseMessage(data, responseMessageKey, errorDefaultMessage);
|
|
224
|
-
if (runtimeConfig.isShowErrorMessage) {
|
|
225
|
-
mergeOption.errorMessageFunc?.(errorMessage);
|
|
226
|
-
}
|
|
227
|
-
throw new RequestError(errorMessage, {
|
|
228
|
-
status: response.status,
|
|
229
|
-
code: responseCode,
|
|
230
|
-
data,
|
|
231
|
-
response,
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (runtimeConfig.isShowSuccessMessage) {
|
|
236
|
-
mergeOption.successMessageFunc?.(responseMessage);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
const responseDataKey = mergeOption.responseDataKey ?? DEFAULT_RESPONSE_DATA_KEY;
|
|
240
|
-
return responseDataKey in data ? data[responseDataKey] : data;
|
|
241
|
-
},
|
|
242
|
-
onError: (error) => {
|
|
243
|
-
const errorMessage =
|
|
244
|
-
error instanceof Error
|
|
245
|
-
? error.message
|
|
246
|
-
: (mergeOption.errorDefaultMessage ?? DEFAULT_ERROR_MESSAGE);
|
|
247
|
-
|
|
248
|
-
if (mergeOption.isShowErrorMessage) {
|
|
249
|
-
mergeOption.errorMessageFunc?.(errorMessage);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
throw error;
|
|
253
|
-
},
|
|
254
|
-
},
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
export function createDualCallInstance(baseConfig: BaseRequestOption): DualCallInstance {
|
|
259
|
-
const defaultInstance = createInstance(baseConfig);
|
|
260
|
-
const dualInstance = ((option?: CustomConfig) => {
|
|
261
|
-
if (!option) return defaultInstance;
|
|
262
|
-
return createInstance(deepMergeObject(baseConfig, option));
|
|
263
|
-
}) as DualCallInstance;
|
|
264
|
-
|
|
265
|
-
Object.assign(dualInstance, defaultInstance);
|
|
266
|
-
dualInstance.Get = defaultInstance.Get.bind(defaultInstance);
|
|
267
|
-
dualInstance.Post = defaultInstance.Post.bind(defaultInstance);
|
|
268
|
-
dualInstance.Put = defaultInstance.Put.bind(defaultInstance);
|
|
269
|
-
dualInstance.Delete = defaultInstance.Delete.bind(defaultInstance);
|
|
270
|
-
dualInstance.Patch = defaultInstance.Patch.bind(defaultInstance);
|
|
271
|
-
dualInstance.Head = defaultInstance.Head.bind(defaultInstance);
|
|
272
|
-
dualInstance.Options = defaultInstance.Options.bind(defaultInstance);
|
|
273
|
-
dualInstance.Request = defaultInstance.Request.bind(defaultInstance);
|
|
274
|
-
|
|
275
|
-
return dualInstance;
|
|
276
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
type AnyRecord = Record<string, unknown>;
|
|
2
|
-
|
|
3
|
-
export function isPlainObject(value: unknown): value is AnyRecord {
|
|
4
|
-
return (
|
|
5
|
-
value !== null &&
|
|
6
|
-
typeof value === "object" &&
|
|
7
|
-
!Array.isArray(value) &&
|
|
8
|
-
Object.getPrototypeOf(value) === Object.prototype
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function deepMergeObject<T extends object>(source: T, target: Partial<T>) {
|
|
13
|
-
const result = { ...source } as AnyRecord;
|
|
14
|
-
|
|
15
|
-
for (const [key, value] of Object.entries(target)) {
|
|
16
|
-
const sourceValue = result[key];
|
|
17
|
-
result[key] =
|
|
18
|
-
isPlainObject(sourceValue) && isPlainObject(value)
|
|
19
|
-
? deepMergeObject(sourceValue, value)
|
|
20
|
-
: value;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return result as T;
|
|
24
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import reactHook from "alova/react";
|
|
2
|
-
import { toast } from "sonner";
|
|
3
|
-
|
|
4
|
-
import { navigator } from "@/router";
|
|
5
|
-
import { envVariables } from "@/utils/env";
|
|
6
|
-
|
|
7
|
-
import { createDualCallInstance } from "./alova-core";
|
|
8
|
-
|
|
9
|
-
function normalizeBaseUrl(apiAffix?: string) {
|
|
10
|
-
if (!apiAffix) return "/";
|
|
11
|
-
if (/^https?:\/\//.test(apiAffix) || apiAffix.startsWith("/")) {
|
|
12
|
-
return apiAffix;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return `/${apiAffix}`;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function getBaseConfig(): Parameters<typeof createDualCallInstance>[0] {
|
|
19
|
-
return {
|
|
20
|
-
baseUrl: normalizeBaseUrl(envVariables.API_AFFIX),
|
|
21
|
-
statusMap: {
|
|
22
|
-
success: [200, 201, 204],
|
|
23
|
-
unAuthorized: 401,
|
|
24
|
-
},
|
|
25
|
-
codeMap: {
|
|
26
|
-
success: [200],
|
|
27
|
-
unAuthorized: [401],
|
|
28
|
-
},
|
|
29
|
-
responseDataKey: "data",
|
|
30
|
-
responseMessageKey: "msg",
|
|
31
|
-
commonHeaders: {},
|
|
32
|
-
successMessageFunc: (msg) => {
|
|
33
|
-
toast.success(msg);
|
|
34
|
-
},
|
|
35
|
-
errorMessageFunc: (msg) => {
|
|
36
|
-
toast.error(msg);
|
|
37
|
-
},
|
|
38
|
-
unAuthorizedResponseFunc: () => {
|
|
39
|
-
navigator("/login");
|
|
40
|
-
toast.error("登录过期或未登录");
|
|
41
|
-
},
|
|
42
|
-
statesHook: reactHook,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const alovaRequest = createDualCallInstance(getBaseConfig());
|
|
47
|
-
|
|
48
|
-
export default alovaRequest;
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
# request 使用说明
|
|
2
|
-
|
|
3
|
-
`src/utils/request/index.ts` 导出的是项目统一的 alova 请求实例,业务接口建议统一放在 `src/api` 里封装,页面和组件不要直接散写请求配置。
|
|
4
|
-
|
|
5
|
-
## 基础用法
|
|
6
|
-
|
|
7
|
-
请求方法会创建 alova `Method` 实例,不会在创建时立刻发送请求。可以在组件中交给 `useRequest`,也可以在普通函数里直接 `await`。
|
|
8
|
-
|
|
9
|
-
```ts
|
|
10
|
-
import alovaRequest from "@/utils/request";
|
|
11
|
-
|
|
12
|
-
interface DramaItem {
|
|
13
|
-
id: number;
|
|
14
|
-
title: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface DramaListParams {
|
|
18
|
-
page: number;
|
|
19
|
-
pageSize: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const getDramaList = (params: DramaListParams) => {
|
|
23
|
-
return alovaRequest.Get<DramaItem[]>("/drama/list", { params });
|
|
24
|
-
};
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
组件中使用:
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
import { useRequest } from "alova/client";
|
|
31
|
-
|
|
32
|
-
import { getDramaList } from "@/api";
|
|
33
|
-
|
|
34
|
-
export function DramaList() {
|
|
35
|
-
const { data, loading, error } = useRequest(getDramaList({ page: 1, pageSize: 20 }), {
|
|
36
|
-
initialData: [],
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// ...
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
普通异步函数中使用:
|
|
44
|
-
|
|
45
|
-
```ts
|
|
46
|
-
const list = await getDramaList({ page: 1, pageSize: 20 });
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## 请求参数
|
|
50
|
-
|
|
51
|
-
GET 查询参数放在第二个参数的 `params` 里:
|
|
52
|
-
|
|
53
|
-
```ts
|
|
54
|
-
alovaRequest.Get<UserInfo>("/user/detail", {
|
|
55
|
-
params: {
|
|
56
|
-
id: 1,
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
POST、PUT、PATCH、DELETE 的 body 放在第二个参数,配置放在第三个参数:
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
alovaRequest.Post<CreateUserResult>("/user/create", {
|
|
65
|
-
name: "Tom",
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
alovaRequest.Post<CreateUserResult>(
|
|
69
|
-
"/user/create",
|
|
70
|
-
{ name: "Tom" },
|
|
71
|
-
{
|
|
72
|
-
meta: {
|
|
73
|
-
isShowSuccessMessage: true,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
);
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## 返回结构
|
|
80
|
-
|
|
81
|
-
默认按下面这种后端格式处理:
|
|
82
|
-
|
|
83
|
-
```ts
|
|
84
|
-
interface ApiResponse<T> {
|
|
85
|
-
code: number;
|
|
86
|
-
data: T;
|
|
87
|
-
msg: string;
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
默认规则:
|
|
92
|
-
|
|
93
|
-
- HTTP 状态码 `200`、`201`、`204` 视为成功。
|
|
94
|
-
- 业务 `code` 在 `codeMap.success` 中视为成功,当前默认是 `[200]`。
|
|
95
|
-
- 成功后返回 `data` 字段,所以 `alovaRequest.Get<User[]>` 的最终数据类型就是 `User[]`。
|
|
96
|
-
- 如果响应不是普通对象,会直接返回解析后的原始数据,比如字符串。
|
|
97
|
-
|
|
98
|
-
## 提示开关
|
|
99
|
-
|
|
100
|
-
单次请求可以通过 `meta` 控制是否转换响应、是否显示成功提示、是否显示错误提示。
|
|
101
|
-
|
|
102
|
-
```ts
|
|
103
|
-
alovaRequest.Post(
|
|
104
|
-
"/user/update",
|
|
105
|
-
{ id: 1, name: "Tom" },
|
|
106
|
-
{
|
|
107
|
-
meta: {
|
|
108
|
-
isShowSuccessMessage: true,
|
|
109
|
-
isShowErrorMessage: false,
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
);
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
也可以创建一个带临时配置的请求实例:
|
|
116
|
-
|
|
117
|
-
```ts
|
|
118
|
-
const silentRequest = alovaRequest({
|
|
119
|
-
isShowErrorMessage: false,
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
silentRequest.Get<UserInfo>("/user/detail", {
|
|
123
|
-
params: { id: 1 },
|
|
124
|
-
});
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## 原始响应
|
|
128
|
-
|
|
129
|
-
下载文件、读取响应头、或不想走业务 `code/data/msg` 转换时,关闭 `isTransformResponse`。
|
|
130
|
-
|
|
131
|
-
```ts
|
|
132
|
-
const downloadFile = () => {
|
|
133
|
-
return alovaRequest.Get<Response>("/file/download", {
|
|
134
|
-
meta: {
|
|
135
|
-
isTransformResponse: false,
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
const response = await downloadFile();
|
|
141
|
-
const blob = await response.blob();
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## 错误处理
|
|
145
|
-
|
|
146
|
-
HTTP 状态码错误、业务 `code` 错误都会抛出 `RequestError`,alova hook 会进入 `error` 分支。
|
|
147
|
-
|
|
148
|
-
```ts
|
|
149
|
-
import { RequestError } from "@/utils/request/alova-core";
|
|
150
|
-
|
|
151
|
-
try {
|
|
152
|
-
await getDramaList({ page: 1, pageSize: 20 });
|
|
153
|
-
} catch (error) {
|
|
154
|
-
if (error instanceof RequestError) {
|
|
155
|
-
console.log(error.status, error.code, error.message);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
`401` 会自动执行 `unAuthorizedResponseFunc`,当前行为是跳转到 `/login` 并提示登录过期。
|
|
161
|
-
|
|
162
|
-
## 环境变量
|
|
163
|
-
|
|
164
|
-
请求基础路径来自 `VITE_API_AFFIX`:
|
|
165
|
-
|
|
166
|
-
```env
|
|
167
|
-
VITE_API_AFFIX=/api
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
没有配置时会使用 `/`,避免出现 `/undefined`。
|
|
171
|
-
|
|
172
|
-
## 注意事项
|
|
173
|
-
|
|
174
|
-
- 业务接口优先写成函数并标注返回泛型,例如 `alovaRequest.Get<UserInfo>()`,组件里的 `useRequest` 会自动推断数据类型。
|
|
175
|
-
- 不要把 GET 查询参数直接作为第二个裸对象传入,第二个参数是配置对象,查询参数必须放到 `{ params }`。
|
|
176
|
-
- 需要局部关闭错误提示时优先用 `meta.isShowErrorMessage`,不要在组件里重复 toast。
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2023",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
|
7
|
-
"types": ["vite/client"],
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
|
|
10
|
-
/* Bundler mode */
|
|
11
|
-
"moduleResolution": "bundler",
|
|
12
|
-
"allowImportingTsExtensions": true,
|
|
13
|
-
"verbatimModuleSyntax": true,
|
|
14
|
-
"moduleDetection": "force",
|
|
15
|
-
"noEmit": true,
|
|
16
|
-
"jsx": "react-jsx",
|
|
17
|
-
|
|
18
|
-
/* Linting */
|
|
19
|
-
"strict": true,
|
|
20
|
-
"noUnusedLocals": true,
|
|
21
|
-
"noUnusedParameters": true,
|
|
22
|
-
"erasableSyntaxOnly": true,
|
|
23
|
-
"noFallthroughCasesInSwitch": true,
|
|
24
|
-
"noUncheckedSideEffectImports": true,
|
|
25
|
-
|
|
26
|
-
"baseUrl": ".",
|
|
27
|
-
"paths": {
|
|
28
|
-
"@/*": ["src/*"]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"include": ["src"]
|
|
32
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
|
|
3
|
-
import tailwindcss from "@tailwindcss/vite";
|
|
4
|
-
import react from "@vitejs/plugin-react";
|
|
5
|
-
import AutoImport from "unplugin-auto-import/vite";
|
|
6
|
-
import { defineConfig, loadEnv } from "vite-plus";
|
|
7
|
-
|
|
8
|
-
export default defineConfig(({ mode }) => {
|
|
9
|
-
const root = process.cwd();
|
|
10
|
-
const env = loadEnv(mode, root);
|
|
11
|
-
const { VITE_PORT } = env;
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
resolve: {
|
|
15
|
-
alias: {
|
|
16
|
-
"@": path.resolve(__dirname, "src"),
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
server: {
|
|
20
|
-
port: Number(VITE_PORT),
|
|
21
|
-
host: "0.0.0.0",
|
|
22
|
-
},
|
|
23
|
-
plugins: [
|
|
24
|
-
react(),
|
|
25
|
-
AutoImport({
|
|
26
|
-
imports: ["react", "react-router", "react-dom"],
|
|
27
|
-
dts: "./src/types/auto-imports.d.ts",
|
|
28
|
-
}),
|
|
29
|
-
tailwindcss(),
|
|
30
|
-
],
|
|
31
|
-
staged: {
|
|
32
|
-
"*": "vp check --fix",
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
PUBLIC_API_URL = 'http://localhost:8080'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
PUBLIC_API_URL = 'http://localhost:8080'
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
.send_dingtalk_notification: &send_dingtalk_notification |
|
|
2
|
-
case "$CI_JOB_STAGE" in
|
|
3
|
-
"build")
|
|
4
|
-
stage_name="构建"
|
|
5
|
-
;;
|
|
6
|
-
"deploy")
|
|
7
|
-
stage_name="部署"
|
|
8
|
-
;;
|
|
9
|
-
esac
|
|
10
|
-
|
|
11
|
-
if [ "$CI_JOB_STATUS" == "success" ]; then
|
|
12
|
-
title="==✅ ${stage_name}成功=="
|
|
13
|
-
else
|
|
14
|
-
title="==❌ ${stage_name}失败=="
|
|
15
|
-
fi
|
|
16
|
-
|
|
17
|
-
curl -s -X POST ${DINGTALK_WEBHOOK} \
|
|
18
|
-
-H "Content-Type: application/json" \
|
|
19
|
-
-d "{
|
|
20
|
-
\"msgtype\": \"markdown\",
|
|
21
|
-
\"markdown\": {
|
|
22
|
-
\"title\": \"GitLab CI/CD 通知\",
|
|
23
|
-
\"text\": \"### ${title}\n\n- **项目**: ${CI_PROJECT_NAME}\n- **项目地址**: ${CI_PROJECT_URL}\n- **阶段**: ${stage_name}\n- **任务**: [查看详情](${CI_JOB_URL})\n- **分支**: ${CI_COMMIT_REF_NAME}\n- **提交人**: ${CI_COMMIT_AUTHOR}\n- **提交信息**: ${CI_COMMIT_MESSAGE}\n- **时间**: $(date '+%Y-%m-%d %H:%M:%S')\"
|
|
24
|
-
}
|
|
25
|
-
}"
|
|
26
|
-
|
|
27
|
-
stages:
|
|
28
|
-
- build
|
|
29
|
-
- deploy
|
|
30
|
-
|
|
31
|
-
variables:
|
|
32
|
-
DEPLOY_PATH: '/usr/local/bee/web/pipe-network/pipe-network-model'
|
|
33
|
-
MOCK_DEPLOY_PATH: '/usr/local/bee/web/pipe-network/pipe-network-model-mock'
|
|
34
|
-
DINGTALK_WEBHOOK: 'https://oapi.dingtalk.com/robot/send?access_token=${DING_TALK_ACCESS_TOKEN}'
|
|
35
|
-
|
|
36
|
-
cache:
|
|
37
|
-
paths:
|
|
38
|
-
- node_modules/
|
|
39
|
-
|
|
40
|
-
# 打包
|
|
41
|
-
build:
|
|
42
|
-
stage: build
|
|
43
|
-
script:
|
|
44
|
-
- cd ${CI_PROJECT_DIR}
|
|
45
|
-
- whoami
|
|
46
|
-
- echo "===== 开始构建 ====="
|
|
47
|
-
- pnpm install
|
|
48
|
-
- pnpm build
|
|
49
|
-
- echo "===== 构建完成 ====="
|
|
50
|
-
only:
|
|
51
|
-
- dev
|
|
52
|
-
- mock
|
|
53
|
-
artifacts:
|
|
54
|
-
paths:
|
|
55
|
-
- dist/
|
|
56
|
-
after_script:
|
|
57
|
-
#钉钉通知
|
|
58
|
-
- *send_dingtalk_notification
|
|
59
|
-
|
|
60
|
-
# 部署
|
|
61
|
-
deploy:
|
|
62
|
-
stage: deploy
|
|
63
|
-
needs: ['build']
|
|
64
|
-
only:
|
|
65
|
-
- dev
|
|
66
|
-
- mock
|
|
67
|
-
script:
|
|
68
|
-
- echo "-----------------开始部署------------------"
|
|
69
|
-
- |
|
|
70
|
-
if [ "$CI_COMMIT_BRANCH" == "dev" ]; then
|
|
71
|
-
ssh root@192.168.2.245 "rm -rf $DEPLOY_PATH/*" || { echo "❌ 清理245失败"; exit 1; }
|
|
72
|
-
scp -r dist/* root@192.168.2.245:$DEPLOY_PATH || { echo "❌ 传输到245失败"; exit 1; }
|
|
73
|
-
ssh root@192.168.2.57 "rm -rf $DEPLOY_PATH/*" || { echo "❌ 清理57失败"; exit 1; }
|
|
74
|
-
scp -r dist/* root@192.168.2.57:$DEPLOY_PATH || { echo "❌ 传输到57失败"; exit 1; }
|
|
75
|
-
elif [ "$CI_COMMIT_BRANCH" == "mock" ]; then
|
|
76
|
-
ssh root@192.168.2.57 "rm -rf $MOCK_DEPLOY_PATH/*" || { echo "❌ 清理57失败"; exit 1; }
|
|
77
|
-
scp -r dist/* root@192.168.2.57:$MOCK_DEPLOY_PATH || { echo "❌ 传输到57失败"; exit 1; }
|
|
78
|
-
else
|
|
79
|
-
echo "没有匹配到需要部署的分支或标签,跳过部署"
|
|
80
|
-
exit 0
|
|
81
|
-
fi
|
|
82
|
-
after_script:
|
|
83
|
-
#钉钉通知
|
|
84
|
-
- *send_dingtalk_notification
|