create-bubbles 0.1.11 → 0.1.13
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 +2 -1
- package/package.json +1 -1
- package/template-vp-monorepo-react-nestjs/.oxfmtrc.jsonc +8 -0
- package/template-vp-monorepo-react-nestjs/.oxlintrc.jsonc +3 -0
- package/template-vp-monorepo-react-nestjs/.specs//351/234/200/346/261/202.md +5 -0
- package/template-vp-monorepo-react-nestjs/.vite-hooks/commit-msg +1 -0
- package/template-vp-monorepo-react-nestjs/.vite-hooks/pre-commit +1 -0
- package/template-vp-monorepo-react-nestjs/.vscode/extensions.json +3 -0
- package/template-vp-monorepo-react-nestjs/README.md +29 -0
- package/template-vp-monorepo-react-nestjs/apps/service/.oxlintrc.jsonc +3 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.env +1 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.oxlintrc.jsonc +4 -0
- package/{template-vue-vite-biome → template-vp-monorepo-react-nestjs/apps/web}/index.html +4 -4
- package/template-vp-monorepo-react-nestjs/apps/web/package.json +39 -0
- package/template-vp-monorepo-react-nestjs/apps/web/public/favicon.svg +1 -0
- package/template-vp-monorepo-react-nestjs/apps/web/public/icons.svg +24 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/App.tsx +24 -0
- 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 +1 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/assets/vite.svg +1 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/Loading/PageLoading.tsx +11 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/main.tsx +5 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/home/index.tsx +17 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/router/index.tsx +25 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/styles/index.css +7 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/types/auto-imports.d.ts +58 -0
- package/{template-vue-vite-biome → template-vp-monorepo-react-nestjs/apps/web}/tsconfig.json +5 -9
- package/template-vp-monorepo-react-nestjs/apps/web/vite.config.ts +32 -0
- package/template-vp-monorepo-react-nestjs/commitlint.config.js +0 -0
- package/template-vp-monorepo-react-nestjs/package.json +20 -0
- package/template-vp-monorepo-react-nestjs/packages/utils/README.md +23 -0
- package/template-vp-monorepo-react-nestjs/packages/utils/package.json +39 -0
- package/template-vp-monorepo-react-nestjs/packages/utils/src/index.ts +3 -0
- package/template-vp-monorepo-react-nestjs/packages/utils/tests/index.test.ts +6 -0
- package/template-vp-monorepo-react-nestjs/packages/utils/tsconfig.json +20 -0
- package/template-vp-monorepo-react-nestjs/packages/utils/tsdown.config.ts +9 -0
- package/template-vp-monorepo-react-nestjs/packages/utils/vite.config.ts +7 -0
- package/template-vp-monorepo-react-nestjs/pnpm-workspace.yaml +23 -0
- package/template-vp-monorepo-react-nestjs/tsconfig.json +9 -0
- package/template-vp-monorepo-react-nestjs/vite.config.ts +8 -0
- package/template-vp-react/.vscode/settings.json +11 -0
- package/template-vp-react/package.json +10 -10
- package/template-vp-react-shadcn/.env +1 -0
- package/template-vp-react-shadcn/.oxfmtrc.jsonc +8 -0
- package/template-vp-react-shadcn/.oxlintrc.jsonc +3 -0
- package/template-vp-react-shadcn/.vite-hooks/commit-msg +1 -0
- package/template-vp-react-shadcn/.vite-hooks/pre-commit +1 -0
- package/template-vp-react-shadcn/.vscode/extensions.json +3 -0
- package/template-vp-react-shadcn/.vscode/settings.json +12 -0
- package/template-vp-react-shadcn/agents.md +44 -0
- package/template-vp-react-shadcn/commitlint.config.js +1 -0
- package/template-vp-react-shadcn/components.json +25 -0
- package/template-vp-react-shadcn/index.html +13 -0
- package/template-vp-react-shadcn/package.json +56 -0
- package/template-vp-react-shadcn/public/favicon.svg +1 -0
- package/template-vp-react-shadcn/public/icons.svg +24 -0
- package/template-vp-react-shadcn/src/App.tsx +24 -0
- package/template-vp-react-shadcn/src/assets/hero.png +0 -0
- package/template-vp-react-shadcn/src/assets/react.svg +1 -0
- package/template-vp-react-shadcn/src/assets/vite.svg +1 -0
- package/template-vp-react-shadcn/src/components/Loading/PageLoading.tsx +11 -0
- package/template-vp-react-shadcn/src/components/Player/VideoJS/index.tsx +163 -0
- package/template-vp-react-shadcn/src/components/Player/index.ts +7 -0
- package/template-vp-react-shadcn/src/components/ui/button.tsx +67 -0
- package/template-vp-react-shadcn/src/components/ui/sonner.tsx +43 -0
- package/template-vp-react-shadcn/src/components/ui/spinner.tsx +17 -0
- package/template-vp-react-shadcn/src/hooks/.gitkeep +0 -0
- package/template-vp-react-shadcn/src/lib/utils.ts +6 -0
- package/template-vp-react-shadcn/src/main.tsx +5 -0
- package/template-vp-react-shadcn/src/pages/home/index.tsx +96 -0
- package/template-vp-react-shadcn/src/router/index.tsx +25 -0
- 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 +16 -0
- package/template-vp-react-shadcn/src/styles/shadcn.css +127 -0
- package/template-vp-react-shadcn/src/types/auto-imports.d.ts +58 -0
- package/template-vp-react-shadcn/src/utils/env/index.tsx +6 -0
- package/template-vp-react-shadcn/src/utils/request/alova-core/index.ts +276 -0
- package/template-vp-react-shadcn/src/utils/request/alova-core/utils.ts +24 -0
- package/template-vp-react-shadcn/src/utils/request/index.ts +48 -0
- package/template-vp-react-shadcn/src/utils/request/readme.md +176 -0
- package/template-vp-react-shadcn/tsconfig.json +32 -0
- package/template-vp-react-shadcn/vite.config.ts +35 -0
- package/template-vue-vite-eslint/package.json +29 -33
- package/template-vue-vite-eslint/src/main.ts +0 -1
- package/template-vue-vite-eslint/src/styles/index.scss +0 -3
- package/template-vue-vite-eslint/src/types/components.d.ts +0 -4
- package/template-vue-vite-eslint/src/utils/request/index.ts +4 -4
- package/template-vue-vite-eslint/vite.config.ts +2 -4
- package/template-vue-rsbuild-biome/.env +0 -5
- package/template-vue-rsbuild-biome/.env.development +0 -1
- package/template-vue-rsbuild-biome/.env.production +0 -1
- package/template-vue-rsbuild-biome/.prettierignore +0 -4
- package/template-vue-rsbuild-biome/.prettierrc +0 -18
- package/template-vue-rsbuild-biome/.vscode/settings.json +0 -13
- package/template-vue-rsbuild-biome/README.md +0 -29
- package/template-vue-rsbuild-biome/biome.json +0 -109
- package/template-vue-rsbuild-biome/index.html +0 -7
- package/template-vue-rsbuild-biome/lefthook.yml +0 -11
- package/template-vue-rsbuild-biome/package.json +0 -36
- package/template-vue-rsbuild-biome/rsbuild.config.ts +0 -41
- package/template-vue-rsbuild-biome/src/App.vue +0 -3
- package/template-vue-rsbuild-biome/src/index.ts +0 -13
- package/template-vue-rsbuild-biome/src/router/guard/index.tsx +0 -6
- package/template-vue-rsbuild-biome/src/router/guard/permissionGuard.ts +0 -8
- package/template-vue-rsbuild-biome/src/router/index.tsx +0 -14
- package/template-vue-rsbuild-biome/src/router/modules/index.tsx +0 -10
- package/template-vue-rsbuild-biome/src/store/index.ts +0 -7
- package/template-vue-rsbuild-biome/src/store/modules/user.ts +0 -17
- package/template-vue-rsbuild-biome/src/styles/index.css +0 -16
- package/template-vue-rsbuild-biome/src/types/auto-import.d.ts +0 -78
- package/template-vue-rsbuild-biome/src/types/components.d.ts +0 -15
- package/template-vue-rsbuild-biome/src/types/env.d.ts +0 -17
- package/template-vue-rsbuild-biome/src/utils/env.ts +0 -10
- package/template-vue-rsbuild-biome/src/utils/request/core/index.ts +0 -166
- package/template-vue-rsbuild-biome/src/utils/request/core/utils.ts +0 -38
- package/template-vue-rsbuild-biome/src/utils/request/index.ts +0 -39
- package/template-vue-rsbuild-biome/src/views/home/index.vue +0 -14
- package/template-vue-rsbuild-biome/tsconfig.json +0 -29
- package/template-vue-rsbuild-biome/uno.config.ts +0 -9
- package/template-vue-vite-biome/.env +0 -4
- package/template-vue-vite-biome/.env.development +0 -1
- package/template-vue-vite-biome/.env.production +0 -1
- package/template-vue-vite-biome/.gitlab-ci.yml +0 -84
- package/template-vue-vite-biome/.vscode/settings.json +0 -10
- package/template-vue-vite-biome/README.md +0 -3
- package/template-vue-vite-biome/biome.json +0 -109
- package/template-vue-vite-biome/commitlint.config.js +0 -1
- package/template-vue-vite-biome/lefthook.yml +0 -11
- package/template-vue-vite-biome/package.json +0 -50
- package/template-vue-vite-biome/public/vite.svg +0 -1
- package/template-vue-vite-biome/src/App.vue +0 -19
- package/template-vue-vite-biome/src/assets/icon/vue.svg +0 -1
- package/template-vue-vite-biome/src/components/Icon/svg-icon.vue +0 -29
- package/template-vue-vite-biome/src/layout/default/index.vue +0 -3
- package/template-vue-vite-biome/src/main.ts +0 -15
- package/template-vue-vite-biome/src/router/guard/index.ts +0 -7
- package/template-vue-vite-biome/src/router/guard/permissionGuard.ts +0 -13
- package/template-vue-vite-biome/src/router/index.ts +0 -17
- package/template-vue-vite-biome/src/router/modules/index.ts +0 -31
- package/template-vue-vite-biome/src/store/index.ts +0 -10
- package/template-vue-vite-biome/src/store/modules/user.ts +0 -17
- package/template-vue-vite-biome/src/styles/element-plus-variables.css +0 -4
- package/template-vue-vite-biome/src/styles/index.scss +0 -31
- package/template-vue-vite-biome/src/styles/variables.scss +0 -3
- package/template-vue-vite-biome/src/types/vite-env.d.ts +0 -13
- package/template-vue-vite-biome/src/utils/env.ts +0 -10
- package/template-vue-vite-biome/src/utils/request/core/index.ts +0 -166
- package/template-vue-vite-biome/src/utils/request/core/utils.ts +0 -38
- package/template-vue-vite-biome/src/utils/request/index.ts +0 -39
- package/template-vue-vite-biome/src/views/home/index.vue +0 -16
- package/template-vue-vite-biome/src/views/login/index.vue +0 -11
- package/template-vue-vite-biome/src/views/model/index.vue +0 -7
- package/template-vue-vite-biome/uno.config.ts +0 -10
- package/template-vue-vite-biome/vite.config.ts +0 -51
- package/template-vue-vite-eslint/.vscode/settings.json +0 -62
- package/template-vue-vite-eslint/src/styles/element-plus-variables.css +0 -3
- package/template-vue-vite-eslint/src/styles/plus-pro-components-variables.css +0 -3
- package/template-vue-vite-eslint/src/types/index.d.ts +0 -1
- /package/{template-vue-rsbuild-biome/public → template-vp-monorepo-react-nestjs/apps/web/src/router/modules}/.gitkeep +0 -0
- /package/{template-vue-vite-biome/src/styles/font.scss → template-vp-react-shadcn/src/api/.gitkeep} +0 -0
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Router } from 'vue-router'
|
|
2
|
-
|
|
3
|
-
import NProgress from 'nprogress'
|
|
4
|
-
|
|
5
|
-
export const createPermissionGuard = (router: Router) => {
|
|
6
|
-
router.beforeEach((to, from, next) => {
|
|
7
|
-
NProgress.start()
|
|
8
|
-
next()
|
|
9
|
-
})
|
|
10
|
-
router.afterEach((to, from) => {
|
|
11
|
-
NProgress.done()
|
|
12
|
-
})
|
|
13
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { App } from 'vue'
|
|
2
|
-
import { createRouter, createWebHistory } from 'vue-router'
|
|
3
|
-
|
|
4
|
-
import { setupGuard } from './guard'
|
|
5
|
-
import { routes } from './modules'
|
|
6
|
-
|
|
7
|
-
export const router = createRouter({
|
|
8
|
-
history: createWebHistory(import.meta.env.PUBLIC_PATH),
|
|
9
|
-
routes: routes,
|
|
10
|
-
strict: true,
|
|
11
|
-
scrollBehavior: () => ({ left: 0, top: 0 }),
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
export const setupRouter = (app: App) => {
|
|
15
|
-
setupGuard(router)
|
|
16
|
-
app.use(router)
|
|
17
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { RouteRecordRaw } from 'vue-router'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* IsMaskAll 代表 是不是要和模型交互 为true 全部遮罩
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export const routes: RouteRecordRaw[] = [
|
|
8
|
-
{
|
|
9
|
-
path: '/',
|
|
10
|
-
name: 'layout',
|
|
11
|
-
component: () => import('@/layout/default/index.vue'),
|
|
12
|
-
children: [
|
|
13
|
-
{
|
|
14
|
-
path: '/',
|
|
15
|
-
redirect: '/home',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
path: '/home',
|
|
19
|
-
name: 'Home',
|
|
20
|
-
meta: { title: '研发A区数字孪生可视化大屏' },
|
|
21
|
-
component: () => import('@/views/home/index.vue'),
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
path: '/login',
|
|
27
|
-
name: 'login',
|
|
28
|
-
meta: { title: '登录' },
|
|
29
|
-
component: () => import('@/views/login/index.vue'),
|
|
30
|
-
},
|
|
31
|
-
]
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { App } from 'vue'
|
|
2
|
-
import { createPinia } from 'pinia'
|
|
3
|
-
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
|
|
4
|
-
|
|
5
|
-
export const store = createPinia()
|
|
6
|
-
store.use(piniaPluginPersistedstate)
|
|
7
|
-
|
|
8
|
-
export const setupStore = (app: App) => {
|
|
9
|
-
app.use(store)
|
|
10
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { defineStore } from "pinia";
|
|
2
|
-
import { store } from "..";
|
|
3
|
-
|
|
4
|
-
export const useUserStore = defineStore(
|
|
5
|
-
'user',{
|
|
6
|
-
state: () => {
|
|
7
|
-
return {
|
|
8
|
-
name: 'admin',
|
|
9
|
-
token: 'admin',
|
|
10
|
-
avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif'
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
export function useUserStoreWithOut() {
|
|
16
|
-
return useUserStore(store);
|
|
17
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
@use './font.scss';
|
|
2
|
-
@use './variables.scss';
|
|
3
|
-
@use './element-plus-variables.css';
|
|
4
|
-
@unocss;
|
|
5
|
-
|
|
6
|
-
html,
|
|
7
|
-
body,
|
|
8
|
-
#root {
|
|
9
|
-
width: 100%;
|
|
10
|
-
height: 100%;
|
|
11
|
-
font-family: 'SourceHanSansCN';
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
*,
|
|
15
|
-
*::before,
|
|
16
|
-
*::after {
|
|
17
|
-
margin: 0;
|
|
18
|
-
padding: 0;
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
//弹窗的标题样式
|
|
23
|
-
.dialog-title {
|
|
24
|
-
border-left: 3px solid #22b5ffff;
|
|
25
|
-
padding-left: 10px;
|
|
26
|
-
height: 16px;
|
|
27
|
-
color: #ffffffb8;
|
|
28
|
-
font: 700;
|
|
29
|
-
font-size: 16px;
|
|
30
|
-
line-height: 16px;
|
|
31
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
2
|
-
|
|
3
|
-
declare module '*.vue' {
|
|
4
|
-
import type { DefineComponent } from 'vue'
|
|
5
|
-
const component: DefineComponent<{}, {}, any>
|
|
6
|
-
export default component
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// vite-plugin-svg-icons 类型声明
|
|
10
|
-
declare module 'virtual:svg-icons-register' {
|
|
11
|
-
const register: () => void
|
|
12
|
-
export default register
|
|
13
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 通过一个文件导出所有的环境变量这样方便统一修改
|
|
3
|
-
* @returns
|
|
4
|
-
*/
|
|
5
|
-
export const envVariables = {
|
|
6
|
-
PUBLIC_PORT: import.meta.env.PUBLIC_PORT,
|
|
7
|
-
PUBLIC_PATH: import.meta.env.PUBLIC_PATH,
|
|
8
|
-
PUBLIC_APP_NAME: import.meta.env.PUBLIC_APP_NAME,
|
|
9
|
-
PUBLIC_API_AFFIX: import.meta.env.PUBLIC_API_AFFIX,
|
|
10
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { type AlovaGenerics, type AlovaOptions, createAlova } from 'alova'
|
|
2
|
-
import { deepMergeObject, isReadableStream } from './utils'
|
|
3
|
-
import adapterFetch from 'alova/fetch'
|
|
4
|
-
|
|
5
|
-
interface statusMap {
|
|
6
|
-
success?: number
|
|
7
|
-
unAuthorized?: number
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface codeMap {
|
|
11
|
-
success?: number[]
|
|
12
|
-
unAuthorized?: number[]
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface baseRequestOption<AG extends AlovaGenerics> {
|
|
16
|
-
baseUrl?: string
|
|
17
|
-
timeout?: number
|
|
18
|
-
commonHeaders?: Record<string, string | (() => string)>
|
|
19
|
-
statusMap?: statusMap
|
|
20
|
-
codeMap?: codeMap
|
|
21
|
-
responseDataKey?: string
|
|
22
|
-
responseMessageKey?: string
|
|
23
|
-
isTransformResponse?: boolean
|
|
24
|
-
isShowSuccessMessage?: boolean
|
|
25
|
-
successDefaultMessage?: string
|
|
26
|
-
isShowErrorMessage?: boolean
|
|
27
|
-
errorDefaultMessage?: string
|
|
28
|
-
statesHook?: AlovaOptions<AG>['statesHook']
|
|
29
|
-
successMessageFunc?: (message: string) => void
|
|
30
|
-
errorMessageFunc?: (message: string) => void
|
|
31
|
-
unAuthorizedResponseFunc?: () => void
|
|
32
|
-
requestAdapter?: AlovaOptions<AG>['requestAdapter']
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface CustomConfig {
|
|
36
|
-
isTransformResponse?: boolean
|
|
37
|
-
isShowSuccessMessage?: boolean
|
|
38
|
-
isShowErrorMessage?: boolean
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
type requestOption = baseRequestOption<AlovaGenerics> & CustomConfig
|
|
42
|
-
|
|
43
|
-
export const createInstance = (option: requestOption) => {
|
|
44
|
-
const defaultOption: requestOption = {
|
|
45
|
-
baseUrl: '/',
|
|
46
|
-
timeout: 0,
|
|
47
|
-
statusMap: {
|
|
48
|
-
success: 200,
|
|
49
|
-
unAuthorized: 401,
|
|
50
|
-
},
|
|
51
|
-
codeMap: {
|
|
52
|
-
success: [200],
|
|
53
|
-
unAuthorized: [401],
|
|
54
|
-
},
|
|
55
|
-
responseDataKey: 'data',
|
|
56
|
-
responseMessageKey: 'message',
|
|
57
|
-
isTransformResponse: true,
|
|
58
|
-
isShowSuccessMessage: false,
|
|
59
|
-
successDefaultMessage: '操作成功',
|
|
60
|
-
isShowErrorMessage: true,
|
|
61
|
-
errorDefaultMessage: '服务异常',
|
|
62
|
-
requestAdapter: adapterFetch(),
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const mergeOption: baseRequestOption<AlovaGenerics> & CustomConfig = deepMergeObject(
|
|
66
|
-
defaultOption,
|
|
67
|
-
option,
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
const instance = createAlova({
|
|
71
|
-
baseURL: mergeOption.baseUrl,
|
|
72
|
-
timeout: mergeOption.timeout,
|
|
73
|
-
statesHook: mergeOption?.statesHook,
|
|
74
|
-
requestAdapter: mergeOption.requestAdapter as AlovaOptions<AlovaGenerics>['requestAdapter'],
|
|
75
|
-
beforeRequest: async (method) => {
|
|
76
|
-
for (const [key, value] of Object.entries(option?.commonHeaders ?? {})) {
|
|
77
|
-
method.config.headers[key] = typeof value === 'function' ? value() : value
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
responded: {
|
|
81
|
-
onSuccess: async (response) => {
|
|
82
|
-
if (!mergeOption?.isTransformResponse) return response
|
|
83
|
-
const { status } = response
|
|
84
|
-
|
|
85
|
-
// 判断响应类型:如果使用 adapterFetch,response.data 是可读流,则调用 json();否则直接使用 response.data
|
|
86
|
-
const data =
|
|
87
|
-
response?.body && isReadableStream(response.body)
|
|
88
|
-
? await response.json() // adapterFetch 的响应,使用 json() 解析可读流
|
|
89
|
-
: response.data // 其他适配器的响应
|
|
90
|
-
// 不成功的情况
|
|
91
|
-
if (status !== mergeOption.statusMap?.success) {
|
|
92
|
-
// 如果后端使用status 字段来表示未授权,则返回401
|
|
93
|
-
if (mergeOption?.statusMap?.unAuthorized === status) {
|
|
94
|
-
mergeOption?.unAuthorizedResponseFunc?.()
|
|
95
|
-
}
|
|
96
|
-
return Promise.reject(response)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const {
|
|
100
|
-
responseDataKey,
|
|
101
|
-
codeMap,
|
|
102
|
-
isShowSuccessMessage,
|
|
103
|
-
responseMessageKey,
|
|
104
|
-
isShowErrorMessage,
|
|
105
|
-
} = mergeOption
|
|
106
|
-
const {
|
|
107
|
-
code,
|
|
108
|
-
[responseDataKey as string]: responseData,
|
|
109
|
-
[responseMessageKey as string]: responseMessage,
|
|
110
|
-
} = data
|
|
111
|
-
if (!codeMap?.success?.includes(+code)) {
|
|
112
|
-
// code unAuthorized 处理
|
|
113
|
-
if (codeMap?.unAuthorized?.includes(+code)) {
|
|
114
|
-
mergeOption?.unAuthorizedResponseFunc?.()
|
|
115
|
-
return Promise.reject(response)
|
|
116
|
-
}
|
|
117
|
-
// 其他错误直接打印msg
|
|
118
|
-
|
|
119
|
-
const errorMessage = data[responseMessageKey as string] ?? mergeOption.errorDefaultMessage
|
|
120
|
-
if (isShowErrorMessage) mergeOption?.errorMessageFunc?.(errorMessage)
|
|
121
|
-
return Promise.reject(response)
|
|
122
|
-
}
|
|
123
|
-
if (isShowSuccessMessage)
|
|
124
|
-
mergeOption?.successMessageFunc?.(responseMessage ?? mergeOption.successDefaultMessage)
|
|
125
|
-
return responseData
|
|
126
|
-
},
|
|
127
|
-
onError: (error) => {
|
|
128
|
-
if (mergeOption?.isShowErrorMessage)
|
|
129
|
-
mergeOption.errorMessageFunc?.(
|
|
130
|
-
error.response?.data?.message ?? mergeOption?.errorDefaultMessage,
|
|
131
|
-
)
|
|
132
|
-
},
|
|
133
|
-
// onComplete: (_method) => {},
|
|
134
|
-
},
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
return instance
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// 🚀 创建双重调用实例的工厂函数
|
|
141
|
-
export const createDualCallInstance = (baseConfig: baseRequestOption<AlovaGenerics>) => {
|
|
142
|
-
// 创建默认实例
|
|
143
|
-
const defaultInstance = createInstance(baseConfig)
|
|
144
|
-
|
|
145
|
-
// 双重调用函数
|
|
146
|
-
const dualInstance = (option?: CustomConfig) => {
|
|
147
|
-
if (option) {
|
|
148
|
-
// 合并配置并创建新实例
|
|
149
|
-
const mergedConfig = { ...baseConfig, ...option }
|
|
150
|
-
return createInstance(mergedConfig)
|
|
151
|
-
}
|
|
152
|
-
return defaultInstance
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// 🎯 直接绑定 HTTP 方法,无需复杂类型注释
|
|
156
|
-
dualInstance.Get = defaultInstance.Get.bind(defaultInstance)
|
|
157
|
-
dualInstance.Post = defaultInstance.Post.bind(defaultInstance)
|
|
158
|
-
dualInstance.Put = defaultInstance.Put.bind(defaultInstance)
|
|
159
|
-
dualInstance.Delete = defaultInstance.Delete.bind(defaultInstance)
|
|
160
|
-
dualInstance.Patch = defaultInstance.Patch.bind(defaultInstance)
|
|
161
|
-
dualInstance.Head = defaultInstance.Head.bind(defaultInstance)
|
|
162
|
-
dualInstance.Options = defaultInstance.Options.bind(defaultInstance)
|
|
163
|
-
dualInstance.Request = defaultInstance.Request.bind(defaultInstance)
|
|
164
|
-
|
|
165
|
-
return dualInstance
|
|
166
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export const deepMergeObject = <T = any>(source: T, target: Partial<T>): T => {
|
|
2
|
-
const isObject = (obj: any): obj is Record<string, any> =>
|
|
3
|
-
obj && typeof obj === 'object' && !Array.isArray(obj)
|
|
4
|
-
|
|
5
|
-
const merge = (src: any, tgt: any): any => {
|
|
6
|
-
if (isObject(src) && isObject(tgt)) {
|
|
7
|
-
Object.keys(tgt).forEach((key) => {
|
|
8
|
-
if (isObject(tgt[key])) {
|
|
9
|
-
src[key] = merge(src[key] || {}, tgt[key])
|
|
10
|
-
} else {
|
|
11
|
-
src[key] = tgt[key]
|
|
12
|
-
}
|
|
13
|
-
})
|
|
14
|
-
}
|
|
15
|
-
return src
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return merge({ ...source }, target)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* 判断一个变量是不是可读流
|
|
23
|
-
* @param data
|
|
24
|
-
*/
|
|
25
|
-
export const isReadableStream = (data: unknown): boolean => {
|
|
26
|
-
if (!(data instanceof ReadableStream)) {
|
|
27
|
-
return false
|
|
28
|
-
}
|
|
29
|
-
if (typeof data.locked !== 'boolean') return false
|
|
30
|
-
|
|
31
|
-
const instanceFunc = ['cancel', 'getReader', 'pipeThrough', 'pipeTo', 'tee'] as const
|
|
32
|
-
|
|
33
|
-
for (const func of instanceFunc) {
|
|
34
|
-
if (typeof data[func] !== 'function') return false
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return true
|
|
38
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { envVariables } from '../env'
|
|
2
|
-
import { createDualCallInstance } from './core'
|
|
3
|
-
import { router } from '@/router'
|
|
4
|
-
import { ElMessage } from 'element-plus'
|
|
5
|
-
import 'element-plus/es/components/message/style/css'
|
|
6
|
-
import vueHook from 'alova/vue'
|
|
7
|
-
import { axiosRequestAdapter } from '@alova/adapter-axios'
|
|
8
|
-
|
|
9
|
-
const getBaseConfig = (): Parameters<typeof createDualCallInstance>[0] => {
|
|
10
|
-
return {
|
|
11
|
-
baseUrl: `/${envVariables.PUBLIC_PORT}`,
|
|
12
|
-
statusMap: {
|
|
13
|
-
success: 200,
|
|
14
|
-
unAuthorized: 401,
|
|
15
|
-
},
|
|
16
|
-
codeMap: {
|
|
17
|
-
success: [200],
|
|
18
|
-
},
|
|
19
|
-
responseDataKey: 'data',
|
|
20
|
-
responseMessageKey: 'msg',
|
|
21
|
-
commonHeaders: {},
|
|
22
|
-
successMessageFunc: (msg: string) => {
|
|
23
|
-
ElMessage.success(msg)
|
|
24
|
-
},
|
|
25
|
-
errorMessageFunc: (msg: string) => {
|
|
26
|
-
ElMessage.error(msg)
|
|
27
|
-
},
|
|
28
|
-
unAuthorizedResponseFunc: () => {
|
|
29
|
-
router.push('/login')
|
|
30
|
-
ElMessage.error('登录过期或未登录')
|
|
31
|
-
},
|
|
32
|
-
statesHook: vueHook,
|
|
33
|
-
requestAdapter: axiosRequestAdapter(),
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const alovaRequest = createDualCallInstance(getBaseConfig())
|
|
38
|
-
|
|
39
|
-
export default alovaRequest
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import SvgIcon from '@/components/Icon/svg-icon.vue'
|
|
3
|
-
|
|
4
|
-
const a = ref()
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<template>
|
|
8
|
-
<div class="text-red flex-center">
|
|
9
|
-
home
|
|
10
|
-
<el-date-picker v-model="a" type="date" value-format="yyyy-MM-dd" />
|
|
11
|
-
<SvgIcon name="vue" class="text-green" />
|
|
12
|
-
<el-button type="primary">按钮</el-button>
|
|
13
|
-
</div>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<style lang="scss" scoped></style>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import path from 'node:path'
|
|
2
|
-
import Vue from '@vitejs/plugin-vue'
|
|
3
|
-
import AutoImport from 'unplugin-auto-import/vite'
|
|
4
|
-
import { defineConfig, loadEnv } from 'vite'
|
|
5
|
-
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
|
6
|
-
import Components from 'unplugin-vue-components/vite'
|
|
7
|
-
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
8
|
-
import Inspect from 'vite-plugin-inspect'
|
|
9
|
-
import UnoCSS from 'unocss/vite'
|
|
10
|
-
import { PlusProComponentsResolver } from '@plus-pro-components/resolver'
|
|
11
|
-
|
|
12
|
-
// https://vite.dev/config/
|
|
13
|
-
export default defineConfig(({ command, mode }) => {
|
|
14
|
-
const root = process.cwd()
|
|
15
|
-
const env = loadEnv(mode, root)
|
|
16
|
-
const { VITE_PORT } = env
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
resolve: {
|
|
20
|
-
alias: {
|
|
21
|
-
'@': path.resolve(__dirname, 'src'),
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
server: {
|
|
25
|
-
port: Number(VITE_PORT),
|
|
26
|
-
host: '0.0.0.0',
|
|
27
|
-
open: false,
|
|
28
|
-
proxy: {},
|
|
29
|
-
},
|
|
30
|
-
plugins: [
|
|
31
|
-
Vue(),
|
|
32
|
-
AutoImport({
|
|
33
|
-
imports: ['vue', 'vue-router'],
|
|
34
|
-
resolvers: [ElementPlusResolver()],
|
|
35
|
-
dts: './src/types/auto-import.d.ts',
|
|
36
|
-
}),
|
|
37
|
-
Components({
|
|
38
|
-
resolvers: [ElementPlusResolver(), PlusProComponentsResolver()],
|
|
39
|
-
dts: './src/types/components.d.ts',
|
|
40
|
-
}),
|
|
41
|
-
createSvgIconsPlugin({
|
|
42
|
-
// Specify the icon folder to be cached
|
|
43
|
-
iconDirs: [path.resolve(__dirname, 'src/assets/icon')],
|
|
44
|
-
// Specify symbolId format
|
|
45
|
-
symbolId: 'icon-[dir]-[name]',
|
|
46
|
-
}),
|
|
47
|
-
UnoCSS(),
|
|
48
|
-
Inspect(),
|
|
49
|
-
],
|
|
50
|
-
}
|
|
51
|
-
})
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"oxc.enable": false,
|
|
3
|
-
"biome.enabled": false,
|
|
4
|
-
"typescript.tsdk": "node_modules\\typescript\\lib",
|
|
5
|
-
// Disable the default formatter, use eslint instead
|
|
6
|
-
"prettier.enable": false,
|
|
7
|
-
"editor.formatOnSave": false,
|
|
8
|
-
|
|
9
|
-
// Auto fix
|
|
10
|
-
"editor.codeActionsOnSave": {
|
|
11
|
-
"source.fixAll.eslint": "explicit",
|
|
12
|
-
"source.organizeImports": "never"
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
16
|
-
"eslint.rules.customizations": [
|
|
17
|
-
{ "rule": "style/*", "severity": "off", "fixable": true },
|
|
18
|
-
{ "rule": "format/*", "severity": "off", "fixable": true },
|
|
19
|
-
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
|
20
|
-
{ "rule": "*-spacing", "severity": "off", "fixable": true },
|
|
21
|
-
{ "rule": "*-spaces", "severity": "off", "fixable": true },
|
|
22
|
-
{ "rule": "*-order", "severity": "off", "fixable": true },
|
|
23
|
-
{ "rule": "*-dangle", "severity": "off", "fixable": true },
|
|
24
|
-
{ "rule": "*-newline", "severity": "off", "fixable": true },
|
|
25
|
-
{ "rule": "*quotes", "severity": "off", "fixable": true },
|
|
26
|
-
{ "rule": "*semi", "severity": "off", "fixable": true }
|
|
27
|
-
],
|
|
28
|
-
|
|
29
|
-
// Enable eslint for all supported languages
|
|
30
|
-
"eslint.validate": [
|
|
31
|
-
"javascript",
|
|
32
|
-
"javascriptreact",
|
|
33
|
-
"typescript",
|
|
34
|
-
"typescriptreact",
|
|
35
|
-
"vue",
|
|
36
|
-
"html",
|
|
37
|
-
"markdown",
|
|
38
|
-
"json",
|
|
39
|
-
"json5",
|
|
40
|
-
"jsonc",
|
|
41
|
-
"yaml",
|
|
42
|
-
"toml",
|
|
43
|
-
"xml",
|
|
44
|
-
"gql",
|
|
45
|
-
"graphql",
|
|
46
|
-
"astro",
|
|
47
|
-
"svelte",
|
|
48
|
-
"css",
|
|
49
|
-
"less",
|
|
50
|
-
"scss",
|
|
51
|
-
"pcss",
|
|
52
|
-
"postcss"
|
|
53
|
-
],
|
|
54
|
-
"cSpell.words": [
|
|
55
|
-
"alova",
|
|
56
|
-
"Attributify",
|
|
57
|
-
"CPUBMED",
|
|
58
|
-
"unocss",
|
|
59
|
-
"unplugin",
|
|
60
|
-
"VITE"
|
|
61
|
-
]
|
|
62
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// 扩展 vue-router 的类型
|
|
File without changes
|
/package/{template-vue-vite-biome/src/styles/font.scss → template-vp-react-shadcn/src/api/.gitkeep}
RENAMED
|
File without changes
|