create-bubbles 0.1.0 → 0.1.2
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 +1 -1
- package/package.json +1 -1
- package/template-react-rsbuild-biome/.prettierrc +1 -2
- package/template-react-rsbuild-biome/.vscode/settings.json +6 -10
- package/template-react-rsbuild-biome/biome.json +17 -5
- package/template-react-rsbuild-biome/package.json +22 -22
- package/template-react-rsbuild-biome/rsbuild.config.ts +2 -2
- package/template-react-rsbuild-biome/src/App.tsx +5 -6
- package/template-react-rsbuild-biome/src/index.tsx +1 -3
- package/template-react-rsbuild-biome/src/pages/home/index.tsx +1 -1
- package/template-react-rsbuild-biome/src/styles/index.scss +2 -1
- package/template-react-rsbuild-biome/src/utils/request/core/index.ts +166 -0
- package/template-react-rsbuild-biome/src/utils/request/core/utils.ts +38 -0
- package/template-react-rsbuild-biome/src/utils/request/index.ts +34 -68
- package/template-react-rsbuild-biome/uno.config.ts +3 -5
- package/template-vue-rolldown-oxc/.env +1 -3
- package/template-vue-rolldown-oxc/.env.development +1 -0
- package/template-vue-rolldown-oxc/.env.production +1 -0
- package/template-vue-rolldown-oxc/.prettierignore +34 -0
- package/template-vue-rolldown-oxc/package.json +17 -15
- package/template-vue-rolldown-oxc/src/main.ts +4 -6
- package/template-vue-rolldown-oxc/src/store/modules/user.ts +17 -0
- package/template-vue-rolldown-oxc/src/types/auto-import.d.ts +3 -1
- package/template-vue-rolldown-oxc/src/utils/env.ts +8 -3
- package/template-vue-rolldown-oxc/src/utils/request/core/index.ts +166 -0
- package/template-vue-rolldown-oxc/src/utils/request/core/utils.ts +38 -0
- package/template-vue-rolldown-oxc/src/utils/request/index.ts +41 -0
- package/template-vue-rolldown-oxc/vite.config.ts +2 -0
- package/template-vue-rsbuild-biome/.env +4 -2
- package/template-vue-rsbuild-biome/.env.development +1 -0
- package/template-vue-rsbuild-biome/.env.production +1 -0
- package/template-vue-rsbuild-biome/.vscode/settings.json +6 -0
- package/template-vue-rsbuild-biome/biome.json +3 -4
- package/template-vue-rsbuild-biome/package.json +14 -11
- package/template-vue-rsbuild-biome/rsbuild.config.ts +0 -1
- package/template-vue-rsbuild-biome/src/index.ts +0 -2
- package/template-vue-rsbuild-biome/src/utils/env.ts +10 -0
- package/template-vue-rsbuild-biome/src/utils/request/core/index.ts +166 -0
- package/template-vue-rsbuild-biome/src/utils/request/core/utils.ts +38 -0
- package/template-vue-rsbuild-biome/src/utils/request/index.ts +31 -69
- package/template-vue-rsbuild-biome/tsconfig.json +1 -1
- package/template-react-rsbuild-biome/src/utils/request/axios.ts +0 -83
- package/template-vue-rolldown-oxc/postcss.config.js +0 -5
- package/template-vue-rsbuild-biome/src/utils/request/axios.ts +0 -83
|
@@ -15,37 +15,39 @@
|
|
|
15
15
|
"**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,vue,astro,svelte}": "oxlint"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
+
"@alova/adapter-axios": "^2.0.16",
|
|
18
19
|
"@element-plus/icons-vue": "^2.3.2",
|
|
19
|
-
"@vueuse/core": "^13.
|
|
20
|
-
"
|
|
20
|
+
"@vueuse/core": "^13.9.0",
|
|
21
|
+
"alova": "^3.3.4",
|
|
22
|
+
"axios": "^1.12.1",
|
|
23
|
+
"dayjs": "^1.11.18",
|
|
21
24
|
"echarts": "^6.0.0",
|
|
22
|
-
"element-plus": "^2.
|
|
25
|
+
"element-plus": "^2.11.2",
|
|
23
26
|
"pinia": "^3.0.3",
|
|
24
|
-
"pinia-plugin-persistedstate": "^4.
|
|
27
|
+
"pinia-plugin-persistedstate": "^4.5.0",
|
|
25
28
|
"radash": "^12.1.1",
|
|
26
|
-
"vue": "^3.5.
|
|
29
|
+
"vue": "^3.5.21",
|
|
27
30
|
"vue-router": "^4.5.1"
|
|
28
31
|
},
|
|
29
32
|
"devDependencies": {
|
|
30
33
|
"@commitlint/cli": "^19.8.1",
|
|
31
34
|
"@commitlint/config-conventional": "^19.8.1",
|
|
32
|
-
"@ianvs/prettier-plugin-sort-imports": "^4.
|
|
35
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
|
|
33
36
|
"@prettier/plugin-oxc": "^0.0.4",
|
|
34
|
-
"@unocss/postcss": "^66.4.2",
|
|
35
37
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
36
|
-
"@vue/tsconfig": "^0.
|
|
38
|
+
"@vue/tsconfig": "^0.8.1",
|
|
37
39
|
"fast-glob": "^3.3.3",
|
|
38
|
-
"lefthook": "^1.
|
|
39
|
-
"oxlint": "^1.
|
|
40
|
+
"lefthook": "^1.13.0",
|
|
41
|
+
"oxlint": "^1.15.0",
|
|
40
42
|
"prettier": "^3.6.2",
|
|
41
|
-
"sass": "^1.
|
|
43
|
+
"sass": "^1.92.1",
|
|
42
44
|
"typescript": "~5.9.2",
|
|
43
|
-
"unocss": "^66.
|
|
44
|
-
"unplugin-auto-import": "^20.
|
|
45
|
+
"unocss": "^66.5.1",
|
|
46
|
+
"unplugin-auto-import": "^20.1.0",
|
|
45
47
|
"unplugin-vue-components": "^29.0.0",
|
|
46
48
|
"vite": "npm:rolldown-vite@latest",
|
|
47
|
-
"vite-plugin-inspect": "^11.3.
|
|
49
|
+
"vite-plugin-inspect": "^11.3.3",
|
|
48
50
|
"vite-plugin-svg-icons": "^2.0.1",
|
|
49
|
-
"vue-tsc": "^3.0.
|
|
51
|
+
"vue-tsc": "^3.0.7"
|
|
50
52
|
}
|
|
51
53
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { createApp } from 'vue'
|
|
2
|
-
|
|
3
|
-
import '@/styles/index.scss'
|
|
4
1
|
import '@/styles/element-plus-variables.css'
|
|
5
|
-
|
|
2
|
+
import '@/styles/index.scss'
|
|
3
|
+
import 'virtual:svg-icons-register'
|
|
4
|
+
import 'virtual:uno.css'
|
|
5
|
+
import { createApp } from 'vue'
|
|
6
6
|
import App from './App.vue'
|
|
7
7
|
import { setupRouter } from './router'
|
|
8
8
|
import { setupStore } from './store'
|
|
9
9
|
|
|
10
|
-
import 'virtual:svg-icons-register'
|
|
11
|
-
|
|
12
10
|
const app = createApp(App)
|
|
13
11
|
setupRouter(app)
|
|
14
12
|
setupStore(app)
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
}
|
|
@@ -15,12 +15,14 @@ declare global {
|
|
|
15
15
|
const effectScope: typeof import('vue')['effectScope']
|
|
16
16
|
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
|
17
17
|
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
|
18
|
+
const getCurrentWatcher: typeof import('vue')['getCurrentWatcher']
|
|
18
19
|
const h: typeof import('vue')['h']
|
|
19
20
|
const inject: typeof import('vue')['inject']
|
|
20
21
|
const isProxy: typeof import('vue')['isProxy']
|
|
21
22
|
const isReactive: typeof import('vue')['isReactive']
|
|
22
23
|
const isReadonly: typeof import('vue')['isReadonly']
|
|
23
24
|
const isRef: typeof import('vue')['isRef']
|
|
25
|
+
const isShallow: typeof import('vue')['isShallow']
|
|
24
26
|
const markRaw: typeof import('vue')['markRaw']
|
|
25
27
|
const nextTick: typeof import('vue')['nextTick']
|
|
26
28
|
const onActivated: typeof import('vue')['onActivated']
|
|
@@ -71,6 +73,6 @@ declare global {
|
|
|
71
73
|
// for type re-export
|
|
72
74
|
declare global {
|
|
73
75
|
// @ts-ignore
|
|
74
|
-
export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
|
|
76
|
+
export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, ShallowRef, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
|
|
75
77
|
import('vue')
|
|
76
78
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 通过一个文件导出所有的环境变量这样方便统一修改
|
|
3
|
+
* @returns
|
|
4
|
+
*/
|
|
1
5
|
export const envVariables = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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,
|
|
5
10
|
}
|
|
@@ -0,0 +1,166 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
|
|
11
|
+
return {
|
|
12
|
+
baseUrl: `/${envVariables.PUBLIC_PORT}`,
|
|
13
|
+
statusMap: {
|
|
14
|
+
success: 200,
|
|
15
|
+
unAuthorized: 401,
|
|
16
|
+
},
|
|
17
|
+
codeMap: {
|
|
18
|
+
success: [200],
|
|
19
|
+
},
|
|
20
|
+
responseDataKey: 'data',
|
|
21
|
+
responseMessageKey: 'msg',
|
|
22
|
+
commonHeaders: {
|
|
23
|
+
},
|
|
24
|
+
successMessageFunc: (msg: string) => {
|
|
25
|
+
ElMessage.success(msg)
|
|
26
|
+
},
|
|
27
|
+
errorMessageFunc: (msg: string) => {
|
|
28
|
+
ElMessage.error(msg)
|
|
29
|
+
},
|
|
30
|
+
unAuthorizedResponseFunc: () => {
|
|
31
|
+
router.push('/login')
|
|
32
|
+
ElMessage.error('登录过期或未登录')
|
|
33
|
+
},
|
|
34
|
+
statesHook: vueHook,
|
|
35
|
+
requestAdapter: axiosRequestAdapter(),
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const alovaRequest = createDualCallInstance(getBaseConfig())
|
|
40
|
+
|
|
41
|
+
export default alovaRequest
|
|
@@ -6,6 +6,7 @@ import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
|
|
6
6
|
import Components from 'unplugin-vue-components/vite'
|
|
7
7
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
8
8
|
import Inspect from 'vite-plugin-inspect'
|
|
9
|
+
import UnoCSS from 'unocss/vite'
|
|
9
10
|
|
|
10
11
|
// https://vite.dev/config/
|
|
11
12
|
export default defineConfig(({ command, mode }) => {
|
|
@@ -43,6 +44,7 @@ export default defineConfig(({ command, mode }) => {
|
|
|
43
44
|
symbolId: 'icon-[dir]-[name]',
|
|
44
45
|
}),
|
|
45
46
|
Inspect(),
|
|
47
|
+
UnoCSS()
|
|
46
48
|
],
|
|
47
49
|
}
|
|
48
50
|
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PUBLIC_API_URL = 'http://localhost:8080'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PUBLIC_API_URL = 'http://localhost:8080'
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"editor.formatOnSave": true,
|
|
3
3
|
"editor.defaultFormatter": "biomejs.biome",
|
|
4
|
+
"editor.codeActionsOnSave": {
|
|
5
|
+
"source.fixAll.biome": "explicit"
|
|
6
|
+
},
|
|
7
|
+
"[sass]": {
|
|
8
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
9
|
+
},
|
|
4
10
|
"[vue]": {
|
|
5
11
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
6
12
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
|
3
3
|
"files": {
|
|
4
|
-
"ignoreUnknown": true
|
|
4
|
+
"ignoreUnknown": true,
|
|
5
|
+
"includes": ["**", "!public/**/*", "!node_modules/**/*", "!dist/**/*"]
|
|
5
6
|
},
|
|
6
7
|
"formatter": {
|
|
7
8
|
"enabled": true,
|
|
@@ -54,9 +55,7 @@
|
|
|
54
55
|
"useAriaPropsForRole": "off",
|
|
55
56
|
"useValidAnchor": "off"
|
|
56
57
|
},
|
|
57
|
-
"nursery":
|
|
58
|
-
"useUniqueElementIds": "off"
|
|
59
|
-
}
|
|
58
|
+
"nursery": "off"
|
|
60
59
|
}
|
|
61
60
|
},
|
|
62
61
|
"css": {
|
|
@@ -11,23 +11,26 @@
|
|
|
11
11
|
"preview": "rsbuild preview"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"
|
|
14
|
+
"@alova/adapter-axios": "^2.0.16",
|
|
15
|
+
"alova": "^3.3.4",
|
|
16
|
+
"axios": "^1.12.1",
|
|
17
|
+
"element-plus": "^2.11.2",
|
|
15
18
|
"pinia": "^3.0.3",
|
|
16
|
-
"vue": "^3.5.
|
|
19
|
+
"vue": "^3.5.21",
|
|
17
20
|
"vue-router": "^4.5.1"
|
|
18
21
|
},
|
|
19
22
|
"devDependencies": {
|
|
20
|
-
"@biomejs/biome": "^2.
|
|
21
|
-
"@ianvs/prettier-plugin-sort-imports": "^4.
|
|
22
|
-
"@rsbuild/core": "^1.
|
|
23
|
-
"@rsbuild/plugin-sass": "^1.
|
|
24
|
-
"@rsbuild/plugin-vue": "^1.1.
|
|
25
|
-
"@unocss/postcss": "^66.
|
|
26
|
-
"lefthook": "^1.
|
|
23
|
+
"@biomejs/biome": "^2.2.4",
|
|
24
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
|
|
25
|
+
"@rsbuild/core": "^1.5.6",
|
|
26
|
+
"@rsbuild/plugin-sass": "^1.4.0",
|
|
27
|
+
"@rsbuild/plugin-vue": "^1.1.2",
|
|
28
|
+
"@unocss/postcss": "^66.5.1",
|
|
29
|
+
"lefthook": "^1.13.0",
|
|
27
30
|
"prettier": "^3.6.2",
|
|
28
31
|
"typescript": "^5.9.2",
|
|
29
|
-
"unocss": "^66.
|
|
30
|
-
"unplugin-auto-import": "^20.
|
|
32
|
+
"unocss": "^66.5.1",
|
|
33
|
+
"unplugin-auto-import": "^20.1.0",
|
|
31
34
|
"unplugin-vue-components": "^29.0.0"
|
|
32
35
|
}
|
|
33
36
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
}
|